コード例 #1
0
        private double DoRowVectorTimesColumn(RowVector rowVec, int myCol)
        {
            Debug.Assert(rowVec.Size == this.Rows);
            double cum = 0;

            for (int i = 0; i < rowVec.Size; i++)
            {
                cum += rowVec[i] * this.Mat[i, myCol];
            }
            return(cum);
        }
コード例 #2
0
 private RowVector RowTimesMatrix(RowVector left)
 {
     if (left.Size == this.Rows)
     {
         double[] vector = new double[left.Size];
         for (int c = 0; c < this.Cols; c++)
         {
             vector[c] = DoRowVectorTimesColumn(left, c);
         }
         return(new RowVector(vector));
     }
     else
     {
         throw new ArgumentOutOfRangeException("Bad dimensions");
     }
 }