/usr/include/givaro/givpoly1cstor.inl is in libgivaro-dev 3.2.13-1.2.
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 | // ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/library/poly1/givpoly1cstor.inl,v $
// Copyright(c)'94-97 by Givaro Team
// see the copyright file.
// Authors: T. Gautier
// $Id: givpoly1cstor.inl,v 1.6 2008-09-18 08:11:46 jgdumas Exp $
// ==========================================================================
template<class Domain>
inline Poly1Dom<Domain,Dense>::Poly1Dom(const Domain& d, const Indeter& X )
: _domain(d), _x(X) ,zero(0), one(1)
{
Type_t _one;
_domain.init( _one, 1.0);
_domain.assign( (Type_t&)one[0], _one);
}
template<class Domain>
inline Poly1Dom<Domain,Dense>::Poly1Dom(const Self_t& P)
: _domain(P._domain), _x(P._x) ,zero(P.zero), one(P.one)
{}
template<class Domain>
inline Poly1Dom<Domain,Dense>::~Poly1Dom()
{
}
template<class Domain>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init( Rep& P) const
{ P.reallocate(0); return P; }
/*
template<class Domain>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init( Rep& P, const Rep& Q ) const
{
Degree degQ;
degree(degQ,Q);
if (degQ <0) {
P.reallocate(0);
return P;
}
P.reallocate(++degQ);
for (int i=0; degQ>i; ++i)
_domain.init(P[i], Q[i]);
return P;
}
*/
template<class Domain>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::assign( Rep& P, const Rep& Q ) const
{
Degree degQ;
degree(degQ,Q);
if (degQ <0) {
P.reallocate(0);
return P;
}
P.reallocate(++degQ);
for (int i=0; degQ>i; ++i)
_domain.assign(P[i], Q[i]);
return P;
}
template<class Domain> template<class XXX>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init( Rep& P, const XXX& val ) const
{
P.reallocate(1);
_domain.init(P[0], val);
return P;
}
template<class Domain>
inline typename Poly1Dom<Domain,Dense>::Type_t& Poly1Dom<Domain,Dense>::convert(Poly1Dom<Domain,Dense>::Type_t & val, const Poly1Dom<Domain,Dense>::Rep& P ) const
{
if (P.size())
return _domain.assign(val, P[0]);
else
return _domain.init(val, 0UL);
}
template<class Domain> template<class XXX>
inline XXX& Poly1Dom<Domain,Dense>::convert( XXX& val, const Poly1Dom<Domain,Dense>::Rep& P ) const
{
if (P.size())
return _domain.convert(val, P[0]);
else
return _domain.convert(val, 0UL);
}
template<class Domain> template<class UU, template<class XX> class Vect>
inline Vect<UU>& Poly1Dom<Domain,Dense>::convert( Vect<UU>& val, const Poly1Dom<Domain,Dense>::Rep& P ) const
{
val.resize( P.size() );
typename Vect<UU>::iterator vit = val.begin();
typename Rep::const_iterator pit = P.begin();
for ( ; pit != P.end(); ++pit, ++vit)
_domain.convert(*vit, *pit);
return val;
}
template<class Domain>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init( Rep& P, const Degree deg ) const
{
P.reallocate(value(deg+1));
Type_t _one,_zero;
_domain.init( _one, 1.0);
_domain.init( _zero, 0.0);
size_t sz = P.size();
for (unsigned int i=0; i<sz-1; ++i)
_domain.assign(P[i], _zero);
_domain.assign(P[sz-1], _one);
return P;
}
template<class Domain> template<class XXX>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init
( Rep& P, const Degree d, const XXX& val ) const
{
Type_t _zero;
_domain.init( _zero, 0.0);
long deg = value(d);
Type_t lcoeff; _domain.init(lcoeff, val);
if (_domain.isZero(lcoeff)) {
P.reallocate(0);
} else {
P.reallocate(deg+1);
for (int i=0; i<deg; ++i)
_domain.assign(P[i], _zero);
_domain.assign(P[deg], lcoeff);
}
return P;
}
// template<class Domain>
// inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init
// ( Rep& P, const Degree d, const Type_t& lcoeff ) const
// {
// Type_t _zero;
// _domain.init( _zero, 0.0);
// long deg = value(d);
// if (_domain.isZero(lcoeff)) {
// P.reallocate(0);
// } else {
// P.reallocate(deg+1);
// for (int i=0; i<deg; ++i)
// _domain.assign(P[i], _zero);
// _domain.assign(P[deg], lcoeff);
// }
// return P;
// }
template<class Domain>
inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::assign
( Rep& P, const Degree d, const Type_t& lcoeff ) const
{
Type_t _zero;
_domain.init( _zero, 0.0);
long deg = value(d);
if (_domain.isZero(lcoeff)) {
P.reallocate(0);
} else {
P.reallocate(deg+1);
for (int i=0; i<deg; ++i)
_domain.assign(P[i], _zero);
_domain.assign(P[deg], lcoeff);
}
return P;
}
|