Skip to main content

direct_solve

Function direct_solve 

Source
pub fn direct_solve<T: GpuFloat>(
    handle: &mut SolverHandle,
    a_dense: &mut DeviceBuffer<T>,
    n: u32,
    b: &mut DeviceBuffer<T>,
    nrhs: u32,
) -> SolverResult<()>
Expand description

Solves A * X = B directly using dense LU factorization.

The matrix a_dense is the dense representation of the sparse matrix, stored in column-major order with leading dimension n. The right-hand side b is overwritten with the solution.

This function is a convenience wrapper around lu_factorize + lu_solve for cases where the sparse matrix has been assembled into dense form.

§Arguments

  • handle — solver handle.
  • a_dense — dense matrix (n x n, column-major). Destroyed on output.
  • n — system dimension.
  • b — right-hand side / solution (n x nrhs, column-major). Overwritten.
  • nrhs — number of right-hand side columns.

§Errors

Returns SolverError::SingularMatrix if the matrix is singular. Returns SolverError::DimensionMismatch for invalid dimensions.