g4tools  5.4.0
Public Member Functions | List of all members
tools::kronecker< T > Class Template Reference

common array ///////////////////////////////////////////////////////////// More...

Inheritance diagram for tools::kronecker< T >:
Inheritance graph
[legend]
Collaboration diagram for tools::kronecker< T >:
Collaboration graph
[legend]

Public Member Functions

 kronecker (unsigned int a_order)
 
- Public Member Functions inherited from tools::array< T >
 array ()
 
 array (const uints_t &a_orders)
 
 array (unsigned int a_dimension, unsigned int a_order)
 
virtual ~array ()
 
 array (const array &a_from)
 
arrayoperator= (const array &a_from)
 
arrayoperator*= (const T &a_T)
 
bool operator== (const array &a_array) const
 
bool operator!= (const array &a_array) const
 
array operator* (const T &a_T) const
 
void copy (const array &a_from)
 
void clear ()
 
bool configure (const uints_t &a_orders)
 
size_t dimension () const
 
const uints_torders () const
 
size_t size () const
 
bool set_value (const uints_t &a_is, const T &a_value)
 
bool value (const uints_t &a_is, T &a_value) const
 
value_no_check (const uints_t &a_is) const
 
void reset ()
 
const std::vector< T > & vector () const
 
std::vector< T > & vector ()
 
bool fill (const std::vector< T > &a_values, cut_t *a_cut=0)
 
bool fill (unsigned int a_sz, const T *a_data, cut_t *a_cut=0)
 
bool equal (const array &a_array) const
 
bool equal (const array &a_array, T aEpsilon) const
 
bool is_proportional (const array &a_array, T &a_factor) const
 
bool add (const array &a_array, cut_t *a_cut=0)
 
bool subtract (const array &a_array)
 
bool multiply (const array &a_array)
 
bool divide (const array &a_array)
 
bool contract (const array &a_array, T &a_value) const
 
void add (const T &a_T, cut_t *a_cut=0)
 
void multiply (const T &a_T)
 
bool divide (const T &a_T)
 
bool invert ()
 
bool offset (const uints_t &a_is, unsigned int &a_offset) const
 
bool indices (unsigned int a_offset, uints_t &a_is) const
 
bool accept (unsigned int a_index, const cut_t &a_cut) const
 
void set_constant (const T &a_v)
 
void set_zero ()
 

Additional Inherited Members

- Public Types inherited from tools::array< T >
typedef std::vector< std::pair< unsigned int, unsigned int > > cut_t
 
typedef std::vector< unsigned int > uints_t
 
typedef std::vector< T >::iterator vec_it_t
 
typedef std::vector< T >::const_iterator cons_vec_it_t
 
- Static Public Member Functions inherited from tools::array< T >
static const std::string & s_class ()
 
static T zero ()
 
static T one ()
 
static T minus_one ()
 
static T two ()
 
- Protected Attributes inherited from tools::array< T >
uints_t m_orders
 
uints_t m_offsets
 
std::vector< T > m_vector
 
uints_t m_is
 

Detailed Description

template<class T>
class tools::kronecker< T >

common array /////////////////////////////////////////////////////////////

Definition at line 558 of file array.

Constructor & Destructor Documentation

◆ kronecker()

template<class T >
tools::kronecker< T >::kronecker ( unsigned int  a_order)
inline

Definition at line 560 of file array.

560  :array<T>(a_order,a_order){
561  // epsilon(i1,i2,....in) with n = a_order and i in [0,n[.
562  // Then an Array of a_order * a_order.
563  unsigned int index = 0;
564  typedef typename std::vector<unsigned int> _uints_t;
565  _uints_t is(a_order);
566  std::vector<T>& vec = array<T>::vector();
567  typedef typename std::vector<T>::iterator _vec_it_t;
568  _vec_it_t it = vec.begin();
569  for(;it!=vec.end();++it,index++) {
570  if(!array<T>::indices(index,is)) return; //FIXME throw.
571  bool good = true;
572  {for(unsigned int iaxis=0;iaxis<a_order;iaxis++) {
573  unsigned int ival = is[iaxis];
574  for(unsigned int iaxis2=iaxis+1;iaxis2<a_order;iaxis2++) {
575  if(is[iaxis2]==ival) {
576  good = false;
577  break;
578  }
579  }
580  if(!good) break;
581  }}
582  if(!good) continue;
583  // All indicies are different.
584  unsigned int n = 0;
585  for(unsigned int iaxis=0;iaxis<a_order;) {
586  unsigned int ival = is[iaxis];
587  if(ival!=iaxis) {
588  // Swap and add one permutation :
589  unsigned int old = is[ival];
590  is[ival] = ival;
591  is[iaxis] = old;
592  n +=1;
593  } else {
594  iaxis++;
595  }
596  }
597  {unsigned int n_2 = n/2;
598  if(2*n_2==n) (*it) = array<T>::one();
599  else (*it) = array<T>::minus_one();}
600  }
601  }

The documentation for this class was generated from the following file:
tools::jpeg::is
bool is(const std::string &a_file)
Definition: jpeg:216
tools::array::indices
bool indices(unsigned int a_offset, uints_t &a_is) const
Definition: array:329
tools::array::minus_one
static T minus_one()
Definition: array:366
tools::array::one
static T one()
Definition: array:362
tools::array::vector
const std::vector< T > & vector() const
Definition: array:161