/usr/include/givaro/ring-interface.h is in libgivaro-dev 4.0.2-8ubuntu1.
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 | // ==========================================================================
// Copyright(c)'1994-2014 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: A. Breust
// ==========================================================================
#ifndef __GIVARO_ring_interface_H
#define __GIVARO_ring_interface_H
namespace Givaro
{
/* All Givaro rings should follow this interface.
* For instance Modular<> or Montgomery<>.
*/
template<class _Element>
struct RingInterface
{
// virtual ~RingInterface() = default;
// ----- Typedefs
typedef _Element Element;
typedef Element* Element_ptr ;
typedef const Element ConstElement;
typedef const Element* ConstElement_ptr;
// ----- Checkers
virtual bool isZero(const Element& a) const = 0;
virtual bool isOne (const Element& a) const = 0;
virtual bool isMOne(const Element& a) const = 0;
virtual bool areEqual(const Element& a, const Element& b) const = 0;
// ----- Classic arithmetic
virtual Element& mul(Element& r, const Element& a, const Element& b) const = 0;
virtual Element& add(Element& r, const Element& a, const Element& b) const = 0;
virtual Element& sub(Element& r, const Element& a, const Element& b) const = 0;
virtual Element& neg(Element& r, const Element& a) const = 0;
virtual Element& mulin(Element& r, const Element& a) const = 0;
virtual Element& addin(Element& r, const Element& a) const = 0;
virtual Element& subin(Element& r, const Element& a) const = 0;
virtual Element& negin(Element& r) const = 0;
// -- axpy: r <- a * x + y
// -- axpyin: r <- a * x + r
virtual Element& axpy (Element& r, const Element& a, const Element& x, const Element& y) const = 0;
virtual Element& axpyin(Element& r, const Element& a, const Element& x) const = 0;
// -- axmy: r <- a * x - y
// -- axmyin: r <- a * x - r
virtual Element& axmy (Element& r, const Element& a, const Element& x, const Element& y) const = 0;
virtual Element& axmyin(Element& r, const Element& a, const Element& x) const = 0;
// -- maxpy: r <- y - a * x
// -- maxpyin: r <- r - a * x
virtual Element& maxpy (Element& r, const Element& a, const Element& x, const Element& y) const = 0;
virtual Element& maxpyin(Element& r, const Element& a, const Element& x) const = 0;
}; // class RingInterface
template<class _Element>
struct FieldInterface : public virtual RingInterface<_Element>
{
// virtual ~FieldInterface() noexcept(true)= default;
// ----- Division arithmetic
virtual _Element& div(_Element& r, const _Element& a, const _Element& b) const = 0;
virtual _Element& inv(_Element& r, const _Element& a) const = 0;
virtual _Element& divin(_Element& r, const _Element& a) const = 0;
virtual _Element& invin(_Element& r) const = 0;
}; // class FieldInterface
template<class _Element>
struct FiniteInterface
{
virtual ~FiniteInterface() = default;
// ----- Accessors
virtual _Element minElement() const = 0;
virtual _Element maxElement() const = 0;
// ----- Static members
// static Residu_t getMinModulus() const = 0;
// static Residu_t getMaxModulus() const = 0;
};
template<class _Element>
struct FiniteFieldInterface : public virtual FieldInterface<_Element>, public virtual FiniteInterface<_Element> {
// virtual ~FiniteFieldInterface() = default;
};
template<class _Element>
struct FiniteRingInterface : public virtual RingInterface<_Element>, public virtual FiniteInterface<_Element> {
// virtual ~FiniteRingInterface() = default;
};
} // namespace Givaro
#endif // __GIVARO_ring_interface_H
|