realroot_doc 0.1.1
|
Module for generic functions on vectors. Generic implementations for vectors are gathered in the namespace array
. These are generic functions, that can be used to build new linear classes. The type {R} must provide the following definitions or methods: {SIGNATURE} typename index_t; typename value_type; typename iterator; typename const_iterator;.
More...
Module for generic functions on vectors. Generic implementations for vectors are gathered in the namespace array
. These are generic functions, that can be used to build new linear classes. The type {R} must provide the following definitions or methods: {SIGNATURE} typename index_t; typename value_type; typename iterator; typename const_iterator;.
index_t this->size(); value_type this->operator[](index_t);
iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; {SIGNATURE}
void mmx::array::add | ( | V & | a, |
const W & | b | ||
) |
Addition of two vectors.
Definition at line 155 of file array.hpp.
References add_i(), add_n(), and copy_range().
Referenced by mmx::add(), add(), msimplify(), and mmx::mul().
{ int asz, bsz; asz = a.size(), bsz = b.size(); if ( asz < bsz ) { a.resize(bsz); add_i(a.begin(),a.end(),b.begin()); copy_range(a,b,asz,bsz); } else { // PRINT_DEBUG("add"); add_n(a,b,bsz); // add_i(a.begin(),a.begin()+bsz,b.begin()); } }
void mmx::array::add | ( | V & | r, |
const W & | a, | ||
const X & | b | ||
) | [inline] |
void mmx::array::add | ( | V & | r, |
const V & | a, | ||
const V & | b | ||
) | [inline] |
void mmx::array::add_g | ( | V & | r, |
const W & | a, | ||
const X & | b | ||
) |
Addition of two vectors. @ should be allocated to the correct size and with 0 entries.
Definition at line 180 of file array.hpp.
References add_n(), and copy_range().
Referenced by add().
{ int asz, bsz, rsz; asz = a.size(), bsz = b.size(), rsz = r.size(); if ( asz > bsz ) { if ( asz > rsz ) r.resize(asz); add_n(r,a,b,bsz); copy_range(r,a,bsz,asz); } else { if ( bsz > rsz ) r.resize(bsz); add_n(r,a,b,asz); copy_range(r,b,asz,bsz); }; }
void mmx::array::add_i | ( | VI | a, |
VI | ea, | ||
WI | b | ||
) |
void mmx::array::add_n | ( | V & | a, |
const W & | b, | ||
int | n | ||
) |
void mmx::array::add_n | ( | V & | a, |
const W & | b, | ||
const X & | c, | ||
int | n | ||
) | [inline] |
void mmx::array::apply_mult | ( | R & | result, |
const S & | a, | ||
const C & | m | ||
) | [inline] |
void mmx::array::assign | ( | Ra & | a, |
const Rb & | b | ||
) | [inline] |
Definition at line 426 of file array.hpp.
References assign_i().
{ a.resize( b.size() ); assign_i( a.begin(), a.end(), b.begin() ); };
void mmx::array::assign_i | ( | Ia | a, |
Ia | eda, | ||
Ib | b | ||
) | [inline] |
Definition at line 420 of file array.hpp.
References mmx::let::assign().
Referenced by assign().
{ for ( ; a != eda; ++a, ++b ) let::assign(*a,*b); };
void mmx::array::copy_range | ( | V & | v, |
const W & | w, | ||
int | a, | ||
int | b | ||
) | [inline] |
void mmx::array::div | ( | V & | a, |
const W & | c | ||
) |
Inplace scalar division.
Definition at line 335 of file array.hpp.
References div_ext().
Referenced by binary_sleeve_subdivision< K >::init_pol().
{ div_ext(a,c); //W tmp(c); for(typename V::iterator it=a.begin(); it !=a.end(); ++it) (*it)/=tmp; }
void mmx::array::div_ext | ( | V & | a, |
const V & | b, | ||
const SC & | sc | ||
) |
Scalar division.
Definition at line 320 of file array.hpp.
References div_ext_i().
Referenced by mmx::univariate::div(), and div().
void mmx::array::div_ext | ( | V & | a, |
const W & | c | ||
) |
Scalar division.
Definition at line 330 of file array.hpp.
References div_ext_i().
{ div_ext_i(a.begin(),a.end(),c); }
void mmx::array::div_ext_i | ( | VI | bga, |
VI | eda, | ||
const SC & | sc | ||
) | [inline] |
void mmx::array::div_ext_i | ( | VI | a, |
VI | eda, | ||
VI | b, | ||
const SC & | sc | ||
) | [inline] |
void mmx::array::div_ext_n | ( | V & | a, |
const SC & | sc, | ||
int | n | ||
) | [inline] |
void mmx::array::div_ext_n | ( | V1 & | a, |
const V2 & | b, | ||
const SC & | sc, | ||
int | n | ||
) |
bool mmx::array::equal | ( | const V1 & | v1, |
const V2 & | v2 | ||
) | [inline] |
bool mmx::array::equal_n | ( | const V1 & | v1, |
const V2 & | v2, | ||
int | n | ||
) | [inline] |
void mmx::array::init_n | ( | V & | a, |
const C & | v, | ||
int | n | ||
) | [inline] |
R::value_type mmx::array::innerprod | ( | const S & | v, |
const R & | w | ||
) |
R::value_type mmx::array::innerprod_n | ( | const S & | v, |
const R & | w, | ||
unsigned | n | ||
) |
void mmx::array::lcm_denominator | ( | U & | r, |
const R & | v | ||
) |
Definition at line 401 of file array.hpp.
References mmx::denominator(), and mmx::lcm().
{ for(unsigned i=0; i <v.size(); i++) { r = lcm(r,denominator(v[i])); } }
R::value_type mmx::array::max_abs | ( | const R & | v | ) |
Definition at line 388 of file array.hpp.
Referenced by binary_sleeve_subdivision< K >::init_pol().
{ typename R::value_type r=0; for(unsigned i=0; i <(unsigned)v.size(); i++) { if(r>v[i]) r=v[i]; else if(r>-v[i]) r=-v[i]; } return r; }
void mmx::array::mul_ext | ( | V & | a, |
const V & | b, | ||
const W & | c | ||
) |
Scalar multiplication.
Definition at line 292 of file array.hpp.
References mul_ext_i().
Referenced by mmx::univariate::mul().
void mmx::array::mul_ext | ( | V & | a, |
const W & | c | ||
) |
Definition at line 302 of file array.hpp.
References mul_ext_i().
{ mul_ext_i(a.begin(),a.end(),c); }
void mmx::array::mul_ext_i | ( | VI | bga, |
VI | eda, | ||
const W & | c | ||
) | [inline] |
void mmx::array::mul_ext_i | ( | VI | bga, |
VI | eda, | ||
VII | bgb, | ||
const W & | c | ||
) | [inline] |
void mmx::array::mul_ext_n | ( | V & | a, |
const W & | b, | ||
const S & | c, | ||
int | n | ||
) | [inline] |
void mmx::array::mul_ext_n | ( | V & | a, |
const W & | c, | ||
int | n | ||
) | [inline] |
void mmx::array::neg | ( | V & | v | ) | [inline] |
void mmx::array::neg | ( | V & | a, |
const V & | b | ||
) | [inline] |
void mmx::array::neg_i | ( | VI | a, |
VI | eda | ||
) | [inline] |
void mmx::array::neg_i | ( | VI | a, |
VI | eda, | ||
VI | b | ||
) | [inline] |
void mmx::array::neg_range | ( | V & | r, |
const W & | w, | ||
int | a, | ||
int | b | ||
) | [inline] |
void mmx::array::neg_range | ( | V & | r, |
int | a, | ||
int | b | ||
) | [inline] |
C mmx::array::norm | ( | const R & | v | ) |
The $L_{2}$ norm for vectors.
Definition at line 354 of file array.hpp.
References mmx::sqrt().
{ C r=0; for(typename R::const_iterator it=v.begin(); it !=v.end(); ++it) r+=(*it)*(*it); return sqrt(r); }
C mmx::array::norm | ( | const R & | v, |
int | p | ||
) |
OS& mmx::array::print | ( | OS & | os, |
const R & | v | ||
) | [inline] |
OS& mmx::array::print | ( | OS & | os, |
const R & | v, | ||
unsigned | sz | ||
) | [inline] |
IS& mmx::array::read | ( | IS & | is, |
R & | V | ||
) | [inline] |
void mmx::array::reverse | ( | V & | v, |
int | n | ||
) |
void mmx::array::reverse | ( | V & | v, |
I | d | ||
) |
Reverse the entries of @, from the index @0@ to -1@.
Definition at line 120 of file array.hpp.
References mmx::sparse::swap().
{ for(I i=0;i<d/2; std::swap(v[i],v[d-1-i]),++i) {} }
void mmx::array::reverse | ( | V & | v | ) | [inline] |
void mmx::array::reverse_n | ( | V & | v, |
int | a, | ||
int | n | ||
) |
Reverse the entries of @, from the index @ to
-1@.
Definition at line 109 of file array.hpp.
References mmx::sparse::swap().
Referenced by reverse().
{ int k = n - a; for ( int i = 0; i < k/2; std::swap(v[a+i],v[k-1-i]), i ++ ) {} };
void mmx::array::set | ( | V & | a, |
const W & | b | ||
) |
void mmx::array::set_cst | ( | V & | a, |
const C & | v | ||
) |
Set all the entries of @ to the values @.
Definition at line 100 of file array.hpp.
References init_n().
Referenced by mmx::univariate::convertm2b(), mmx::univariate::mul(), mmx::univariate::mul_index(), and mmx::univariate::set_monomial().
{ init_n(a,v,(int)a.size()); };
void mmx::array::sub | ( | V & | r, |
const V & | a, | ||
const V & | b | ||
) |
void mmx::array::sub | ( | V & | r, |
const W & | a, | ||
const X & | b | ||
) |
void mmx::array::sub | ( | V & | a, |
const W & | b | ||
) |
Substraction of two vectors.
Definition at line 222 of file array.hpp.
References neg_range(), and sub_n().
Referenced by mmx::div(), and sub().
void mmx::array::sub_g | ( | V & | r, |
const W & | a, | ||
const X & | b | ||
) |
Definition at line 241 of file array.hpp.
References copy_range(), neg_range(), and sub_n().
Referenced by sub().
{ int asz, bsz, rsz; asz = a.size(), bsz = b.size(), rsz = r.size(); if ( asz > bsz ) { if ( asz > rsz ) r.resize(asz); sub_n(r,a,b,bsz); copy_range(r,a,bsz,asz); } else { if ( bsz > rsz ) r.resize(bsz); sub_n(r,a,b,asz); neg_range(r,b,asz,bsz); }; }
void mmx::array::sub_n | ( | V & | a, |
const W & | b, | ||
const X & | c, | ||
int | n | ||
) | [inline] |
void mmx::array::sub_n | ( | V & | a, |
const W & | b, | ||
int | n | ||
) |