TBCI::Vector< T > Class Template Reference

#include <vector.h>

Inheritance diagram for TBCI::Vector< T >:

Inheritance graph
[legend]
Collaboration diagram for TBCI::Vector< T >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef T value_type
typedef T element_type
typedef T aligned_value_type

Public Member Functions

 Vector (const unsigned long d=0)
 Vector (const T &val, const unsigned long d)
 Vector (const BVector< T > &bv)
 Vector (const Vector< T > &v)
 Vector (const TSVector< T > &ts)
 Vector (const TVector< T > &tv)
 Vector (const Mat_Brack< T > &)
 Vector (const vararg va,...)
 ~Vector ()
tbci_traits< T >::const_refval_type operator() (const unsigned long i) const
tbci_traits< T >::const_refval_type operator[] (const unsigned long i) const
T & operator() (const unsigned long i)
T & operator[] (const unsigned long i)
Vector< T > & fill (const T &v)
Vector< T > & clear ()
TVector< T > slice (unsigned long, unsigned long) const
TVector< T > incr (const unsigned long, const T=(T) 1) const
Vector< T > & operator= (const T &a)
Vector< T > & operator= (const Vector< T > &v)
 assignment operator does NOT resize the Vector!
Vector< T > & operator= (const TSVector< T > &ts)
Vector< T > & operator= (const TVector< T > &tv)
 alias
bool operator== (const Vector< T > &v) const
bool operator!= (const Vector< T > &v) const
bool operator== (const TSVector< T > &) const
bool operator!= (const TSVector< T > &ts) const
bool operator== (const TVector< T > &tv) const
bool operator!= (const TVector< T > &tv) const
bool operator<= (const Vector< T > &v) const
bool operator>= (const Vector< T > &v) const
bool operator< (const Vector< T > &v) const
bool operator> (const Vector< T > &v) const
TVector< T > operator+ (const Vector< T > &) const
 TV = V + V.
TVector< T > operator- (const Vector< T > &) const
 TV = V - V.
TVector< T > operator+ (TVector< T > tv) const
 TV = V + TV transformed into TV += V.
TVector< T > operator- (TVector< T > tv) const
 TV = V - TV transformed into -TV -= V.
TVector< T > operator+ (const TSVector< T > &) const
 TV = V + TSV.
TVector< T > operator- (const TSVector< T > &) const
 TV = V - TSV.
TVector< T > operator+ (const T &) const
 TV = V + T.
TVector< T > operator- (const T &) const
 TV = V - T.
TSVector< T > operator* (const T &) const
TSVector< T > operator/ (const T &) const
TVector< T > operator- () const
operator* (const Vector< T > &) const
operator* (TVector< T > &tv) const
operator/ (const Vector< T > &) const
min () const
max () const
min (unsigned long &pos) const
max (unsigned long &pos) const
sum () const
double fabssqr () const
double fabs () const
abs () const
bool contains (const T &v) const
template<typename U>
 Vector (const BVector< U > &bv)

Static Public Member Functions

static const char * vec_info ()

Friends

class TSVector< T >
dot (const Vector< T > &, const Vector< T > &)


Detailed Description

template<typename T>
class TBCI::Vector< T >

This is the real Vector class, to be used by users of this library. The existence of TVector and TSVector should in theory be non-visible to the user.

Read the introduction to TBCI to understand how the Temporary Base Class Idiom helps to avoid spurious copies of data; the compiler knows that temporary objects can be aliased rather than copied, thus we copy one pointer rather than a data array. This gives us C++ semantics (operators!) with the possibility of composing operator expressions and at the same time the speed of C/FORTRAN. To achieve this the temporary base class TVector is needed as cousin for Vector.

The TSVector class is a further optimization that helps to do the composed operation Scale a x Plus y (a scalar, x, y vectors) in just one loop.

A more generic way of optimizing C++ expressions are expression templates. These however put a heavy burden on the compilers and will only be implemented in a successor project.

Definition at line 1532 of file vector.h.


Member Typedef Documentation

template<typename T>
typedef T TBCI::Vector< T >::value_type

Reimplemented from TBCI::TVector< T >.

Definition at line 1536 of file vector.h.

template<typename T>
typedef T TBCI::Vector< T >::element_type

Reimplemented from TBCI::TVector< T >.

Definition at line 1537 of file vector.h.

template<typename T>
typedef T TBCI::Vector< T >::aligned_value_type

Reimplemented from TBCI::TVector< T >.

Definition at line 1538 of file vector.h.


Constructor & Destructor Documentation

template<typename T>
TBCI::Vector< T >::Vector ( const unsigned long  d = 0  )  [inline, explicit]

Definition at line 1545 of file vector.h.

template<typename T>
TBCI::Vector< T >::Vector ( const T &  val,
const unsigned long  d 
) [inline]

Definition at line 1546 of file vector.h.

