/usr/include/givaro/givpoly1cstor.inl is in libgivaro-dev 3.7.2-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 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 | // ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/library/poly1/givpoly1cstor.inl,v $
// Copyright(c)'1994-2009 by The Givaro group
// This file is part of Givaro.
// Givaro is governed by the CeCILL-B license under French law
// and abiding by the rules of distribution of free software.
// see the COPYRIGHT file for more details.
// Authors: T. Gautier
// $Id: givpoly1cstor.inl,v 1.15 2011-02-02 16:23:56 bboyer Exp $
// ==========================================================================
#ifndef __GIVARO_poly1_cstor_INL
#define __GIVARO_poly1_cstor_INL
namespace Givaro {
template<class Domain>
inline Poly1Dom<Domain,Dense>::Poly1Dom(const Domain& d, const Indeter& X ) :
_domain(d), _x(X)
, zero(1,d.zero), one(1,d.one)
, mOne(1,d.mOne)
{}
template<class Domain>
inline Poly1Dom<Domain,Dense>::Poly1Dom(const Self_t& P) :
_domain(P._domain), _x(P._x)
,zero(P.zero), one(P.one),mOne(P.mOne)
{}
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((size_t)++degQ);
// degQ >=0
for (size_t i=0; (size_t)degQ.value()>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(typename Poly1Dom<Domain,Dense>::Type_t & Val, const typename 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 typename 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 typename 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((size_t)value(deg+1));
size_t sz = P.size();
for (unsigned int i=0; i<sz-1; ++i)
_domain.assign(P[i], _domain.zero);
_domain.assign(P[sz-1], _domain.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
{
long deg = value(d);
P.reallocate((size_t)deg+1);
assert (deg>=0);
for (size_t i=0; i<(size_t)deg; ++i)
_domain.assign(P[i], _domain.zero);
_domain.init(P[(size_t)deg], Val);
if (_domain.isZero(P[(size_t)deg])) {
P.reallocate(0);
}
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
{
long deg = value(d);
if (_domain.isZero(lcoeff)) {
P.reallocate(0);
}
else {
P.reallocate((size_t)deg+1);
assert (deg>=0);
for (size_t i=0; i<(size_t)deg; ++i)
_domain.assign(P[i], _domain.zero);
_domain.assign(P[(size_t)deg], lcoeff);
}
return P;
}
} // Givaro
#endif // __GIVARO_poly1_cstor_INL
/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
|