Identity() public static method

Create an identiry matrix, of the specified size. An identity matrix is always square.
public static Identity ( int size ) : Matrix
size int
return Matrix
Exemplo n.º 1
0
        public void Identity()
        {
            try
            {
                MatrixMath.Identity(0);
                Assert.IsTrue(false);
            }
            catch (MatrixError)
            {
            }

            double[][] checkData =
            {
                new[] { 1.0, 0.0 },
                new[] { 0.0, 1.0 }
            };
            var    check  = new Matrix(checkData);
            Matrix matrix = MatrixMath.Identity(2);

            Assert.IsTrue(check.Equals(matrix));
        }
Exemplo n.º 2
0
 /// <summary>
 /// The matrix inverted.
 /// </summary>
 /// <returns>The inverse of the matrix.</returns>
 public Matrix Inverse()
 {
     return(Solve(MatrixMath.Identity(Rows)));
 }