1 #include <rocalution/rocalution.hpp>
5 using namespace rocalution
;
14 float *data
= new float[3 * n
];
15 int *row_ptr
= new int[n
+ 1];
16 int *col
= new int[3 * n
];
19 for(int i
= 0; i
< n
; i
++){
40 A
.SetDataPtrCSR(&row_ptr
, &col
, &data
,
41 "matrix", row_ptr
[n
], n
, n
);
44 A
.MoveToAccelerator();
45 x
.MoveToAccelerator();
46 b
.MoveToAccelerator();
47 r
.MoveToAccelerator();
53 CG
<LocalMatrix
<float>, LocalVector
<float>, float> ls
;
55 b
.SetRandomUniform(2342359);
61 ls
.InitTol(1e-6, 5e-4, 1e3
);
76 std::cout
<< "Solver failed with tolerance " << tol
<< std::endl
;
80 std::cout
<< "TESTS PASSED!" << std::endl
;