/usr/include/linbox/algorithms/rational-cra-full-multip.h is in liblinbox-dev 1.1.6~rc0-4.1.
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 | /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
// ======================================================================= //
// Time-stamp: <12 Mar 07 18:42:58 Jean-Guillaume.Dumas@imag.fr>
// ======================================================================= //
#ifndef __LINBOX_RATIONAL_FULL_MULTIP_CRA_H
#define __LINBOX_RATIONAL_FULL_MULTIP_CRA_H
#include "linbox/field/PID-integer.h"
#include "linbox/algorithms/cra-full-multip.h"
namespace LinBox {
// template<class T, template <class T> class Container>
// std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
// for(typename Container<T>::const_iterator refs = C.begin();
// refs != C.end() ;
// ++refs )
// o << (*refs) << " " ;
// return o << std::endl;
// }
template<class Domain_Type>
struct FullMultipRatCRA : public virtual FullMultipCRA<Domain_Type> {
typedef Domain_Type Domain;
typedef FullMultipCRA<Domain> Father_t;
typedef typename Father_t::DomainElement DomainElement;
typedef FullMultipRatCRA<Domain> Self_t;
PID_integer _ZZ;
public:
using Father_t::RadixSizes_;
using Father_t::RadixResidues_;
using Father_t::RadixPrimeProd_;
using Father_t::RadixOccupancy_;
FullMultipRatCRA(const double BOUND = 0.0) : Father_t(BOUND) {}
template<template<class, class> class Vect, template <class> class Alloc>
Vect<Integer, Alloc<Integer> >& result (Vect<Integer, Alloc<Integer> > &num, Integer& den){
num.resize( (Father_t::RadixResidues_.front()).size() );
std::vector< LazyProduct >::iterator _mod_it = Father_t::RadixPrimeProd_.begin();
std::vector< std::vector< Integer > >::iterator _tab_it = Father_t::RadixResidues_.begin();
std::vector< bool >::iterator _occ_it = Father_t::RadixOccupancy_.begin();
LazyProduct Product;
for( ; _occ_it != Father_t::RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
if (*_occ_it) {
Product = *_mod_it;
std::vector<Integer>::iterator t0_it = num.begin();
std::vector<Integer>::iterator t_it = _tab_it->begin();
if (++_occ_it == Father_t::RadixOccupancy_.end()) {
den = 1;
Integer s, nd; _ZZ.sqrt(s, _mod_it->operator()());
for( ; t0_it != num.end(); ++t0_it, ++t_it) {
iterativeratrecon(*t0_it = *t_it, nd, den, _mod_it->operator()(), s);
if (nd > 1) {
std::vector<Integer>::iterator t02 = num.begin();
for( ; t02 != t0_it ; ++t02)
*t02 *= nd;
den *= nd;
}
}
return num;
} else {
for( ; t0_it != num.end(); ++t0_it, ++t_it)
*t0_it = *t_it;
++_mod_it; ++_tab_it;
break;
}
}
}
for( ; _occ_it != Father_t::RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
if (*_occ_it) {
std::vector<Integer>::iterator t0_it = num.begin();
std::vector<Integer>::const_iterator t_it = _tab_it->begin();
for( ; t0_it != num.end(); ++t0_it, ++t_it)
this->normalizesmallbigreconstruct(*t0_it, Product(), *t_it, _mod_it->operator()() );
Product.mulin(*_mod_it);
}
}
den = 1;
Integer s, nd; _ZZ.sqrt(s, Product.operator()());
std::vector<Integer>::iterator t0_it = num.begin();
for( ; t0_it != num.end(); ++t0_it) {
iterativeratrecon(*t0_it, nd, den, Product.operator()(), s);
if (nd > 1) {
std::vector<Integer>::iterator t02 = num.begin();
for( ; t02 != t0_it ; ++t02)
*t02 *= nd;
den *= nd;
}
}
return num;
}
protected:
Integer& iterativeratrecon(Integer& u1, Integer& new_den, const Integer& old_den, const Integer& m1, const Integer& s) {
Integer a;
_ZZ.reconstructRational(a, new_den, u1*=old_den, m1, s);
return u1=a;
}
};
}
#endif
|