/// <summary> /// A = alpha * B + beta * A /// </summary> /// <param name="lhs"></param> /// <param name="rhs"></param> /// <param name="lhsOperation"></param> /// <param name="rhsOperation"></param> /// <param name="alpha"></param> /// <param name="beta"></param> /// <returns></returns> public static ColumnWiseMatrix Add(ColumnWiseMatrix lhs, ColumnWiseMatrix rhs, MatrixOperation lhsOperation = MatrixOperation.None, MatrixOperation rhsOperation = MatrixOperation.None, double alpha = 1.0, double beta = 1.0) { ColumnWiseMatrix ret = new ColumnWiseMatrix(lhs); CuBlasApi.AddEqualMatrix(ret._buffer, rhs._buffer, lhsOperation, rhsOperation, alpha, beta); return(ret); }
public static ColumnWiseMatrix Subtract(ColumnWiseMatrix lhs, ColumnWiseMatrix rhs, MatrixOperation lhsOperation = MatrixOperation.None, MatrixOperation rhsOperation = MatrixOperation.None) { ColumnWiseMatrix ret = new ColumnWiseMatrix(lhs); CuBlasApi.AddEqualMatrix(ret._buffer, rhs._buffer, lhsOperation, rhsOperation, -1.0, 1.0); return(ret); }
public static ColumnWiseMatrix operator -(ColumnWiseMatrix lhs, ColumnWiseMatrix rhs) { Debug.Assert(lhs.nRows == rhs.nRows); Debug.Assert(lhs.nCols == rhs.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 tmp = new ColumnWiseMatrix(lhs); CuBlasApi.AddEqualMatrix(tmp._buffer, rhs._buffer, MatrixOperation.None, MatrixOperation.None, -1.0, 1.0); return(tmp); }