Exemplo n.º 1
0
 /// <summary>
 /// Multiplies a (m-by-n) matrix by a vector, y = alpha*A*x + beta*y.
 /// </summary>
 /// <param name="matrix">The sparse matrix.</param>
 /// <param name="alpha">Scalar to multiply with matrix.</param>
 /// <param name="x">Vector of length n (column count).</param>
 /// <param name="beta">Scalar to multiply with vector y.</param>
 /// <param name="y">Vector of length m (row count), containing the result.</param>
 /// <remarks>
 /// Input values of vector y will be accumulated.
 /// </remarks>
 public static void Multiply(this SparseMatrix matrix, double alpha, Vector <double> x,
                             double beta, Vector <double> y)
 {
     Multiply(matrix, alpha, x.Data(), beta, y.Data());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Multiplies a (m-by-n) matrix by a vector, y = A*x + y.
 /// </summary>
 /// <param name="matrix">The sparse matrix.</param>
 /// <param name="x">Vector of length n (column count).</param>
 /// <param name="y">Vector of length m (row count), containing the result.</param>
 /// <remarks>
 /// Input values of vector y will be accumulated.
 /// </remarks>
 public static void Multiply(this SparseMatrix matrix, Vector <double> x, Vector <double> y)
 {
     Multiply(matrix, x.Data(), y.Data());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a diagonal matrix to a general sparse matrix B = A + Diag.
 /// </summary>
 /// <param name="matrix">The sparse matrix.</param>
 /// <param name="diag">Array containing the matrix diagonal.</param>
 /// <param name="result">The resulting sparse matrix.</param>
 /// <remarks>
 /// The matrix may be expanded slightly to allow for additions of nonzero elements
 /// to previously non-existing diagonals.
 /// </remarks>
 public static void FastAddDiagonalMatrix(this SparseMatrix matrix, Vector diag, SparseMatrix result)
 {
     FastAddDiagonalMatrix(matrix, diag.Data(), result);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Scales the matrix columns, i.e. performs the matrix by matrix product B = A * Diag  (in place).
 /// </summary>
 /// <param name="matrix">The sparse matrix.</param>
 /// <param name="diag">Array representing the diagonal matrix.</param>
 /// <param name="result">Resulting matrix (can be the same as this instance).</param>
 public static void FastScaleColumns(this SparseMatrix matrix, Vector diag, SparseMatrix result)
 {
     FastScaleColumns(matrix, diag.Data(), result);
 }