xor

XOR with Neural Networks (Matlab)

╄→гoц情女王★ 提交于 2019-12-11 03:18:05
问题 So, I'm hoping this is a real dumb thing I'm doing, and there's an easy answer. I'm trying to train a 2x3x1 neural network to do the XOR problem. It wasn't working, so I decided to dig in to see what was happening. Finally, I decided to assign the weights my self. This was the weight vector I came up with: theta1 = [11 0 -5; 0 12 -7;18 17 -20]; theta2 = [14 13 -28 -6]; (In Matlab notation). I deliberately tried to make no two weights be the same (barring the zeros) And, my code, really simple

How to find F(x,0) when F(x,i) = F(x-1,i) xor F(x-1, i+1) xor … F(x-1,n) in less than linear time

馋奶兔 提交于 2019-12-11 02:07:59
问题 Given a base array, I need to compute the value of a function given below: A[] = { a0, a1, a2, a3, .. an } F(0,i) = ai [Base case] F(1,i) = F(0,i) xor F(0,i+1) xor F(0,i+2) ... xor F(0,n) F(2,i) = F(1,i) xor F(1,i+1) xor F(1,i+2) ... xor F(1,n) . . F(x,i) = F(x-1,i) xor F(x-1,i+1) xor F(x-1,i+2) ... xor F(x-1,n) 0 < x < 10^18 0 < n < 10^5 I need to find F(x,0) . I am trying to solve this equation for the past 3 days. I have failed to optimise it and come up with a feasible solution. Any help

Overloading GetHashCode and the equality operator using the XOR operator on enums

时间秒杀一切 提交于 2019-12-11 02:05:12
问题 I have the following class which is part of a statictical analysis package. The MetricKey object is used as a dictionary key. Decision , MetricUnit & Portfolio are all enums. I had to override the equality operator (==) to get dictionary key matching working. I used the guidance at http://msdn.microsoft.com/en-us/library/ms173147.aspx. The guidance said I should overload the GetHashCode method which I have done but I don't understand the implications of casting my enums to integers for the

How to compare two bit values in C?

妖精的绣舞 提交于 2019-12-11 00:14:29
问题 I've been dabbling around a bit with C and I find that being able to directly manipulate bits is fascinating and powerful (and dangerous I suppose). I was curious as to what the best way would be to compare different bits in C would be. For instance, the number 15 is represented in binary as: 00001111 And the number 13 is represented as: 00001101 How would you compare what bits are different without counting them? It would be easy to use shifts to determine that 15 contains 4 1s and 13

what is the difference between logical OR operation and binary addition?

落爺英雄遲暮 提交于 2019-12-10 23:58:18
问题 I'm trying to understand how a binary addition and logical OR table differs. does both carry forward 1 or if not which one does carry forward operation and which does not? 回答1: The exclusive-or (XOR) operation is like binary addition, except that there is no carry from one bit position to the next. Thus, each bit position can be evaluated independently of the rest. 回答2: I'll attempt to clarify a few points with a few illustrations. First, addition. Basically like adding numbers in grade

Most efficient way to xor byte array in vb.net

核能气质少年 提交于 2019-12-10 21:56:39
问题 I am making making an application in vb.net that will read files using a byte array as buffer, and create parity files for them by xoring the data... What would be the most efficient way of xoring a byte array? I have though of convertinbg the byte array to a bitarray and then run it trough an xor operation and turn it back to a byte array, but that sounds like a very processing expensive task, and i am worried that it might impact read/write speed... is there a better way to do this? thanks.

How Can I: Generate 40/64 Bit WEP Key In Python?

自古美人都是妖i 提交于 2019-12-10 17:36:16
问题 So, I've been beating my head against the wall of this issue for several months now, partly because it's a side interest and partly because I suck at programming. I've searched and researched all across the web, but have not had any luck (except one small bit of success; see below), so I thought I might try asking the experts. What I am trying to do is, as the title suggests, generate a 40/64 bit WEP key from a passphrase, according to the "de facto" standard. (A site such as http://www

Finding the No. of Subset with a Given Xor

旧街凉风 提交于 2019-12-10 15:18:17
问题 I have an array with 10^5 elements where each element is in [0, 1023]. I have to find the number of subsets of an array such that XOR of element is Q. (for Q>1023 the answer is 0). I came up with this O(N*1024) Approach for (int i = 1; i <= n; i++ ) { int a = F[i]; for (int j = 0; j < 1024; j++ ) { ways[i][j] = ways[i-1][j] + ways[i-1][j^a]; if (ways[i][j] >= mod) ways[i][j] -= mod; } } Since elements are in Range up to 1023 , could i maintain an array of Frequency F[i] , reduce the above

How to XOR scramble a string in C and back again with the same function?

会有一股神秘感。 提交于 2019-12-10 10:15:55
问题 I am trying to obfuscate a string in a program. Currently, I only have a simple string reversal working. I would like to be able to perform XOR scrambling on the data to make it much more secure, however the method I have tried is not working. The same function and input type is used to decode the string. This is no problem with string reversal, as it just reverses back, but can this be done easily with XORing without getting too complex? I would prefer if the process kept just the one string

Maximum XOR value faster than just using XOR

人走茶凉 提交于 2019-12-10 10:14:11
问题 Given a number N and an array of integers (all nos less than 2^15). (A is size of array 100000) Find Maximum XOR value of N and a integer from the array. Q is no of queries (50000) and start, stop is the range in the array. Input: A Q a1 a2 a3 ... N start stop Output: Maximum XOR value of N and an integer in the array with the range specified. Eg: Input 15 2 (2 is no of queries) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 10 6 10 (Query 1) 10 6 10 (Query 2) Output: 13 13 Code: for(int i=start-1;i