public override MatrixMethod Subtract(MatrixMethod matrix) { if (matrix.GetType() != typeof(Triangle)) { base.Add(matrix); } Triangle triangle = new Triangle(size, UsePointers); triangle.StopWatchReset(); triangle.sw.Start(); for (int i = 0; i < data.Length; i++) { triangle.data[i] = data[i] - matrix.data[i]; } triangle.sw.Stop(); return(triangle); }
public override MatrixMethod Add(MatrixMethod matrix) { if (matrix.GetType() != typeof(Block)) { base.Add(matrix); } Block triangle = new Block(size, UsePointers); triangle.StopWatchReset(); triangle.sw.Start(); for (int i = 0; i < data.Length; i++) { triangle.data[i] = data[i] + matrix.data[i]; } triangle.sw.Stop(); return(triangle); }