Example #1
0
        public _nMatrix MultiplyByAnotherMatrix(_nMatrix matrix)
        {
            _nVector[] _row = new _nVector[n];
            double[]   a    = new double[n];
            for (int k = 1; k <= n; k++)
            {
                for (int j = 1; j <= n; j++)
                {
                    for (int i = 1; i <= n; i++)
                    {
                        var tmp1 = GetValueAt(k, i); var tmp2 = matrix.GetValueAt(i, j);
                        a[j - 1] += GetValueAt(k, i) * matrix.GetValueAt(i, j);
                    }
                    var tmp3 = a[j - 1];
                }

                _row[k - 1] = new _nVector(a.ToList());
                a           = new double[n];
            }
            return(new _nMatrix(_row.ToList(), n));
        }
Example #2
0
        public double MultiplyNSubdiagonalEntries(_nMatrix bMatrix, int k, int m)
        {
            var temp = 1d;
            var nn   = bMatrix.n;

            for (int i = k; i < k + m; i++)
            {
                var tmp = bMatrix.GetValueAt(i + 1, i + 2) * (-1);
                temp = temp * tmp;
            }
            return(temp);
        }
Example #3
0
        public _nVector MultiplyByMatrix(_nMatrix matrix)
        {
            var n             = matrix.n;
            var componentList = new List <double>();

            for (int i = 0; i < n; i++)
            {
                double sum = 0;
                for (int j = 0; j < n; j++)
                {
                    sum += vector[j] * matrix.GetValueAt(j + 1, i + 1);
                }
                componentList.Add(sum);
            }
            return(new _nVector(componentList));
        }
Example #4
0
        public _nMatrix SubtractAnotherMatrix(_nMatrix matrix)
        {
            var MatrixComponents = new List <_nVector>();
            int i = 1, j = 1;

            foreach (var vctor in rows)
            {
                var tmpVctor = new List <double>();
                foreach (var component in vctor.Value.vector)
                {
                    tmpVctor.Add(component - matrix.GetValueAt(i, j));
                    j++;
                }
                MatrixComponents.Add(new _nVector(tmpVctor));
                j = 1;
                i++;
            }
            return(new _nMatrix(MatrixComponents, n));
        }
Example #5
0
        public _mnMatrix MultiplyMeByNMatrix(_nMatrix matrix)
        {
            _nVector[] _row = new _nVector[n];
            var        mm   = matrix.rows.Count();

            double[] a = new double[n];
            for (int k = 1; k <= n; k++)
            {
                for (int j = 1; j <= mm; j++)
                {
                    for (int i = 1; i <= mm; i++)
                    {
                        //var tmp1 = GetValueAt(k, i); var tmp2 = matrix.GetValueAt(i, j);
                        a[j - 1] += GetValueAt(k, i) * matrix.GetValueAt(i, j);
                    }
                    // var tmp3 = a[j - 1];
                }

                _row[k - 1] = new _nVector(a.ToList());
                a           = new double[n];
            }
            return(new _mnMatrix(_row.ToList(), n, mm));
        }