public _mnMatrix ReturnTranspose(_mnMatrix matrix) { var nn = matrix.n; //rows var mm = matrix.m; //columns var tempVectors = new List <_nVector>(); for (int i = 0; i < mm; i++) { var tempVectorList = new List <double>(); for (int j = 0; j < nn; j++) { tempVectorList.Add(matrix.GetValueAt(j + 1, i + 1)); } tempVectors.Add(new _nVector(tempVectorList)); } return(new _mnMatrix(tempVectors, mm, nn)); }
public _mnMatrix SubtractAnotherMatrix(_mnMatrix matrix) { var MatrixComponents = new List <_nVector>(); int i = 1, j = 1; foreach (var vctor in rows) { var tmpVctor = new List <double>(); foreach (var component in vctor.Value.vector) { tmpVctor.Add(component - matrix.GetValueAt(i, j)); j++; } MatrixComponents.Add(new _nVector(tmpVctor)); j = 1; i++; } return(new _mnMatrix(MatrixComponents, i, j)); }