dim reduction function and small changes

Dim reduce is the dimentinoality reduction function.
there are small changes to the testing function to ease the input size.