Пример #1
0
 /// <summary>
 ///     Does the substraction process, can assume that the preconditions are met.
 /// </summary>
 /// <param name="other">The other matrix.</param>
 /// <param name="output">The output matrix (Preinitialized).</param>
 protected virtual void SubtractInternal([NotNull] MatrixF other, [NotNull] MatrixF output)
 {
     for (var i = 0; i < this.Rows; i++)
     {
         for (var j = 0; j < this.Columns; j++)
         {
             output.SetAt(i, j, this.GetAt(i, j) - other.GetAt(i, j));
         }
     }
 }
Пример #2
0
        /// <summary>
        ///     Does the multiplication process, can assume that the preconditions are met.
        /// </summary>
        /// <param name="other">The other matrix.</param>
        /// <param name="output">The output matrix (Preinitialized).</param>
        protected virtual void MultiplyInternal([NotNull] MatrixF other, [NotNull] MatrixF output)
        {
            for (var i = 0; i < this.Rows; i++)
            {
                for (var j = 0; j < other.Columns; j++)
                {
                    float entry = 0;

                    for (int lr = 0; lr < this.Columns; lr++)
                    {
                        entry += this.GetAt(i, lr) * other.GetAt(lr, j);
                    }

                    output.SetAt(i, j, entry);
                }
            }
        }