protected override void Factorize(int rows, int columns, int nnz, CuSparseContext <Complex> A) { var ap = A.ColumnPointers; var ai = A.RowIndices; var ax = A.Values; var desc = A.MatrixDescriptor; // Analyze chol(A) to know structure of L. Check(NativeMethods.cusolverSpXcsrcholAnalysis(_p, rows, nnz, desc, ap, ai, _info)); int size_internal = 0, size_chol = 0; // Workspace for chol(A). Check(NativeMethods.cusolverSpZcsrcholBufferInfo(_p, rows, nnz, desc, ax, ap, ai, _info, ref size_internal, ref size_chol)); Cuda.Malloc(ref _buffer, sizeof(char) * size_chol); // Compute A = L*L^T. Check(NativeMethods.cusolverSpZcsrcholFactor(_p, rows, nnz, desc, ax, ap, ai, _info, _buffer)); }
protected override void Factorize(int rows, int columns, int nnz, CuSparseContext <double> A) { var ap = A.ColumnPointers; var ai = A.RowIndices; var ax = A.Values; var desc = A.MatrixDescriptor; // Analyze qr(A) to know structure of L. Check(NativeMethods.cusolverSpXcsrqrAnalysis(_p, rows, columns, nnz, desc, ap, ai, _info)); int size_internal = 0, size_qr = 0; // Workspace for qr(A). Check(NativeMethods.cusolverSpDcsrqrBufferInfo(_p, rows, columns, nnz, desc, ax, ap, ai, _info, ref size_internal, ref size_qr)); Cuda.Malloc(ref _buffer, sizeof(char) * size_qr); Check(NativeMethods.cusolverSpDcsrqrSetup(_p, rows, columns, nnz, desc, ax, ap, ai, 0.0, _info)); // Compute A = Q*R. Check(NativeMethods.cusolverSpDcsrqrFactor(_p, rows, columns, nnz, IntPtr.Zero, IntPtr.Zero, _info, _buffer)); }