Example #1
0
 public void Add(MutableTensor <NCols, NRows> tensor)
 {
     for (int col = 0; col < ColumnCount; col++)
     {
         for (int row = 0; row < RowCount; row++)
         {
             this.values[col, row] += tensor.values[col, row];
         }
     }
 }
Example #2
0
        public void Mul <NOtherRows>(Tensor <NRows, NOtherRows> by, MutableTensor <NCols, NOtherRows> result)
            where NOtherRows : unmanaged, INumeral
        {
            if (by == null)
            {
                throw new ArgumentNullException(nameof(by));
            }
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            for (int resultCol = 0; resultCol < ColumnCount; resultCol++)
            {
                for (int resultRow = 0; resultRow < MutableTensor <NCols, NOtherRows> .RowCount; resultRow++)
                {
                    for (int row = 0; row < RowCount; row++)
                    {
                        result.values[resultCol, resultRow] += this.values[resultCol, row] * by.values[row, resultRow];
                    }
                }
            }
        }