lib_ex_pour_HZpp/Partie_2/algebre_lineaire/sparselib++/sp1_5c/testing/tspsm.cc

1 line
15 KiB
C++
Raw Normal View History

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* ******** *** SparseLib++ */ /* ******* ** *** *** *** v. 1.5c */ /* ***** *** ******** ******** */ /* ***** *** ******** ******** R. Pozo */ /* ** ******* *** ** *** *** K. Remington */ /* ******** ******** A. Lumsdaine */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* */ /* */ /* SparseLib++ : Sparse Matrix Library */ /* */ /* National Institute of Standards and Technology */ /* University of Notre Dame */ /* Authors: R. Pozo, K. Remington, A. Lumsdaine */ /* */ /* NOTICE */ /* */ /* Permission to use, copy, modify, and distribute this software and */ /* its documentation for any purpose and without fee is hereby granted */ /* provided that the above notice appear in all copies and supporting */ /* documentation. */ /* */ /* Neither the Institutions (National Institute of Standards and Technology, */ /* University of Notre Dame) nor the Authors make any representations about */ /* the suitability of this software for any purpose. This software is */ /* provided ``as is'' without expressed or implied warranty. */ /* */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ #include <stdlib.h> #include "compcol_double.h" #include "comprow_double.h" #include "ilupre_double.h" #include "icpre_double.h" #include "iohb_double.h" #include "spblas.h" #include <console.h> // sp<73>cific mac : GR #include <SIOUX.h> // sp<73>cific mac : GR int main() { /******************************************************************/ // // // [ 1 0 0 0 0 ] // // // // | 4 5 0 0 0 | // // // // | 0 7 8 0 0 | // // // // | 0 0 9 10 0 | // // // // [ 11 0 0 0 12 ] // // // /******************************************************************/ int verbose =0; if (verbose) cout << "Testing Sparse BLAS" << endl; int errcount = 0; double val[] = {1.0, 4.0, 5.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}; int colind[] = {0, 0, 1, 1, 2, 2, 3, 0, 4 }; int rowptr[] = {0, 1, 3, 5, 7, 9}; CompRow_Mat_double Ar(5,5,9,val,rowptr,colind); int m = Ar.dim(0), n = Ar.dim(1); VECTOR_double b(n), x(m), y(m); for (int i = 0; i < m; i++) x(i) = i; b = Ar * x; CompCol_Mat_double Ac; Ac = Ar; int descra[9]; descra[0] = 0; // lower diag descra[1] = 1;