/* Copyright (C) 2007 LinBox * Written by JG Dumas * * * ========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======== */ /*! @file algorithms/cra-builder-early-multip.h * @ingroup algorithms * @brief NO DOC */ #ifndef __LINBOX_cra_early_multip_H #define __LINBOX_cra_early_multip_H #include "linbox/util/timer.h" #include #include "linbox/integer.h" #include "linbox/solutions/methods.h" #include #include #include "linbox/algorithms/cra-builder-single.h" #include "linbox/algorithms/cra-builder-full-multip.h" namespace LinBox { /*! @brief NO DOC * @ingroup CRA * */ template struct CRABuilderEarlyMultip : public CRABuilderEarlySingle, public CRABuilderFullMultip { typedef Domain_Type Domain; typedef typename Domain::Element DomainElement; typedef CRABuilderEarlyMultip Self_t; protected: // Random coefficients for a linear combination // of the elements to be reconstructed std::vector< size_t > randv; Integer& result(Integer &d) { std::cout << "should not be called" << std::endl; return d ;} ; // DON'T TOUCH public: CRABuilderEarlyMultip(const size_t EARLY=LINBOX_DEFAULT_EARLY_TERMINATION_THRESHOLD) : CRABuilderEarlySingle(EARLY), CRABuilderFullMultip() {} Integer& getModulus(Integer& m) { CRABuilderEarlySingle::getModulus(m); return m; } Integer& getResidue(Integer& m) { CRABuilderEarlySingle::getResidue(m); return m; } template class Vect> Vect& getResidue(Vect& m) { CRABuilderFullMultip::getResidue(m); return m; } //! Init template class Vect> void initialize (const Integer& D, const Vect& e) { srand48(BaseTimer::seed()); randv. resize ( e.size() ); for ( std::vector::iterator int_p = randv. begin(); int_p != randv. end(); ++ int_p) *int_p = ((size_t)lrand48()) % 20000; Integer z; dot(z, D, e, randv); CRABuilderEarlySingle::initialize(D, z); CRABuilderFullMultip::initialize(D, e); } template // template