Transpose an arbitrarily sized rectangular Matrix.




public rel[real, real, real] matrixTranspose(rel[real x, real y, real v] matrix){
    return {<y, x, v> | <x, y, v> <- matrix};
}
 
//a matrix
public rel[real x, real y, real v] matrixA = {
<0.0,0.0,12.0>, <0.0,1.0, 6.0>, <0.0,2.0,-4.0>, 
<1.0,0.0,-51.0>, <1.0,1.0,167.0>, <1.0,2.0,24.0>, 
<2.0,0.0,4.0>, <2.0,1.0,-68.0>, <2.0,2.0,-41.0>
};