6 template <
class IT,
class NT,
class DER>
9 if( (!ci.empty()) && (ci.back() > getncol()))
11 cerr <<
"Col indices out of bounds" << endl;
14 if( (!ri.empty()) && (ri.back() > getnrow()))
16 cerr <<
"Row indices out of bounds" << endl;
20 return ((static_cast<DER>(*
this)) (ri, ci));
23 template <
class IT,
class NT,
class DER>
26 return ((static_cast<DER &>(*
this)) == (static_cast<DER &>(rhs)) );
29 template <
class IT,
class NT,
class DER>
32 static_cast< DER*
>(
this)->Split(static_cast< DER & >(partA),
static_cast< DER &
>(partB));
35 template <
class IT,
class NT,
class DER>
38 static_cast< DER*
>(
this)->Merge(static_cast< DER & >(partA),
static_cast< DER &
>(partB));
42 template <
class IT,
class NT,
class DER>
43 template <
typename SR>
47 IT A_m, A_n, B_m, B_n;
70 if(getnrow() == A_m && getncol() == B_n)
76 static_cast< DER*
>(
this)->
template PlusEq_AtXBt< SR >(static_cast< DER & >(A),
static_cast< DER &
>(B));
78 else if(isAT && (!isBT))
80 static_cast< DER*
>(
this)->
template PlusEq_AtXBn< SR >(static_cast< DER & >(A),
static_cast< DER &
>(B));
82 else if((!isAT) && isBT)
84 static_cast< DER*
>(
this)->
template PlusEq_AnXBt< SR >(static_cast< DER & >(A),
static_cast< DER &
>(B));
88 static_cast< DER*
>(
this)->
template PlusEq_AnXBn< SR >(static_cast< DER & >(A),
static_cast< DER &
>(B));
93 cerr <<
"Not multipliable: " << A_n <<
"!=" << B_m << endl;
98 cerr<<
"Not addable: "<< getnrow() <<
"!=" << A_m <<
" or " << getncol() <<
"!=" << B_n << endl;
103 template<
typename SR,
typename NUO,
typename IU,
typename NU1,
typename NU2,
typename DER1,
typename DER2>
107 bool isAT,
bool isBT,
108 bool clearA =
false,
bool clearB =
false)
111 IU A_m, A_n, B_m, B_n;
138 return Tuples_AtXBt<SR, NUO>(
static_cast< const DER1 &
>(A), static_cast< const DER2 & >(B), clearA, clearB);
140 else if(isAT && (!isBT))
142 return Tuples_AtXBn<SR, NUO>(
static_cast< const DER1 &
>(A), static_cast< const DER2 & >(B), clearA, clearB);
144 else if((!isAT) && isBT)
146 return Tuples_AnXBt<SR, NUO>(
static_cast< const DER1 &
>(A), static_cast< const DER2 & >(B), clearA, clearB);
150 return Tuples_AnXBn<SR, NUO>(
static_cast< const DER1 &
>(A), static_cast< const DER2 & >(B), clearA, clearB);
155 cerr <<
"Not multipliable: " << A_n <<
"!=" << B_m << endl;
160 template <
class IT,
class NT,
class DER>
163 return static_cast<const DER*
>(
this)->put(outfile);
166 template <
class IT,
class NT,
class DER>
169 cout <<
"Getting... SpMat" << endl;
170 return static_cast<DER*
>(
this)->
get(infile);
174 template <
typename UIT,
typename UNT,
typename UDER >
175 ofstream& operator<<(ofstream& outfile, const SpMat< UIT,UNT,UDER > & s)
177 return s.
put(outfile);
180 template <
typename UIT,
typename UNT,
typename UDER >
183 return s.
get(infile);