Library/ManagedCuda/CudaSolve/Refactorization.cs
/// <summary>
/// This routine allows direct access to the lower L and upper U triangular factors stored in
/// the cuSolverRF library handle. The factors are compressed into a single matrix M=(LI)+
/// U, where the unitary diagonal of L is not stored. It is assumed that a prior call to the
/// cusolverRfRefactor() was done in order to generate these triangular factors.
/// </summary>
/// <param name="n">Size of Matrix M (n x n)</param>
/// <param name="h_nnzM">the number of non-zero elements of matrix M.</param>
/// <param name="h_Mp">the array of offsets corresponding to the start of each row in the arrays Mi and Mx.
/// This array has also an extra entry at the end that stores the number of non-zero elements in the matrix $M$. The array size is n+1.</param>
/// <param name="h_Mi">the array of column indices corresponding to the non-zero elements in the matrix M. It is assumed that this array is sorted by row and by column within each row. The array size is nnzM.</param>
/// <param name="h_Mx">the array of values corresponding to the non-zero elements in the matrix M. It is assumed that this array is sorted by row and by column within each row. The array size is nnzM.</param>
This routine allows direct access to the lower L and upper U triangular factors stored in
the cuSolverRF library handle. The factors are compressed into a single matrix M=(LI)+
U, where the unitary diagonal of L is not stored. It is assumed that a prior call to the
cusolverRfRefactor() was done in order to generate these triangular factors.
This routine allows direct access to the lower L and upper U triangular factors stored in the cuSolverRF library handle . The factors are compressed into a single matrix M = ( LI ) + U where the unitary diagonal of L is not stored . It is assumed that a prior call to the cusolverRfRefactor () was done in order to generate these triangular factors .
public void ExtractBundledFactorsHost(int n, out int h_nnzM, out int[] h_Mp, out int[] h_Mi, out double[] h_Mx)
		{
			h_nnzM = 0;
			IntPtr mp = new IntPtr();
			IntPtr mi = new IntPtr();
			IntPtr mx = new IntPtr();
			res = CudaSolveNativeMethods.Refactorization.cusolverRfExtractBundledFactorsHost(_handle, ref h_nnzM, ref mp, ref mi, ref mx);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfExtractBundledFactorsHost", res));
			if (res != cusolverStatus.Success) throw new CudaSolveException(res);
			if (h_nnzM == 0)
			{
				h_Mp = null;
				h_Mi = null;
				h_Mx = null;
			}
			else
			{
				h_Mp = new int[n+1];
				h_Mi = new int[h_nnzM];
				h_Mx = new double[h_nnzM];
				Marshal.Copy(mp, h_Mp, 0, n + 1);
				Marshal.Copy(mi, h_Mi, 0, h_nnzM);
				Marshal.Copy(mx, h_Mx, 0, h_nnzM);
			}
		}
public void ExtractBundledFactorsHost ( int n , out int h_nnzM , out int [ ] h_Mp , out int [ ] h_Mi , out double [ ] h_Mx ) { h_nnzM = 0 ; IntPtr mp = new IntPtr ( ) ; IntPtr mi = new IntPtr ( ) ; IntPtr mx = new IntPtr ( ) ; res = CudaSolveNativeMethods . Refactorization . cusolverRfExtractBundledFactorsHost ( _handle , ref h_nnzM , ref mp , ref mi , ref mx ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cusolverStatus . Success ) throw new CudaSolveException ( res ) ; if ( h_nnzM == 0 ) { h_Mp = null ; h_Mi = null ; h_Mx = null ; } else { h_Mp = new int [ n + 1 ] ; h_Mi = new int [ h_nnzM ] ; h_Mx = new double [ h_nnzM ] ; Marshal . Copy ( mp , h_Mp , 0 , n + 1 ) ; Marshal . Copy ( mi , h_Mi , 0 , h_nnzM ) ; Marshal . Copy ( mx , h_Mx , 0 , h_nnzM ) ; } }
This routine allows direct access to the lower L and upper U triangular factors stored in
the cuSolverRF library handle.
This routine allows direct access to the lower L and upper U triangular factors stored in the cuSolverRF library handle .
n
int
Size of Matrix M (n x n)
Size of Matrix M ( n x n )
int
out
int[]
out
double[]
out
h_nnzM
the number of non-zero elements of matrix M.
the number of non - zero elements of matrix M .
h_Mp
the array of offsets corresponding to the start of each row in the arrays Mi and Mx.
This array has also an extra entry at the end that stores the number of non-zero elements in the matrix $M$. The array size is n+1.
the array of offsets corresponding to the start of each row in the arrays Mi and Mx . This array has also an extra entry at the end that stores the number of non - zero elements in the matrix $M$ . The array size is n + 1 .
h_Mi
the array of column indices corresponding to the non-zero elements in the matrix M. It is assumed that this array is sorted by row and by column within each row. The array size is nnzM.
the array of column indices corresponding to the non - zero elements in the matrix M . It is assumed that this array is sorted by row and by column within each row . The array size is nnzM .
h_Mx
the array of values corresponding to the non-zero elements in the matrix M. It is assumed that this array is sorted by row and by column within each row. The array size is nnzM.
the array of values corresponding to the non - zero elements in the matrix M . It is assumed that this array is sorted by row and by column within each row . The array size is nnzM .