pub use hybit_auto::{
BackendPolicy, HybitAnalysis, HybitPreparedStructuralSystem, HybitPreparedSystem, HybitSolver,
HybridOptions, StructuralOptions, StructuralPcgVectorPolicy, StructuralPreconditionerPolicy,
StructuralSpmvPolicy, STRUCTURAL_PARALLEL_PCG_VECTOR_MIN_N,
STRUCTURAL_PARALLEL_PCG_VECTOR_MIN_THREADS, STRUCTURAL_PARALLEL_PRECONDITIONER_MIN_NNZ,
STRUCTURAL_PARALLEL_SPMV_MIN_NNZ,
};
pub use hybit_core::{
HybitError, LinearOperator, MatrixBackend, Preconditioner, PreconditionerKind, SolveReport,
SolveStatus, SolverKind, SolverOptions,
};
pub use hybit_krylov::{
parallel_vector_worker_count, pcg, pcg_with_workspace, pcg_with_workspace_parallel_vectors,
KrylovOutcome, PcgWorkspace, PARALLEL_PCG_VECTOR_CHUNK,
};
pub use hybit_matrix::{
analyze_csr32, read_matrix_market, read_matrix_market_from_reader, write_matrix_market_general,
AbtmConfig, AbtmMatrix, AbtmStats, Csr32Matrix, DofMask, MatrixMarketError, MatrixMarketInfo,
MatrixMarketSymmetry, MatrixProfile, ParallelCsr32Operator, TileDesc, TileKind, TILE_WIDTH,
};
pub use hybit_precond::{
recommend_rigid_body_aggregate_nodes, BalancedRigidBodyTwoLevelBlockJacobiPreconditioner,
BlockJacobiPreconditioner, HybridPreconditioner, IdentityPreconditioner, JacobiPreconditioner,
LocalCholeskyRegion, ParallelRigidBodyTwoLevelPreconditioner, RigidBodyAggregation,
RigidBodyApplyProfile, RigidBodyTwoLevelBlockJacobiPreconditioner,
TwoLevelBlockJacobiPreconditioner,
};
pub fn solve(matrix: &Csr32Matrix, b: &[f64]) -> Result<(Vec<f64>, SolveReport), HybitError> {
let solver = HybitSolver::new();
let mut x = vec![0.0; matrix.ncols()];
let report = solver.solve_csr32(matrix, b, &mut x)?;
Ok((x, report))
}