template<typename T>
TBCI::Vector< T >::Vector ( const BVector< T > &  bv  )  [inline]

Definition at line 1547 of file vector.h.

template<typename T>
TBCI::Vector< T >::Vector ( const Vector< T > &  v  )  [inline]

Definition at line 1548 of file vector.h.

template<typename T>
TBCI::Vector< T >::Vector ( const TSVector< T > &  ts  )  [inline]

Definition at line 1550 of file vector.h.

template<typename T>
TBCI::Vector< T >::Vector ( const TVector< T > &  tv  )  [inline]

Definition at line 1552 of file vector.h.

template<typename T>
TBCI::Vector< T >::Vector ( const Mat_Brack< T > &  mb  )  [inline]

template<typename T>
TBCI::Vector< T >::Vector ( const vararg  va,
  ... 
) [inline]

template<typename T>
TBCI::Vector< T >::~Vector (  )  [inline]

Definition at line 1565 of file vector.h.

template<typename T>
template<typename U>
TBCI::Vector< T >::Vector ( const BVector< U > &  bv  )  [inline, explicit]

Definition at line 1681 of file vector.h.


Member Function Documentation

template<typename T>
tbci_traits<T>::const_refval_type TBCI::Vector< T >::operator() ( const unsigned long  i  )  const [inline]

Reimplemented from TBCI::BVector< T >.

Definition at line 1569 of file vector.h.

template<typename T>
tbci_traits<T>::const_refval_type TBCI::Vector< T >::operator[] ( const unsigned long  i  )  const [inline]

Reimplemented from TBCI::BVector< T >.

Definition at line 1572 of file vector.h.

