GeniusOfEvil’s Blog

It is a sin to believe evil of others, but it is seldom a mistake.

Mixing stdio with iostream

leave a comment »

When mixing C stdio and C++ iostream synchronization problems can occur because the two libraries use different buffering strategies. This seems a major drawback since mixing C++ code with C libraries (that uses stdio) is a very common practice. Luckily, all we have to do to avoid these problems is to call function

ios::sync_with_stdio()

Written by Jarek Przygódzki

March 26, 2009 at 9:43 am

Posted in C++, Cpp, Programing

Tagged with ,

T. Porter & T. Duff – Compositing Digital Images

leave a comment »

If you don’t know yet ( is that possible?) what Porter and Duff operators are, this is the best place to start.

Written by Jarek Przygódzki

March 19, 2009 at 10:50 am

Neural Networks in Java, Backpropagation algorithm for layered networks

leave a comment »

During the last few weeks I’ve been programming a lot, mostly in Java. Was my code efficient? I guess so. And it worked. What more can man want ? Beauty! l I needed was to change my programming style.

So I started all over again and rewritten the most of the code from scratch.

I began with activation function

public interface Function {
     double valueOf(double x);
}
public interface ActivationFunction extends Function{
     Function getDerivative();
}
public class Sigmoid implements ActivationFunction {
     double valueOf(double x) {
          return 1 / (1 + Math.exp(-x));
     }
     Function getDerivative() {
          return new Function() {
               public double valueOf(double f) {
                    return f * ( 1 - f);
               }
     }
}

Then I needed a matrix and a vector. Unfortunately, all the implementations I’ve seen were’nt too pretty. So I followed the

If you want a thing done well, do it yourself

rule.

To Be Continued

Written by Jarek Przygódzki

March 18, 2009 at 1:29 pm

Posted in Java