Amesos2 - Direct Sparse Solver Interfaces
Version of the Day
|
#include <complex>
#include <iostream>
#include <stdexcept>
#include <vector>
#include "klu2_defaults.hpp"
#include "klu2_analyze.hpp"
#include "klu2_factor.hpp"
#include "klu2_solve.hpp"
#include "klu2_tsolve.hpp"
#include "klu2_free_symbolic.hpp"
#include "klu2_free_numeric.hpp"
Macros | |
#define | ASSERT_EQ(a, b) if(a != b) throw std::runtime_error(#a " is different from " #b); |
Check that a and b are equal. | |
#define | ASSERT_TOL_EQ(a, b, tol) if( std::abs(a-b) > tol ) throw std::runtime_error(#a " is different from " #b); |
Check that a and b are equal to the given asolute tolerance. | |
Functions | |
template<typename T , typename tol_t > | |
void | print_and_compare (const std::vector< T > &values_a, const std::vector< T > &values_b, const tol_t tol) |
Print vectors and compare them. | |
template<typename T , typename D = int, typename tol_t > | |
void | solve_and_check (const tol_t tol) |
int | main (void) |
Data. | |
This simple example will solve the following linear system: * * Matrix Solution Right-hand side * * | 2. | 3. | | | | [ 1 ] [ 8 ] * | 3. | | 4. | | 6. | [ 2 ] [ 45 ] * | | -1. | -3. | 2. | | [ 3 ] = [ -3 ] * | | | 1. | | | [ 4 ] [ 3 ] * | | 4. | 2. | | 1. | [ 5 ] [ 19 ] * *
| |
const int | size = 5 |
int | Ap [] = {0, 2, 5, 9, 10, 12} |
Column offsets. | |
int | Ai [] = { 0 , 1 , 0 , 2 , 4 , 1 , 2 , 3 , 4 , 2 , 1 , 4 } |
Row values. | |
template<typename T > | |
auto | get_Ax () |
Get entries values. | |
template<typename T > | |
auto | get_b () |
Get right-hand side values. | |
template<typename T > | |
auto | get_x () |
Get solution. | |
template<typename T > | |
auto | get_x_transpose () |
Get solution for transposed matrix. | |
This file contains a standalone test for the KLU2
solver.
void solve_and_check | ( | const tol_t | tol | ) |
int main | ( | void | ) |
Solve for float
.
Solve for double
.
Solve for std::complex<float>
.
const int size = 5 |
Size of the system.
Referenced by Amesos2::MultiVecAdapter< Epetra_MultiVector >::getVector(), Amesos2::MultiVecAdapter< Epetra_MultiVector >::getVectorNonConst(), Amesos2::cuSOLVER< Matrix, Vector >::numericFactorization_impl(), solve_and_check(), Amesos2::cuSOLVER< Matrix, Vector >::solve_impl(), and Amesos2::cuSOLVER< Matrix, Vector >::symbolicFactorization_impl().