matrix stuff , mainly calculate, and iteration.