/// <summary> /// Same version as above, but gives the possibility of reusing the output buffer /// </summary> /// <param name="output"></param> /// <param name="rhs"></param> /// <param name="lhsOperation"></param> /// <param name="rhsOperation"></param> /// <param name="alpha"></param> public void Multiply(ColumnWiseMatrix output, ColumnWiseMatrix rhs, MatrixOperation lhsOperation = MatrixOperation.None, MatrixOperation rhsOperation = MatrixOperation.None, double alpha = 1.0, double beta = 0.0) { if (lhsOperation == MatrixOperation.None) { Debug.Assert(rhs.nRows == nCols); Debug.Assert(output.nRows == nRows); Debug.Assert(output.nCols == rhs.nCols); } else { Debug.Assert(rhs.nCols == nCols); Debug.Assert(output.nCols == nRows); Debug.Assert(output.nRows == rhs.nCols); } Debug.Assert(memorySpace == rhs.memorySpace); Debug.Assert(memorySpace == output.memorySpace); Debug.Assert(mathDomain == rhs.mathDomain); Debug.Assert(mathDomain == output.mathDomain); Debug.Assert(Buffer.pointer != 0); Debug.Assert(rhs.Buffer.pointer != 0); Debug.Assert(output.Buffer.pointer != 0); CuBlasApi.Multiply(output._buffer, _buffer, rhs._buffer, nRows, rhs.nRows, lhsOperation, rhsOperation, alpha, beta); }
public static ColumnWiseMatrix operator *(ColumnWiseMatrix lhs, ColumnWiseMatrix rhs) { Debug.Assert(rhs.nRows == lhs.nCols); Debug.Assert(lhs.memorySpace == rhs.memorySpace); Debug.Assert(lhs.mathDomain == rhs.mathDomain); Debug.Assert(lhs.Buffer.pointer != 0); Debug.Assert(rhs.Buffer.pointer != 0); ColumnWiseMatrix ret = new ColumnWiseMatrix(lhs.nRows, rhs.nCols, lhs.memorySpace, rhs.mathDomain); CuBlasApi.Multiply(ret._buffer, lhs._buffer, rhs._buffer, lhs.nRows, rhs.nRows, MatrixOperation.None, MatrixOperation.None, 1.0, 0.0); return(ret); }