Ejemplo n.º 1
0
        /// <summary>
        /// The algebra remain determinant of this square.
        /// </summary>
        /// <param name="row">the row index of the sub.</param>
        /// <param name="col">the col index of the sub.</param>
        /// <returns>the algebra remain determinant of this square.</returns>
        public double AlgebraRemainDeterminant(int row, int col)
        {
            if (row < 0 || col < 0 || row >= Row || col >= Col)
            {
                throw (new ArgumentException());
            }

            SquaredMatrix s = (SquaredMatrix)this.RemainMatrix(row, col);

            return(Math.Pow(-1, row + col) * s.Determinant);
        }
Ejemplo n.º 2
0
        public LinearSystem(SquaredMatrix coe, Vector v)
        {
            if (coe.Size != v.Dimension)
            {
                throw (new ArgumentException());
            }

            Vector[] vectors = new Vector[coe.Size + 1];

            for (int i = 0; i < coe.Size; i++)
            {
                vectors[i] = coe.Cols[i];
            }
            vectors[coe.Size] = v;

            this.LMatrix = new Matrix(vectors);

            this.size = this.LMatrix.Col - 1;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The inversal matrix of this.
        /// </summary>
        /// <returns>the inversal matrix.</returns>
        public SquaredMatrix Inverse()
        {
            double determinant = this.Determinant;

            if (determinant == 0)
            {
                throw new InvalidOperationException("Cannot invert a singular matrix.");
            }

            SquaredMatrix s = new SquaredMatrix(Size);

            for (int i = 0; i < Row; i++)
            {
                for (int j = 0; j < Col; j++)
                {
                    s[j][i] = this.AlgebraRemainDeterminant(i, j);
                }
            }

            return(s / Determinant);
        }
Ejemplo n.º 4
0
 public SquaredMatrix(SquaredMatrix m)
     : base(m)
 {
 }
Ejemplo n.º 5
0
        /// <summary>
        /// The inversal matrix of this.
        /// </summary>
        /// <returns>the inversal matrix.</returns>
        public SquaredMatrix Inverse()
        {
            double determinant = this.Determinant;

            if (determinant == 0)
            {
                throw new InvalidOperationException("Cannot invert a singular matrix.");
            }

            SquaredMatrix s = new SquaredMatrix(Size);

            for (int i = 0; i < Row; i++)
            {
                for (int j = 0; j < Col; j++)
                {
                    s[j][i] = this.AlgebraRemainDeterminant(i, j);
                }
            }

            return s/Determinant;
        }
Ejemplo n.º 6
0
 public SquaredMatrix(SquaredMatrix m) : base(m)
 {
 }