template<typename T>
T& TBCI::Vector< T >::operator() ( const unsigned long  i  )  [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1575 of file vector.h.

template<typename T>
T& TBCI::Vector< T >::operator[] ( const unsigned long  i  )  [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1577 of file vector.h.

template<typename T>
Vector<T>& TBCI::Vector< T >::fill ( const T &  v  )  [inline]

Reimplemented from TBCI::BVector< T >.

Definition at line 1583 of file vector.h.

Referenced by TBCI::CTensor< T >::calc_indx().

template<typename T>
Vector<T>& TBCI::Vector< T >::clear (  )  [inline]

Reimplemented from TBCI::BVector< T >.

Definition at line 1584 of file vector.h.

template<typename T>
TVector< T > TBCI::Vector< T >::slice ( unsigned long  i0,
unsigned long  i1 
) const [inline]

template<typename T>
TVector< T > TBCI::Vector< T >::incr ( const unsigned long  wh,
const T  i = (T)1 
) const [inline]

Definition at line 2295 of file vector.h.

References BCHK, and TBCI::BVector< T >::vec.

template<typename T>
Vector<T>& TBCI::Vector< T >::operator= ( const T &  a  )  [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1593 of file vector.h.

template<typename T>
Vector<T>& TBCI::Vector< T >::operator= ( const Vector< T > &  v  )  [inline]

assignment operator does NOT resize the Vector!

Reimplemented from TBCI::TVector< T >.

Definition at line 1596 of file vector.h.

template<typename T>
Vector<T>& TBCI::Vector< T >::operator= ( const TSVector< T > &  ts  )  [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1598 of file vector.h.

template<typename T>
Vector<T>& TBCI::Vector< T >::operator= ( const TVector< T > &  tv  )  [inline]

alias

Reimplemented from TBCI::TVector< T >.

Definition at line 1600 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator== ( const Vector< T > &  v  )  const [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1609 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator!= ( const Vector< T > &  v  )  const [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1611 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator== ( const TSVector< T > &  tsv  )  const [inline]

template<typename T>
bool TBCI::Vector< T >::operator!= ( const TSVector< T > &  ts  )  const [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1613 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator== ( const TVector< T > &  tv  )  const [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1614 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator!= ( const TVector< T > &  tv  )  const [inline]

Reimplemented from TBCI::TVector< T >.

Definition at line 1615 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator<= ( const Vector< T > &  v  )  const [inline]

Definition at line 1619 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator>= ( const Vector< T > &  v  )  const [inline]

Definition at line 1620 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator< ( const Vector< T > &  v  )  const [inline]

Definition at line 1621 of file vector.h.

template<typename T>
bool TBCI::Vector< T >::operator> ( const Vector< T > &  v  )  const [inline]

Definition at line 1622 of file vector.h.

template<typename T>
TVector< T > TBCI::Vector< T >::operator+ ( const Vector< T > &  v  )  const [inline]

template<typename T>
TVector< T > TBCI::Vector< T >::operator- ( const Vector< T > &  v  )  const [inline]

template<typename T>
TVector< T > TBCI::Vector< T >::operator+ ( TVector< T >  tv  )  const [inline]

TV = V + TV transformed into TV += V.

Definition at line 2138 of file vector.h.

References BCHK, TBCI::BVector< T >::dim, TBCI::TVector< T >::size(), STD_SMP_TEMPLATE2V, and TBCI::BVector< T >::vec.

template<typename T>
TVector< T > TBCI::Vector< T >::operator- ( TVector< T >  tv  )  const [inline]

TV = V - TV transformed into -TV -= V.

Definition at line 2148 of file vector.h.

References BCHK, TBCI::BVector< T >::dim, TBCI::TVector< T >::size(), STD_SMP_TEMPLATE2V, and TBCI::BVector< T >::vec.

template<typename T>
TVector< T > TBCI::Vector< T >::operator+ ( const TSVector< T > &  ts  )  const [inline]

template<typename T>
TVector< T > TBCI::Vector< T >::operator- ( const TSVector< T > &  ts  )  const [inline]

template<typename T>
TVector< T > TBCI::Vector< T >::operator+ ( const T &  a  )  const [inline]

TV = V + T.

Definition at line 2191 of file vector.h.

References STD_SMP_TEMPLATE3VC, and TBCI::BVector< T >::vec.

template<typename T>
TVector< T > TBCI::Vector< T >::operator- ( const T &  a  )  const [inline]

TV = V - T.

Definition at line 2200 of file vector.h.

References STD_SMP_TEMPLATE3VC, and TBCI::BVector< T >::vec.

template<typename T>
TSVector< T > TBCI::Vector< T >::operator* ( const T &  a  )  const [inline]

Reimplemented from TBCI::Vector_Sig< T >.

Definition at line 2210 of file vector.h.

template<typename T>
TSVector< T > TBCI::Vector< T >::operator/ ( const T &  a  )  const [inline]

Reimplemented from TBCI::Vector_Sig< T >.

Definition at line 2216 of file vector.h.

References BCHK, and T.

template<typename T>
TVector< T > TBCI::Vector< T >::operator- (  )  const [inline]

Definition at line 2273 of file vector.h.

References TBCI::BVector< T >::vec.

template<typename T>
T TBCI::Vector< T >::operator* ( const Vector< T > &  a  )  const [inline]

template<typename T>
T TBCI::Vector< T >::operator* ( TVector< T > &  tv  )  const [inline]

Definition at line 1643 of file vector.h.

template<typename T>
T TBCI::Vector< T >::operator/ ( const Vector< T > &  a  )  const [inline]

Definition at line 2034 of file vector.h.

References ALIGN, BCHK, TBCI::Vector< T >::fabssqr(), MIN_ALIGN, std::norm(), and T.

template<typename T>
T TBCI::Vector< T >::min (  )  const [inline]

template<typename T>
T TBCI::Vector< T >::max (  )  const [inline]

template<typename T>
T TBCI::Vector< T >::min ( unsigned long &  pos  )  const [inline]

Definition at line 2054 of file vector.h.

References ALIGN, BCHK, LIKELY, TBCI::Vector< T >::min(), MIN_ALIGN, T, UNLIKELY, and TBCI::BVector< T >::vec.

template<typename T>
T TBCI::Vector< T >::max ( unsigned long &  pos  )  const [inline]

Definition at line 2080 of file vector.h.

References ALIGN, BCHK, LIKELY, TBCI::Vector< T >::max(), MIN_ALIGN, T, UNLIKELY, and TBCI::BVector< T >::vec.

template<typename T>
T TBCI::Vector< T >::sum (  )  const [inline]

Definition at line 2094 of file vector.h.

References ALIGN, MIN_ALIGN, T, and TBCI::BVector< T >::vec.

Referenced by TBCI::TVector< unsigned >::sum().

template<typename T>
double TBCI::Vector< T >::fabssqr (  )  const [inline]

template<typename T>
double TBCI::Vector< T >::fabs (  )  const [inline]

Definition at line 1653 of file vector.h.

Referenced by TBCI::TVector< unsigned >::fabs().

template<typename T>
T TBCI::Vector< T >::abs (  )  const [inline]

Definition at line 1654 of file vector.h.

Referenced by TBCI::TVector< unsigned >::abs().

template<typename T>
bool TBCI::Vector< T >::contains ( const T &  v  )  const [inline]

Definition at line 1657 of file vector.h.

template<typename T>
static const char* TBCI::Vector< T >::vec_info (  )  [inline, static]

Reimplemented from TBCI::TVector< T >.

Definition at line 1663 of file vector.h.


Friends And Related Function Documentation

template<typename T>
friend class TSVector< T > [friend]

Reimplemented from TBCI::TVector< T >.

Definition at line 1540 of file vector.h.

template<typename T>
T dot ( const Vector< T > &  a,
const Vector< T > &  b 
) [friend]

Definition at line 1817 of file vector.h.

Referenced by TBCI::dot().


The documentation for this class was generated from the following files:

Generated on Wed Nov 20 09:29:46 2013 for TBCI Numerical high perf. C++ Library by  doxygen 1.5.6