made a struct for double matrices (including an array of pointer to rows) to facilitate efficient swaps