/// <summary> /// Returns the transpose of this matrix. /// </summary> public virtual DenseColumnMajorStorage <T> Transpose() { var result = DenseColumnMajorStorage <T> .Create(columns, rows); this.Transpose(result); return(result); }
/// <summary> /// Returns a sub-matrix with values in given range. /// </summary> /// <param name="rowIndex">The row to start copying to.</param> /// <param name="rowCount">The number of rows to copy. Must be positive.</param> /// <param name="columnIndex">The column to start copying to.</param> /// <param name="columnCount">The number of columns to copy. Must be positive.</param> public DenseColumnMajorStorage <T> SubMatrix(int rowIndex, int rowCount, int columnIndex, int columnCount) { var result = DenseColumnMajorStorage <T> .Create(rowCount, columnCount); CopySubMatrixTo(result, rowIndex, 0, rowCount, columnIndex, 0, columnCount); return(result); }
/// <summary> /// Dense matrix multiplication, C = A*B /// </summary> /// <param name="other">The dense matrix multiplied to this instance.</param> /// <param name="options">Parallel options (optional).</param> /// <returns>C = A*B</returns> public DenseColumnMajorStorage <T> ParallelMultiply(DenseColumnMajorStorage <T> other, System.Threading.Tasks.ParallelOptions options = null) { int m = this.rows; int n = other.columns; // check inputs if (this.columns != other.RowCount) { throw new ArgumentException(Resources.MatrixDimensions, "other"); } var result = DenseColumnMajorStorage <T> .Create(m, n); ParallelMultiply(other, result, options); return(result); }
/// <summary> /// Dense matrix multiplication, C = A*B /// </summary> /// <param name="other">The dense matrix multiplied with this instance.</param> /// <returns>C = A*B</returns> public DenseColumnMajorStorage <T> Multiply(DenseColumnMajorStorage <T> other) { int m = this.rows; int n = other.columns; // check inputs if (this.columns != other.RowCount) { throw new ArgumentException(Resources.MatrixDimensions, "other"); } var result = DenseColumnMajorStorage <T> .Create(m, n); Multiply(other, result); return(result); }
/// <summary> /// Adds two matrices in CSC format, C = A + B, where A is current instance. /// </summary> public DenseColumnMajorStorage <T> Add(DenseColumnMajorStorage <T> other) { int m = this.rowCount; int n = this.columnCount; // check inputs if (m != other.RowCount || n != other.ColumnCount) { throw new ArgumentException(Resources.MatrixDimensions, "other"); } var result = DenseColumnMajorStorage <T> .Create(m, n); Add(other, result); return(result); }