public override Matrix <T> Multiply(Matrix <T> b) { UnitMatrix <T> matrix = b as UnitMatrix <T>; if (matrix != null) { return(new UnitMatrix <T>(factor.ToFieldWrapper() * matrix.factor)); } return(factor * b); }
public override Matrix <T> Add(Matrix <T> b) { UnitMatrix <T> matrix = b as UnitMatrix <T>; if (matrix != null) { return(new UnitMatrix <T>(factor.ToFieldWrapper() + matrix.factor)); } return(new MapMatrix <T>((i0, i1) => this[i0, i1].ToFieldWrapper() + b[i0, i1], b.rows, b.collumns)); }
public override bool Equals(object obj) { Matrix <T> matrix = obj as Matrix <T>; if (matrix != null) { UnitMatrix <T> unit = matrix as UnitMatrix <T>; if (unit != null) { return(factor.ToFieldWrapper().Equals(unit.factor)); } foreach (Tuple <T, int, int> tuple in matrix.to2DArr().CoordinateBind()) { if (!this[tuple.Item2, tuple.Item3].ToFieldWrapper().Equals(tuple.Item1)) { return(false); } } return(true); } return(false); }