public ArrayMat t() { ArrayMat tMat = new ArrayMat(Cols, Rows); for (int r = 0; r < Rows; r++) { for (int c = 0; c < Cols; c++) { if (r != c) { tMat.At(c, r, At(r, c)); } } } return(tMat); }
public static ArrayMat operator +(ArrayMat z, ArrayMat w) { if (z.Cols != w.Rows) { throw new OutLookARException("Mat type must bu equal to the number of w.rows and z.cols."); } ArrayMat v = new ArrayMat(z.Rows, w.Cols); for (int r = 0; r < v.Rows; r++) { for (int c = 0; c < v.Cols; c++) { v.At(r, c, z.At(r, c) + w.At(r, c)); } } return(v); }
public static ArrayMat operator *(ArrayMat z, ArrayMat w) { if (z.Cols != w.Rows) { throw new OutLookARException("Mat type must bu equal to the number of w.rows and z.cols."); } ArrayMat v = new ArrayMat(z.Rows, w.Cols); for (int r = 0; r < v.Rows; r++) { for (int c = 0; c < v.Cols; c++) { double at = 0; for (int b = 0; b < w.Rows; b++) { at += z.At(r, b) * w.At(b, c); } v.At(r, c, at); } } return(v); }