convert decimal numbers to excess-127 representations

Assuming you are referring to Offset binary: https://en.wikipedia.org/wiki/Offset_binary, of which the most famous example would be Excess-3: https://en.wikipedia.org/wiki/Excess-3, then the solution would be: a) 77 + 127 mod 256 = 204 mod 256 = 204 = 11001100 b) -42 + 127 mod 256 = 85 mod 256 = 85 = 01010101 etc…

Gradient Descent implementation in octave

What you’re doing in the first example in the second block you’ve missed out a step haven’t you? I am assuming you concatenated X with a vector of ones. The last example will work but can be vectorized even more to be more simple and efficient. I’ve assumed you only have 1 feature. it will … Read more

Long cannot be dereferenced

System.currentTimeMillis() returns a primitive long not a object Long. So you cannot invoke the longValue() method or any method on it as primitive cannot be the object of method invocations. Besides, it is useless to invoke longValue() as System.currentTimeMillis() returns already a long value. This is better : But in fact this condition : if(System.currentTimeMillis()==finish) … Read more

Dynamic vs static array in c

There are several flavors of arrays, depending on how and where they are declared. Fixed-length Arrays Fixed-length arrays must have their size determined at compile time. You cannot change the size of a fixed-length array after it has been defined. Fixed-length arrays are declared in one of the following ways: In the first three cases, … Read more

Difference between char* and char** (in C)

char* is a pointer to char, char ** is a pointer to a pointer to char. char *ptr; does NOT allocate memory for characters, it allocates memory for a pointer to char. char arr[10]; allocates 10 characters and arr holds the address of the first character. (though arr is NOT a pointer (not char *) … Read more