VECTOR Namespace Reference


Detailed Description

Module for generic functions on vectors.

Generic implementations for vectors are gathered in the namespace {VECTOR}. 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}


Functions

template<class OS, class R>
OS & print (OS &os, const R &v)
 Output function for general vectors: [v1, v2, ...].
template<class OS, class R>
OS & print (OS &os, const R &v, unsigned sz)
 Output function for general vectors: [v1, v2, ...].
template<class IS, class R>
IS & read (IS &is, R &V)
template<class V1, class V2>
bool equal_n (const V1 &v1, const V2 &v2, int n)
template<class V1, class V2>
bool equal (const V1 &v1, const V2 &v2)
template<class V, class C>
void init_n (V &a, const C &v, int n)
template<class V, class C>
void init (V &a, const C &v)
 Set all the entries of a to the values v.
template<class V>
void reverse_n (V &v, int a, int n)
 Reverse the entries of v, from the index a to n-1.
template<class V>
void reverse (V &v, int n)
template<class V, class I>
void reverse (V &v, I d)
 Reverse the entries of v, from the index 0 to d-1.
template<class V, class W>
void neg_range (V &r, const W &w, int a, int b)
template<class V, class W>
void neg_range (V &r, int a, int b)
template<class VI>
void neg_i (VI a, VI eda)
template<class VI>
void neg_i (VI a, VI eda, VI b)
template<class V>
void neg (V &v)
template<class V>
void neg (V &a, const V &b)
template<class V, class W>
void copy_range (V &v, const W &w, int a, int b)
template<class V, class W>
void add_n (V &a, const W &b, int n)
template<class VI, class WI>
void add_i (VI a, VI ea, WI b)
template<class V, class W>
void add (V &a, const W &b)
 Addition of two vectors.
template<class V, class W, class X>
void add_n (V &a, const W &b, const X &c, int n)
template<class V, class W, class X>
void add_g (V &r, const W &a, const X &b)
template<class V, class W, class X>
void add (V &r, const W &a, const X &b)
template<class V>
void add (V &r, const V &a, const V &b)
template<class V, class W>
void sub_n (V &a, const W &b, int n)
template<class V, class W>
void sub (V &a, const W &b)
 Substraction of two vectors.
template<class V, class W, class X>
void sub_n (V &a, const W &b, const X &c, int n)
template<class V, class W, class X>
void sub_g (V &r, const W &a, const X &b)
template<class V, class W, class X>
void sub (V &r, const W &a, const X &b)
template<class V>
void sub (V &r, const V &a, const V &b)
template<class V, class W>
void mul_ext_n (V &a, const W &c, int n)
template<class V, class W, class S>
void mul_ext_n (V &a, const W &b, const S &c, int n)
template<class VI, class W>
void mul_ext_i (VI bga, VI eda, const W &c)
template<class VI, class VII, class W>
void mul_ext_i (VI bga, VI eda, VII bgb, const W &c)
template<class V, class W>
void mul_ext (V &a, const V &b, const W &c)
 Scalar multiplication.
template<class V, class SC>
void div_ext_n (V &a, const SC &sc, int n)
template<class V1, class V2, class SC>
void div_ext_n (V1 &a, const V2 &b, const SC &sc, int n)
template<class VI, class SC>
void div_ext_i (VI bga, VI eda, const SC &sc)
template<class VI, class SC>
void div_ext_i (VI a, VI eda, VI b, const SC &sc)
template<class V, class SC>
void div_ext (V &a, const V &b, const SC &sc)
 Scalar division.
template<class V, class W>
void div_ext (V &a, const W &c)
 Scalar division.
template<class V, class W>
void div (V &a, const W &c)
 Inplace scalar division.
template<class R, class S, class C>
void apply_mult (R &result, const S &a, const C &m)
template<class C, class R>
norm (const R &v)
 The $L_{2}$ norm for vectors.
template<class C, class R>
norm (const R &v, int p)
 Norm $L_{p}$ of a vector.
template<class R, class S>
R::value_type innerprod_n (const S &v, const R &w, unsigned n)
 Innerproduct of two vectors.
template<class R, class S>
R::value_type innerprod (const S &v, const R &w)
template<class R>
R::value_type max_abs (const R &v)
template<class Ia, class Ib>
void assign_i (Ia a, Ia eda, Ib b)
template<class Ra, class Rb>
void assign (Ra &a, const Rb &b)
template<class R, class C>
void vaddsc (R &r, const C &x)


Function Documentation

template<class V>
void VECTOR::add ( V &  r,
const V &  a,
const V &  b 
)

Specialisation of the function add when W=V. Inplace addition is used when r=a or r=b.

Definition at line 201 of file VECTOR.m.

