/usr/include/linbox/ring/envelope.h is in liblinbox-dev 1.3.2-1.1+b1.
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 | /* linbox/ring/envelope.h
* Copyright(C) LinBox
* Written by J-G Dumas <Jean-Guillaume.Dumas@imag.fr>,
* Clement Pernet <Clement.Pernet@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========
*
* ------------------------------------
*/
#ifndef __LINBOX_ring_envelope_H
#define __LINBOX_ring_envelope_H
#include <iostream>
#include "linbox/integer.h"
#include "linbox/element/envelope.h"
#include "linbox/ring/abstract.h"
#include "linbox/element/abstract.h"
#include "linbox/randiter/abstract.h"
#include "linbox/randiter/envelope.h"
#include "linbox/linbox-config.h"
#ifdef __LINBOX_XMLENABLED
#include "linbox/util/xml/linbox-reader.h"
#include "linbox/util/xml/linbox-writer.h"
#endif
// Namespace in which all LinBox code resides
namespace LinBox
{
// Forward declarations
template <class Ring> class RandIterEnvelope;
/**
* \brief implement the ring archetype to minimize code bloat.
\ingroup ring
This class implements all purely virtual member functions
* of the abstract base class. This class is used to wrap a
* \ref LinBox
* ring so that it might be used with the Ring archetype.
*/
template <class Ring>
class RingEnvelope : public virtual RingAbstract, public virtual FieldEnvelope<Ring>
{
public:
/** element type.
* It is derived from the class ElementAbstract, and it must contain
* a wrapped ring element.
*/
/* typedef ElementEnvelope<Ring> Element; */
typedef typename FieldEnvelope<Ring>::Element Element;
/** Random iterator generator type.
* It is derived from the class RandIterAbstract, and it must contain
* a wrapped ring random iterator generator.
*/
/* typedef RandIterEnvelope<Ring> RandIter; */
typedef typename FieldEnvelope<Ring>::RandIter RandIter;
/** @name Object Management
*/
//@{
/** Default constructor.
* In this implementation, this means copying the ring \c E._field.
*/
RingEnvelope (void) {}
/** Constructor from ring to be wrapped.
* @param F Ring object to be wrapped.
*/
RingEnvelope (const Ring& F) :
FieldEnvelope<Ring> (F)
{}
/** Copy constructor.
* Constructs RingEnvelope object by copying the ring.
* This is required to allow ring objects to be passed by value
* into functions.
* In this implementation, this means copying the ring \c E._field.
* @param E RingEnvelope object.
*/
RingEnvelope (const RingEnvelope& E) :
FieldEnvelope<Ring> (E._field)
{}
#ifdef __LINBOX_XMLENABLED
RingEnvelope(Reader &R) :
FieldEnvelope<Ring>(R)
{}
#endif
/** Virtual copy constructor.
* Required because constructors cannot be virtual.
* Passes construction on to derived classes.
* This function is not part of the common object interface.
* @return pointer to new object in dynamic memory.
*/
#if 0
RingAbstract* clone () const
{ return new RingEnvelope (*this); }
#endif
FieldAbstract* clone () const
{ return static_cast<RingAbstract*>( new RingEnvelope (*this)); }
/** Assignment operator.
* Required by abstract base class.
* @return reference to RingAbstract object for self
* @param F constant reference to RingAbstract object
*/
RingAbstract& operator= (const RingAbstract& F)
{
if (this != &F) // guard against self-assignment
_field = static_cast<const RingEnvelope&> (F)._field;
return *this;
}
/** Assignment operator.
* Required by abstract base class.
* @return reference to RingAbstract object for self
* @param F constant reference to RingAbstract object
*/
FieldAbstract& operator= (const FieldAbstract& F)
{
if (static_cast<RingAbstract*>(this) != &F) // guard against self-assignment
_field = reinterpret_cast<const RingEnvelope&> (F)._field;
return * static_cast<RingAbstract*>(this);
}
ElementAbstract& init (ElementAbstract& x, const integer& y = 0) const{
return FieldEnvelope<Ring>::init( x,y);
}
integer& convert (integer& x, const ElementAbstract& y) const{
return FieldEnvelope<Ring>::convert( x,y);
}
ElementAbstract& assign (ElementAbstract& x, const ElementAbstract& y) const{
return FieldEnvelope<Ring>::assign(x,y);
}
ElementAbstract& neg (ElementAbstract& x, const ElementAbstract& y) const{
return FieldEnvelope<Ring>::neg(x,y);
}
ElementAbstract& inv (ElementAbstract& x, const ElementAbstract& y) const{
return FieldEnvelope<Ring>::inv(x,y);
}
ElementAbstract& negin (ElementAbstract& x) const{
return FieldEnvelope<Ring>::negin(x);
}
ElementAbstract& invin (ElementAbstract& x) const{
return FieldEnvelope<Ring>::invin(x);
}
integer& cardinality (integer& c) const{
return FieldEnvelope<Ring>::cardinality(c);
}
integer& characteristic (integer& c) const{
return FieldEnvelope<Ring>::characteristic(c);
}
bool areEqual (const ElementAbstract& x, const ElementAbstract& y) const{
return FieldEnvelope<Ring>::areEqual(x,y);
}
ElementAbstract& add (ElementAbstract& x,
const ElementAbstract& y,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::add(x,y,z);
}
ElementAbstract& sub (ElementAbstract& x,
const ElementAbstract& y,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::sub(x,y,z);
}
ElementAbstract& mul (ElementAbstract& x,
const ElementAbstract& y,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::mul(x,y,z);
}
ElementAbstract& div (ElementAbstract& x,
const ElementAbstract& y,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::div(x,y,z);
}
ElementAbstract& axpy (ElementAbstract& r,
const ElementAbstract& a,
const ElementAbstract& x,
const ElementAbstract& y) const
{
return FieldEnvelope<Ring>::axpy(r,a,x,y);
}
ElementAbstract& addin (ElementAbstract& x,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::addin(x,z);
}
ElementAbstract& subin (ElementAbstract& x,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::subin(x,z);
}
ElementAbstract& mulin (ElementAbstract& x,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::mulin(x,z);
}
ElementAbstract& divin (ElementAbstract& x,
const ElementAbstract& z) const{
return FieldEnvelope<Ring>::divin(x,z);
}
ElementAbstract& axpyin(ElementAbstract& r,
const ElementAbstract& x,
const ElementAbstract& y) const
{
return FieldEnvelope<Ring>::axpyin(r,x,y);
}
bool isZero (const ElementAbstract& x) const{
return FieldEnvelope<Ring>::isZero(x);
}
bool isOne (const ElementAbstract& x) const{
return FieldEnvelope<Ring>::isOne(x);
}
/** Invertibility test.
* Test if ring element is invertible.
* This function assumes the ring element has already been
* constructed and initialized.
*
* @return boolean true if equals zero, false if not.
* @param x ring element.
*/
bool isUnit (const ElementAbstract& x) const
{ return _field.isUnit (static_cast<const ElementEnvelope<Ring>&> (x)._elem); }
/** Divisibility of zero test.
* Test if ring element is a zero divisor.
* This function assumes the ring element has already been
* constructed and initialized.
*
* @return boolean true if divides zero, false if not.
* @param x ring element.
*/
bool isZeroDivisor (const ElementAbstract& x) const
{ return _field.isZeroDivisor (static_cast<const ElementEnvelope<Ring>&> (x)._elem); }
std::ostream& write (std::ostream& os) const
{ return FieldEnvelope<Ring>::write (os); }
std::istream& read (std::istream& is) { return FieldEnvelope<Ring>::read (is); }
std::ostream& write (std::ostream& os, const ElementAbstract& x) const
{ return FieldEnvelope<Ring>::write (os, x); }
std::istream& read (std::istream& is, ElementAbstract& x) const
{ return FieldEnvelope<Ring>::read (is, x); }
private:
friend class RandIterEnvelope<Ring>;
}; // class RingEnvelope
} // namespace LinBox
#include "linbox/randiter/envelope.h"
#endif // __LINBOX_ring_envelope_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:
|