#include "seqfos.hh" using namespace RVL; void AssignList::operator()(SeqDC & x) { std::list::iterator ix = x.get().begin(); std::list::const_iterator ii = inlist.begin(); while (ix != x.get().end() && ii != inlist.end()) { *ix = *ii; ix++;ii++; } // if input list is shorter than target, pad with zeroes while ( ix != x.get().end() ) { *ix=0; ix++; } // if input list is longer than target, add remaining // values and lengthen target while( ii != inlist.end() ) { x.get().push_back(*ii); ii++; } } void ZeroList::operator()(SeqDC & x) { std::list::iterator ix = x.get().begin(); while (ix != x.get().end()) { *ix = 0.0; ix++; } } void RandList::operator()(SeqDC & x) { std::list::iterator ix = x.get().begin(); int i = 0; while (ix != x.get().end()) { *ix = -0.5+ rand()/(RAND_MAX+1.0); ix++;i++; } while (i::iterator iy = y.get().begin(); std::list::const_iterator ix = x.get().begin(); while ((ix != x.get().end()) && (iy != y.get().end())) { *iy = a*(*ix) + b*(*iy); ix++; iy++; } // if x summand is longer, treat y as zip after end index of x while (ix != x.get().end()) { y.get().push_back(a*(*ix)); ix++; } } void InnerProdList::operator()(SeqDC const & x, SeqDC const & y) { std::list::const_iterator ix = x.get().begin(); std::list::const_iterator iy = y.get().begin(); double val = 0.0; while ((ix != x.get().end()) && (iy != y.get().end())) { val += (*ix)*(*iy); ix++; iy++; } this->setValue(val); } void PolyMult::operator()(SeqDC & y, SeqDC const & x) { // cerr<<"zero output\n"; ZeroList zip; zip(y); // y.write(cerr); // cerr<<"workspace - initialize to x"<::iterator iy = y.get().begin(); // std::list::const_iterator ix = x.get().begin(); std::list::const_iterator ifac = fac.get().begin(); while (ifac != fac.get().end()) { // cerr<<"degree "<::iterator iy = y.get().begin(); // std::list::const_iterator ix = x.get().begin(); std::list::const_iterator ifac = fac.get().begin(); // cerr<<"loop\n"; while (ifac != fac.get().end()) { // cerr<<"degree "<