11 template <
class T,
class ITYPE>
14 template <
class T,
class ITYPE>
18 Csc ():nz(0), m(0), n(0), logicalnz(0), issym(false) {}
19 Csc (ITYPE size,ITYPE rows, ITYPE cols,
bool isSym=
false);
24 Csc (ITYPE * ri, ITYPE * ci, T * val, ITYPE size, ITYPE rows, ITYPE cols,
bool isSym=
false);
27 void SetPointers (ITYPE * colpointers, ITYPE * rowindices, T * vals, ITYPE size, ITYPE rows, ITYPE cols,
bool fortran)
40 transform(jc, jc+n+1, jc, bind2nd(minus<ITYPE>(),1));
41 transform(ir, ir+nz, ir, bind2nd(minus<ITYPE>(),1));
47 ITYPE *
getjc()
const {
return jc;}
48 ITYPE *
getir()
const {
return ir;}
56 void Resize(ITYPE nsize);
68 template <
class U,
class UTYPE>
70 template <
class U,
class UTYPE>
72 template <
class U,
class UTYPE,
unsigned UDIM>
74 template <
class U,
class UTYPE,
unsigned UDIM>
77 template <
typename U,
typename UTYPE>
80 template <
typename U,
typename UTYPE>
83 template <
int D,
typename NT,
typename IT>
86 template <
int D,
typename NT,
typename IT>
91 template <
typename T,
typename ITYPE>
96 for (ITYPE j = 0 ; j < A.n ; ++j)
98 for (ITYPE k = A.jc [j] ; k < A.jc [j+1] ; ++k)
100 y [ A.ir[k] ] += A.num[k] * x [j] ;
102 y [ j ] += A.num[k] * x[ A.ir[k] ] ;
108 for (ITYPE j = 0 ; j < A.n ; ++j)
110 for (ITYPE k = A.jc [j] ; k < A.jc [j+1] ; ++k)
112 y [ A.ir[k] ] += A.num[k] * x [j] ;
120 template <
typename T,
typename ITYPE>
125 cout <<
"Trying to run A'x on a symmetric matrix doesn't make sense" << endl;
126 cout <<
"Are you sure you're using the right data structure?" << endl;
130 for (ITYPE j = 0; j< A.n; ++j)
132 for(ITYPE k= A.jc[j]; k < A.jc[j+1]; ++k)
134 y[j] += A.num[k] * x [ A.ir[k] ];
141 template <
int D,
typename NT,
typename IT>
146 cout <<
"Symmetric csc_gaxpy_mm not implemented yet" << endl;
150 for (IT j = 0 ; j < A.n ; ++j)
152 for (IT k = A.jc[j] ; k < A.jc[j+1] ; ++k)
154 for(
int i=0; i<D; ++i)
156 y[A.ir[k]][i] += A.num[k] * x[j][i];
165 template <
int D,
typename NT,
typename IT>
170 cout <<
"Trying to run A'x on a symmetric matrix doesn't make sense" << endl;
171 cout <<
"Are you sure you're using the right data structure?" << endl;
175 for (IT j = 0; j< A.n; ++j)
177 for(IT k= A.jc[j]; k < A.jc[j+1]; ++k)
179 for(
int i=0; i<D; ++i)
181 y[j][i] += A.num[k] * x[A.ir[k]][i];
void csc_gaxpy_mm(const Csc< NT, IT > &A, array< NT, D > *x, array< NT, D > *y)
void csc_gaxpy_mm_trans(const Csc< NT, IT > &A, array< NT, D > *x, array< NT, D > *y)
ITYPE getlogicalnnz() const
void csc_gaxpy(const Csc< T, ITYPE > &A, T *x, T *y)
void SetPointers(ITYPE *colpointers, ITYPE *rowindices, T *vals, ITYPE size, ITYPE rows, ITYPE cols, bool fortran)
void csc_gaxpy_trans(const Csc< T, ITYPE > &A, T *x, T *y)