References add(), and add_g().

template<class V, class W, class X>
void VECTOR::add ( V &  r,
const W &  a,
const X &  b 
)

Addition of two vectors. r should be allocated to the correct size and with 0 entries.

Definition at line 193 of file VECTOR.m.

References add_g().

template<class V, class W>
void VECTOR::add ( V &  a,
const W &  b 
)

Addition of two vectors.

Definition at line 150 of file VECTOR.m.

References add_i(), and copy_range().

Referenced by add(), and add().

template<class V, class W, class X>
void VECTOR::add_g ( V &  r,
const W &  a,
const X &  b 
)

Addition of two vectors. r should be allocated to the correct size and with 0 entries.

Definition at line 171 of file VECTOR.m.

References add_n(), and copy_range().

Referenced by add().

template<class V, class W>
void VECTOR::div ( V &  a,
const W &  c 
)

Inplace scalar division.

Definition at line 324 of file VECTOR.m.

References div_ext().

template<class V, class W>
void VECTOR::div_ext ( V &  a,
const W &  c 
)

Scalar division.

Definition at line 319 of file VECTOR.m.

References div_ext_i().

template<class V, class SC>
void VECTOR::div_ext ( V &  a,
const V &  b,
const SC &  sc 
)

Scalar division.

Definition at line 309 of file VECTOR.m.

References div_ext_i().

Referenced by div(), div(), and quotient::ModUPol< C, R >::mul().

template<class V, class C>
void VECTOR::init ( V &  a,
const C &  v 
)

Set all the entries of a to the values v.

Definition at line 102 of file VECTOR.m.

References init_n().

Referenced by projection::eval_to_double(), quotient::ModUPol< C, R >::horner_to_monomial(), quotient::ModUPol< C, R >::monomial_to_horner(), UPOLDAR::mul(), UPOLDAR::mul_index(), UPOLDAR::set_monomial(), quotient::ModUPol< C, R >::square(), and UPolDse< C, R >::UPolDse().

template<class R, class S>
R::value_type VECTOR::innerprod_n ( const S &  v,
const R &  w,
unsigned  n 
)

Innerproduct of two vectors.

Definition at line 361 of file VECTOR.m.

template<class V, class W>
void VECTOR::mul_ext ( V &  a,
const V &  b,
const W &  c 
)

Scalar multiplication.

Definition at line 284 of file VECTOR.m.

References mul_ext_i().

Referenced by mul().

template<class C, class R>
C VECTOR::norm ( const R &  v,
int  p 
)

Norm $L_{p}$ of a vector.

Definition at line 352 of file VECTOR.m.

template<class C, class R>
C VECTOR::norm ( const R &  v  ) 

The $L_{2}$ norm for vectors.

Definition at line 343 of file VECTOR.m.

template<class OS, class R>
OS& VECTOR::print ( OS &  os,
const R &  v,
unsigned  sz 
)

Output function for general vectors: [v1, v2, ...].

Definition at line 56 of file VECTOR.m.

template<class OS, class R>
OS& VECTOR::print ( OS &  os,
const R &  v 
)

Output function for general vectors: [v1, v2, ...].

Definition at line 43 of file VECTOR.m.

Referenced by bezier::sbd2d< X, C, USLV >::connect_xy(), and operator<<().

template<class IS, class R>
IS& VECTOR::read ( IS &  is,
R &  V 
)

Input operator for standard vectors. The input format is of the form s c0 c1 ... where s is the number of elements.

Definition at line 72 of file VECTOR.m.

template<class V, class I>
void VECTOR::reverse ( V &  v,
d 
)

Reverse the entries of v, from the index 0 to d-1.

Definition at line 118 of file VECTOR.m.

template<class V>
void VECTOR::reverse_n ( V &  v,
int  a,
int  n 
)

Reverse the entries of v, from the index a to n-1.

Definition at line 107 of file VECTOR.m.

Referenced by reverse().

template<class V>
void VECTOR::sub ( V &  r,
const V &  a,
const V &  b 
)

Specialisation of the sub function when W=V. Inplace substraction is used when r=a or r=b.

Definition at line 262 of file VECTOR.m.

References sub(), and sub_g().

template<class V, class W, class X>
void VECTOR::sub ( V &  r,
const W &  a,
const X &  b 
)

Substraction of two vectors. r should be allocated to the correct size and with 0 entries.

Definition at line 254 of file VECTOR.m.

References sub_g().

template<class V, class W>
void VECTOR::sub ( V &  a,
const W &  b 
)

Substraction of two vectors.

Definition at line 214 of file VECTOR.m.

References neg_range(), and sub_n().

Referenced by sub(), and sub().


SYNAPS DOCUMENTATION
logo