coding a machine learning library in c from scratch