示例#1
0
        public SymbolVector this[RowOrColumn rc]
        {
            get
            {
                SymbolVector retVal = new SymbolVector();

                if (rc.rowColumn == RowColumn.Column)
                {
                    retVal = this[rc.Val];
                }
                else
                {
                    for (int colCount = 0; colCount < this.Columns; colCount++)
                    {
                        retVal.Add(InternalRep[rc.Val, colCount]);
                    }
                }
                return(retVal);
            }
            set
            {
                if (rc.rowColumn == RowColumn.Column)
                {
                    this[rc.Val] = value;
                }
                else
                {
                    for (int colCount = 0; colCount < this.Columns; colCount++)
                    {
                        InternalRep[rc.Val, colCount] = value[colCount];
                    }
                }
            }
        }
示例#2
0
        public static Symbol DotProduct(SymbolVector v1, SymbolVector v2)
        {
            Symbol retVal = new Symbol();

            if (v1.Count != v2.Count)
            {
                throw new Exception("Vectors must be equal in length");
            }

            for (int vectorCounter = 0; vectorCounter < v1.Count; vectorCounter++)
            {
                retVal += (v1[vectorCounter] * v2[vectorCounter]);
            }
            return(retVal);
        }
示例#3
0
        public SymbolVector this[int Column]
        {
            get
            {
                SymbolVector retVal = new SymbolVector();

                for (int rowCount = 0; rowCount < this.Rows; rowCount++)
                {
                    retVal.Add(InternalRep[rowCount, Column]);
                }

                return(retVal);
            }
            set
            {
                for (int rowCount = 0; rowCount < this.Rows; rowCount++)
                {
                    InternalRep[rowCount, Column] = value[rowCount];
                }
            }
        }
示例#4
0
        public SymbolMatrix ReName(List <string> newSymbols)
        {
            SymbolMatrix flipper = new SymbolMatrix(this.Rows, this.Columns);
            RowOrColumn  rc      = new RowOrColumn();

            rc.rowColumn = RowColumn.Row;
            rc.Val       = 0;

            SymbolVector oldSymbols = this[rc];

            for (int rowCount = 0; rowCount < Rows; rowCount++)
            {
                for (int colCount = 0; colCount < Columns; colCount++)
                {
                    int    ind = oldSymbols.FindIndex(f => f.Expression == this[rowCount, colCount].Expression);
                    Symbol sym = new Symbol(newSymbols[ind]);
                    sym.IsExpression            = true;
                    flipper[rowCount, colCount] = sym;
                }
            }
            return(flipper);
        }
示例#5
0
        public static CoFactorInfo GetCoFactor(SymbolMatrix symIn, int Column)
        {
            CoFactorInfo cfi = new CoFactorInfo();

            cfi.Sign = (int)Math.Pow(-1, Column + 1);
            SymbolVector col = symIn[Column - 1];

            cfi.CoFactor = col[0];
            List <Symbol> symList = new List <Symbol>();

            for (int rowCount = 1; rowCount < symIn.Rows; rowCount++)
            {
                for (int colCount = 0; colCount < symIn.Columns; colCount++)
                {
                    if (colCount + 1 != Column)
                    {
                        symList.Add(symIn[rowCount, colCount]);
                    }
                }
            }

            cfi.Minor = new SymbolMatrix(symIn.Rows - 1, symIn.Columns - 1, symList);
            return(cfi);
        }