public static Vector operator *(ColumnWiseMatrix lhs, Vector rhs) { Debug.Assert(rhs.Size == 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); Vector ret = new Vector(rhs.Size, lhs.memorySpace, rhs.mathDomain); CuBlasApi.Dot(ret.Buffer, lhs._buffer, rhs.Buffer, MatrixOperation.None, 1.0, 0.0); return(ret); }
/// <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="alpha"></param> public void Dot(Vector output, Vector rhs, MatrixOperation lhsOperation = MatrixOperation.None, double alpha = 1.0, double beta = 0.0) { if (lhsOperation == MatrixOperation.None) { Debug.Assert(rhs.Size == nCols); Debug.Assert(output.Size == nRows); } else { Debug.Assert(rhs.Size == nRows); Debug.Assert(output.Size == 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.Dot(output.Buffer, _buffer, rhs.Buffer, lhsOperation, alpha, beta); }