Lis (linear Algebra Library) - Example

Example

A C program to solve the linear equation Ax=b is written as follows:

#include #include "lis_config.h" #include "lis.h" LIS_INT main(LIS_INT argc, char* argv) { LIS_MATRIX A; LIS_VECTOR b,x; LIS_SOLVER solver; LIS_INT iter; double times; lis_initialize(&argc, &argv); lis_matrix_create(LIS_COMM_WORLD,&A); lis_vector_create(LIS_COMM_WORLD,&b); lis_vector_create(LIS_COMM_WORLD,&x); lis_solver_create(&solver); lis_solver_set_optionC(solver); lis_input(A,b,x,argv); lis_vector_set_all(1.0,b); lis_vector_duplicate(A,&x); lis_solve(A,b,x,solver); lis_solver_get_iters(solver,&iter); lis_solver_get_time(solver,&times); printf("iter= %d time = %e\n",iter,times); lis_solver_destroy(solver); lis_matrix_destroy(A); lis_vector_destroy(b); lis_vector_destroy(x); lis_finalize; return 0; }

Read more about this topic:  Lis (linear Algebra Library)

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)