3 #if (__GNUC__ == 4 && (__GNUC_MINOR__ < 7) )
11 template <
class T,
class ITYPE>
15 n =
static_cast<ITYPE
>(ceil(static_cast<float>(dim)/
RBDIM)) *
RBDIM;
18 cout <<
"Padded vector to size " << n <<
" for register blocking" << endl;
22 template <
class T,
class ITYPE>
27 n =
static_cast<ITYPE
>(ceil(static_cast<float>(dim)/
RBDIM)) *
RBDIM;
30 cout <<
"Padded vector to size " << n <<
" for register blocking" << endl;
34 for(ITYPE i=0; i< n; ++i)
41 template <
class T,
class ITYPE>
48 for(ITYPE i=0; i< n; ++i)
53 template <
class T,
class ITYPE>
64 padding = rhs.padding;
68 for(ITYPE i=0; i< n; ++i)
76 template <
class T,
class ITYPE>
85 template <
class T,
class ITYPE>
88 if((n-padding == matmul.op1.rowsize()) && (matmul.op1.colsize() == matmul.op2.size()))
90 csc_gaxpy(matmul.op1, const_cast< T * >(matmul.op2.arr), arr);
94 cout<<
"Detected noncompliant matvec..." << endl;
99 template <
class T,
class ITYPE>
103 if((n-padding == matmul.op1.rowsize()) && (matmul.op1.colsize() == matmul.op2.size()))
105 bicsb_gespmv<PTDD>(matmul.op1, matmul.op2.arr, arr);
109 cout<<
"Detected noncompliant matvec..." << endl;
116 template <
class T,
class ITYPE>
119 #if (__GNUC__ == 4 && (__GNUC_MINOR__ < 7) )
121 for(ITYPE i=0; i< n; ++i)
126 std::uniform_real_distribution<T> distribution(0.0f, 1.0f);
128 auto generator = std::bind(distribution, engine);
129 std::generate_n(arr, n, generator);
134 template <
class T,
class ITYPE>
137 for(ITYPE i=0; i< n; ++i)
143 template <
typename NT,
typename IT>
147 std::transform(&control[0], (&control[0])+m, &test[0], error.begin(),
absdiff<NT>());
148 auto maxelement = std::max_element(error.begin(), error.end());
149 cout <<
"Max error is: " << *maxelement <<
" on y[" << maxelement-error.begin()<<
"]=" << test[maxelement-error.begin()] << endl;
150 NT machEps = machineEpsilon<NT>();
151 cout <<
"Absolute machine epsilon is: " << machEps <<
" and y[" << maxelement-error.begin() <<
"]*EPSILON becomes "
152 << machEps * test[maxelement-error.begin()] << endl;
154 NT sqrtm = sqrt(static_cast<NT>(m));
155 cout <<
"sqrt(n) * relative error is: " << abs(machEps * test[maxelement-error.begin()]) * sqrtm << endl;
156 if ( (abs(machEps * test[maxelement-error.begin()]) * sqrtm) < abs(*maxelement))
158 cout <<
"*** ATTENTION ***: error is more than sqrt(n) times the relative machine epsilon" << endl;
162 cout <<
"<index, control, test>: \n";
163 for(IT i=0; i<m; ++i)
165 if(error[i] > abs(sqrtm * machEps * test[i]))
167 cout << i <<
"\t" << control[i] <<
" " << test[i] <<
"\n";
Spvec< T, ITYPE > & operator=(const Spvec< T, ITYPE > &rhs)
void Verify(Spvec< NT, IT > &control, Spvec< NT, IT > &test, string name, IT m)
Spvec< T, ITYPE > & operator+=(const Matmul< Csc< T, ITYPE >, Spvec< T, ITYPE > > &matmul)
Delayed evaluations using compositors for SpMV operation... y <- y + Ax.
void csc_gaxpy(const Csc< T, ITYPE > &A, T *x, T *y)