Example #1
0
        public static RealMatrix GetIdentityMatrix(int n)
        {
            var identityMatrix = new RealMatrix(n, n);

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (i == j)
                    {
                        identityMatrix.M[i][j] = IR.New(IZ.New(1));
                    }
                }
            }

            return(identityMatrix);
        }