/usr/include/linbox/blackbox/zo.inl is in liblinbox-dev 1.3.2-1.1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | /* linbox/blackbox/nag-sparse.h
* Copyright (C) 2002 Rich Seagraves
*
* Written by Rich Seagraves <seagrave@cis.udel.edu>
* Modified by Zhendong Wan, -bds
* ------------------------------------
*
*
* ========LICENCE========
* This file is part of the library LinBox.
*
* LinBox is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*.
*/
namespace LinBox
{
/*
// for GF(3^10), apply to packvec will do adds with periodic normalizations
template<>
template<Field>
Packvec<typename Field::Accumulator>& ZeroOne<Field>::apply<Packvec<typename Field::Accumulator>, Packvec<typename Field::Accumulator> >
(Pacvec<typename Field::Accumulator>& y,
Pacvec<typename Field::Accumulator>& x)
{ return y; }
// more stuff for paley graphs
template<class OutVector, class InVector>
template<>
OutVector & ZeroOne<Special3_10Field>::apply(OutVector & y, const InVector & x) const
{
typedef Special3_10Field Field;
typedef typename Packvec<Field::Accumulator> Vector;
Vector xx, yy;
field().convert(xx, x);
apply(yy, xx);
field().convert(y, yy);
}
*/
template<class Field>
template<class OutVector, class InVector>
OutVector & ZeroOne<Field>::apply(OutVector & y, const InVector & x) const
//OutVector & ZeroOne<Field>::apply(OutVector & y, const InVector & x)
{
//std::cout << endl;
//std::cout << " new apply pass " << endl;
//std::cout << this->rowdim() << " " << this->coldim() << endl;
//std::cout << " inside apply " << endl;
//std::cout << x.size() << " " << y.size() << endl;
linbox_check((y.size()==rowdim())&&(x.size()==coldim()));
FieldAXPY<Field> accum (_field);
typename OutVector::iterator yp;
typename InVector::const_iterator xp;
PointerVector::const_iterator ip;
IndexVector::const_iterator jp;
//std::cout << " before sorting " << endl;
if( !sorted )
{
//std::cout << " -- apply: switch sort (" << _rowdim << ", " << _coldim << ", " << nnz() << ", " << sorted << " " << &(this->sorted) << ") -- " << std::endl;
switch_sort();
//std::cout << " -- apply: switch sort (" << _rowdim << ", " << _coldim << ", " << nnz() << ", " << sorted << ") -- " << std::endl;
}
//std::cout << " -- zo apply: " << this << "(" << _rowdim << ", " << _coldim << ", " << nnz() << ")" << std::endl;
xp=x.begin();
yp=y.begin();
accum.reset();
//std::cout << " before for loop " << endl;
//std::cout << _indexP.end() - _indexP.begin() << " ";
//std::cout << _index.end() - _index.begin() << endl;
//std::cout << " stupid test here " << (*_indexP.begin()) - _index.begin() << endl;
//cout << &_index << " of size ";
//cout << sizeof(_index) << " ";
//cout << &(*_index.begin()) << endl;
for(ip = _indexP.begin(); ip !=_indexP.end()-1; ++ip, ++yp)
//for(ip = _indexP.begin(); ip < _indexP.end()-2; ++ip, ++yp) // zigzag way
{
//std::cout << " inside the outer for loop " << ip - _indexP.begin() << endl;
for(jp = *ip; jp !=*(ip + 1); ++jp)
{
//std::cout << jp - _index.begin() << endl;
accum.accumulate_special( *(xp + *jp) );
}
//std::cout << " accumulate is done for one iteration " << endl;
//std::cout << " before accum.get " << yp - y.begin() << endl;
accum.get(*yp);
//std::cout << " before accum.reset " << endl;
accum.reset();
/* // zigzag way
++ip;++yp;
for(jp = *(ip + 1); jp >*ip; --jp)
accum.accumulate_special( *(xp + *(jp-1)) );
accum.get(*yp);
accum.reset();
*/
}
return y;
}
/* if you want to keep two copies for the matrix, one of which is sorted by row,
* the other by column, then you want to use this applyTranspose function. In
* this case, un-comment this one and comment out the applyTranspose further down
*/
/*
template<class Field>
template<class OutVector, class InVector>
OutVector & ZeroOne<Field>::applyTranspose(OutVector & y, const InVector & x) const
{
linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
FieldAXPY<Field> accum (_field);
typename OutVector::iterator yp;
typename InVector::const_iterator xp;
PointerVector::const_iterator ip;
IndexVector::const_iterator jp;
xp=x.begin();
yp=y.begin();
accum.reset();
for(ip = _colP.begin(); ip < _colP.end()-1; ++ip, ++yp)
{
for(jp = *ip; jp <*(ip + 1); ++jp)
accum.accumulate_special( *(xp + *jp) );
accum.get(*yp);
accum.reset();
}
return y;
}
*/
template<class Field>
template<class OutVector, class InVector>
OutVector & ZeroOne<Field>::applyTranspose(OutVector & y, const InVector & x) const
{
linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
FieldAXPY<Field> accum (_field);
typename OutVector::iterator yp;
typename InVector::const_iterator xp;
PointerVector::const_iterator ip;
IndexVector::const_iterator jp;
xp=x.begin();
yp=y.begin();
accum.reset();
if( sorted )
//{
//std::cout << " -- in apply transpose, before switch sort -- " << std::endl;
switch_sort();
//std::cout << " -- in apply transpose, after switch sort -- " << std::endl;
//}
for(ip = _indexP.begin(); ip < _indexP.end()-1; ++ip, ++yp)
{
for(jp = *ip; jp <*(ip + 1); ++jp)
accum.accumulate_special( *(xp + *jp) );
accum.get(*yp);
accum.reset();
}
return y;
}
}//End of LinBox
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,:0,t0,+0,=s
// Local Variables:
// mode: C++
// tab-width: 8
// indent-tabs-mode: nil
// c-basic-offset: 8
// End:
|