/usr/include/linbox/field/Givaro/givaro-extension.h is in liblinbox-dev 1.3.2-1.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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | /* linbox/field/givaro-gfq.h
* Copyright (C) 2005 JGD
*
* Time-stamp: <22 Jun 10 10:02:34 Jean-Guillaume.Dumas@imag.fr>
* ------------------------------------
*
*
* ========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 field/Givaro/givaro-extension.h
* @ingroup field
* @brief NO DOC
*/
#ifndef __LINBOX_field_givaro_extension_H
#define __LINBOX_field_givaro_extension_H
#include "linbox/linbox-config.h"
#include "linbox/integer.h"
#include "linbox/field/field-traits.h"
#include "linbox/field/field-interface.h"
#include "linbox/util/debug.h"
#include "linbox/field/field-traits.h"
#include "linbox/field/Givaro/givaro-gfq.h"
#ifdef __LINBOX_XMLENABLED
#include "linbox/util/xml/linbox-reader.h"
#include "linbox/util/xml/linbox-writer.h"
#include <iostream>
#include <string>
#include <vector>
#endif //__LINBOX_XMLENABLED
//---------------------------------------------
// Files of Givaro library
#include <givaro/givextension.h>
#include <givaro/giv_randiter.h>
//---------------------------------------------
// To convert linbox fields to Givaro interface
#include "linbox/field/Givaro/givaro-field.h"
//---------------------------------------------
// Namespace in which all LinBox code resides
namespace LinBox
{
template <class Ring>
struct ClassifyRing;
template< class BaseField>
class GivaroExtension;
// #if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) && !defined(__clang__)
// template<>
// #endif
template< class BaseField>
struct ClassifyRing<GivaroExtension<BaseField> > {
typedef RingCategories::ModularTag categoryTag;
};
// #if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) && !defined(__clang__)
// template<>
// #endif
template< class BaseField>
struct FieldTraits< GivaroExtension<BaseField> > {
typedef RingCategories::ModularTag categoryTag;
static integer& maxModulus( integer& i )
{
return FieldTraits<BaseField>::maxModulus(i);
}
static bool goodModulus( const integer& i )
{
return FieldTraits<BaseField>::goodModulus(i);
}
// After that degree might not be correct ...
static integer& maxExponent( integer& i )
{
return i = 2147483648UL;
}
static bool goodExponent( const integer& i )
{
integer max;
return ( i >= 1 && i <= maxExponent( max ) );
}
};
/** This template class is defined to be in phase with the LinBox
* archetype.
* Most of all methods are inherited from Extension class
* of Givaro.
* These class allow to construct only extension field with a prime characteristic.
*/
template< class BaseField = LinBox::GivaroGfq>
class GivaroExtension : public Givaro::Extension<GivaroField<BaseField> >, public FieldInterface {
typedef GivaroExtension<GivaroField<BaseField> > Self_t;
typedef Givaro::Extension<GivaroField<BaseField> > Extension_t;
public:
/** Element type.
* This type is inherited from the Givaro class Extension
*/
typedef typename Givaro::Extension<GivaroField<BaseField> >::Element Element;
typedef Givaro:: Extension<GivaroField<BaseField> > Father_t;
using Extension_t::zero;
using Extension_t::one;
using Extension_t::mOne;
/** RandIter type.
* This type is inherited from the Givaro class GFqDom<TAG>
*/
typedef Givaro::GIV_ExtensionrandIter< Givaro::Extension<GivaroField<BaseField> >, LinBox::integer > RandIter;
GivaroExtension()
{}
/** Constructor from an integer.
*/
GivaroExtension(const integer& p, const integer& k=1) :
Givaro::Extension<GivaroField<BaseField> >(static_cast<typename Givaro::Extension< GivaroField< BaseField > >::Residu_t >(int32_t(p)), static_cast<typename Givaro::Extension< GivaroField< BaseField > >::Residu_t>(int32_t(k)))
{
}
/** Constructor extension of a base field.
*/
GivaroExtension(const BaseField& bF, const integer& ext=1) :
Givaro::Extension<GivaroField<BaseField> >( GivaroField<BaseField>(bF),
static_cast<typename Givaro::Extension< GivaroField< BaseField > >::Residu_t>(int32_t(ext)))
{
}
/** Copy Constructor
*/
GivaroExtension(const Self_t& F) :
Givaro::Extension<GivaroField<BaseField> >(F) {
}
using Givaro::Extension<GivaroField<BaseField> >:: characteristic ;
#if (GIVARO_VERSION<30403)
long unsigned int & characteristic(long unsigned int & c) const
{
return c = (long unsigned)Givaro::Extension<GivaroField<BaseField> >::characteristic() ;
}
#else
long unsigned int & characteristic(long unsigned int & c) const
{
return Givaro::Extension<GivaroField<BaseField> >::characteristic(c) ;
}
#endif
}; // class GivaroExtension
/** This template class is define just to be in phase with the LinBox
* archetype.
* Most of all methods are inherited from Extension class
* of Givaro.
* these class allow to construct only extension field with a prime characteristic.
*/
// #ifndef __INTEL_COMPILER
template<>
// #endif
class GivaroExtension<LinBox::GivaroGfq> : public Givaro::Extension< Givaro::GFqDom<int32_t> >, public FieldInterface {
typedef GivaroExtension<GivaroGfq> Self_t;
typedef Givaro::Extension< Givaro::GFqDom<int32_t> > Extension_t;
public:
/** Element type.
* This type is inherited from the Givaro class Extension
*/
typedef Givaro::Extension< Givaro::GFqDom<int32_t> >::Element Element;
typedef Givaro::Extension< Givaro::GFqDom<int32_t> > Father_t;
using Extension_t::zero;
using Extension_t::one;
using Extension_t::mOne;
/** RandIter type.
* This type is inherited from the Givaro class GFqDom<TAG>
*/
typedef Givaro::GIV_ExtensionrandIter< Givaro::Extension< Givaro::GFqDom<int32_t> >, LinBox::integer > RandIter;
/** Constructor from an integer.
*/
GivaroExtension(const integer& p, const integer& k=1) :
Givaro::Extension< Givaro::GFqDom<int32_t> >(static_cast< Givaro::Extension< Givaro::GFqDom<int32_t> >::Residu_t>(int32_t(p)),
static_cast< Givaro::Extension< Givaro::GFqDom<int32_t> >::Residu_t>(int32_t(k)))
{
}
/** Constructor extension of a base field.
*/
GivaroExtension(const GivaroGfq& bF, const integer& ext=1) :
Givaro::Extension< Givaro::GFqDom<int32_t> >( static_cast< const Givaro::Extension< Givaro::GFqDom< int32_t > >::BaseField_t &>(bF),
static_cast< Givaro::Extension< Givaro::GFqDom<int32_t> >::Residu_t >(int32_t(ext)))
{
}
/** Copy Constructor.
*/
GivaroExtension(const Self_t& F) :
Givaro::Extension< Givaro::GFqDom<int32_t> >(F)
{ }
}; // class GivaroExtension
} // namespace LinBox
// Specialization of homomorphism for basefield
#include "linbox/field/hom.h"
namespace LinBox
{
/// NO DOC
template< class BaseField>
class Hom < BaseField, GivaroExtension<BaseField> > {
typedef BaseField Source;
typedef GivaroExtension<BaseField> Target;
public:
typedef typename Source::Element SrcElt;
typedef typename Target::Element Elt;
//Hom(){}
/** Constructor.
* Construct a homomorphism from a specific source ring S and target
* field T with Hom(S, T). The default behaviour is error.
* Specializations define all actual homomorphisms.
*/
Hom(const Source& S, const Target& T) :
_source(S), _target(T)
{}
/** Image.
* image(t, s) implements the homomorphism, assigning the
* t the value of the image of s under the mapping.
*
* The default behaviour is a no-op.
*/
Elt& image(Elt& t, const SrcElt& s) const
{
return _target.assign(t, s);
}
/** Preimage.
* If possible, preimage(s,t) assigns a value to s such that
* the image of s is t. Otherwise behaviour is unspecified.
* An error may be thrown, a conventional value may be set, or
* an arb value set.
*
* The default behaviour is a no-op.
*/
SrcElt& preimage(SrcElt& s, const Elt& t) const
{
// return _target.getEntry(s, Degree(0), t);
return _target.convert(s, t);
}
const Source& source() const
{
return _source;
}
const Target& target() const
{
return _target;
}
private:
Source _source;
Target _target;
}; // end Hom
}
#endif // __LINBOX_field_givaro_extension_H
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,:0,t0,+0,=s
// Local Variables:
// mode: C++
// tab-width: 8
// indent-tabs-mode: nil
// c-basic-offset: 8
// End:
|