vector< C, V > Class Template Reference

#include <vector.hpp>

List of all members.

Public Types

Public Member Functions

Protected Attributes


Detailed Description

template<typename C, typename V>
class mmx::vector< C, V >

Definition at line 89 of file vector.hpp.


Member Typedef Documentation

typedef implementation<vector_linear,V> Vec

Definition at line 92 of file vector.hpp.


Constructor & Destructor Documentation

vector ( vector_rep< C, V > *  rep2  )  [inline]

Definition at line 207 of file vector.hpp.

00210 { return v->n; }

vector ( const vector_rep< C, V > *  rep2,
bool  inc 
) [inline]

Definition at line 207 of file vector.hpp.

00210 { return v->n; }

vector ( const vector< C, V > &  x  )  [inline]

Definition at line 207 of file vector.hpp.

00210 { return v->n; }

~vector (  )  [inline]

Definition at line 207 of file vector.hpp.

00210 { return v->n; }

vector (  )  [inline]

Definition at line 94 of file vector.hpp.

00094             {
00095     nat n= Vec::def_len;
00096     nat l= aligned_size<C,V> (n);
00097     C* a= mmx_formatted_new<C> (l, Format (no_format ()));
00098     rep= new Vector_rep (a, n, l, false, Format (no_format ()));
00099   }

vector ( const format< C > &  fm  )  [inline]

Definition at line 100 of file vector.hpp.

00100                             {
00101     nat n= Vec::def_len;
00102     nat l= aligned_size<C,V> (n);
00103     C* a= mmx_formatted_new<C> (l, fm);
00104     rep= new Vector_rep (a, n, l, false, fm);
00105   }

vector ( const T c  )  [inline]

Definition at line 107 of file vector.hpp.

00107                       {
00108     Format fm= as<Format > (get_format (c));
00109     nat n= Vec::init_len;
00110     nat l= aligned_size<C,V> (n);
00111     C* a= mmx_formatted_new<C> (l, fm);
00112     Vec::set (a, as<C> (c), n);
00113     rep= new Vector_rep (a, n, l, true, fm);
00114   }

vector ( const T c,
const format< C > &  fm 
) [inline]

Definition at line 116 of file vector.hpp.

00116                                         {
00117     nat n= Vec::init_len;
00118     nat l= aligned_size<C,V> (n);
00119     C* a= mmx_formatted_new<C> (l, fm);
00120     Vec::set_as (a, c, n);
00121     rep= new Vector_rep (a, n, l, true, fm);
00122   }

vector ( const C x  )  [inline]

Definition at line 123 of file vector.hpp.

00123                       {
00124     Format fm= as<Format > (get_format (x));
00125     nat n= Vec::init_len;
00126     nat l= aligned_size<C,V> (n);
00127     C* a= mmx_formatted_new<C> (l, fm);
00128     Vec::set (a, x, n);
00129     rep= new Vector_rep (a, n, l, true, fm);
00130   }

vector ( const vector< T, W > &  v  )  [inline]

Definition at line 132 of file vector.hpp.

00132                                 {
00133     Format fm= as<Format > (CF(v));
00134     nat l= aligned_size<C,V> (N(v));
00135     C* a= mmx_formatted_new<C> (l, fm);
00136     Vec::cast (a, seg (v), N(v));
00137     rep= new Vector_rep (a, N(v), l, is_a_scalar (v), fm);
00138   }

vector ( const vector< T, W > &  v,
const format< C > &  fm 
) [inline]

Definition at line 140 of file vector.hpp.

00140                                                   {
00141     nat l= aligned_size<C,V> (N(v));
00142     C* a= mmx_formatted_new<C> (l, fm);
00143     Vec::cast (a, seg (v), N(v));
00144     rep= new Vector_rep (a, N(v), l, is_a_scalar (v), fm);
00145   }

vector ( const T c,
nat  n 
) [inline]

Definition at line 147 of file vector.hpp.

00147                              {
00148     Format fm= as<Format > (get_format (c));
00149     nat l= aligned_size<C,V> (n);
00150     C* a= mmx_formatted_new<C> (l, fm);
00151     Vec::set (a, as<C> (c), n);
00152     rep= new Vector_rep (a, n, l, true, fm);
00153   }

vector ( const C x,
nat  n 
) [inline]

Definition at line 154 of file vector.hpp.

00154                              {
00155     nat l= aligned_size<C,V> (n);
00156     C* a= mmx_formatted_new<C> (l, get_format (x));
00157     Vec::set (a, x, n);
00158     rep= new Vector_rep (a, n, l, false, get_format (x));
00159   }

vector ( C a,
nat  n,
const format< C > &  fm 
) [inline]

Definition at line 160 of file vector.hpp.

00160                                                 {
00161     rep= new Vector_rep (a, n, false, fm);
00162   }

vector ( C a,
nat  n,
nat  l,
const format< C > &  fm 
) [inline]

Definition at line 163 of file vector.hpp.

00163                                                        {
00164     rep= new Vector_rep (a, n, l, false, fm);
00165   }

vector ( C a,
nat  n,
nat  l,
bool  flag,
const format< C > &  fm 
) [inline]

Definition at line 166 of file vector.hpp.

00166                                                                   {
00167     rep= new Vector_rep (a, n, l, flag, fm);
00168   }

vector ( const iterator< C > &  it  )  [inline]

Definition at line 169 of file vector.hpp.

00169                                  {
00170     Format fm= CF(it);
00171     nat i, l= Vec::def_len;
00172     if (l==0) l= aligned_size<C,V> ((nat) 1);
00173     C* a= mmx_formatted_new<C> (l, fm);
00174     for (i=0; busy (it); i++, ++it) {
00175       if (i >= l) {
00176         C* b= mmx_formatted_new<C> (aligned_size<C,V> (l<<1), fm);
00177         Vec::copy (b, a, l);
00178         mmx_delete (a, l);
00179         a= b;
00180         l= l<<1;
00181       }
00182       a[i]= *it;
00183     }
00184     rep= new Vector_rep (a, i, l, false, fm);
00185   }


Member Function Documentation

void operator delete ( void *  ptr,
size_t  sz 
) [inline]

Definition at line 90 of file vector.hpp.

00091 :
  typedef implementation<vector_linear,V> Vec;

void operator delete[] ( void *  ptr,
size_t  sz 
) [inline]

Definition at line 90 of file vector.hpp.

00091 :
  typedef implementation<vector_linear,V> Vec;

void* operator new ( size_t  sz,
void *  where 
) [inline]

Definition at line 90 of file vector.hpp.

00091 :
  typedef implementation<vector_linear,V> Vec;

void* operator new ( size_t  sz  )  [inline]

Definition at line 90 of file vector.hpp.

00091 :
  typedef implementation<vector_linear,V> Vec;

void* operator new[] ( size_t  sz,
void *  where 
) [inline]

Definition at line 90 of file vector.hpp.

00091 :
  typedef implementation<vector_linear,V> Vec;

void* operator new[] ( size_t  sz  )  [inline]

Definition at line 90 of file vector.hpp.

00091 :
  typedef implementation<vector_linear,V> Vec;

const vector_rep< C, V > * operator-> (  )  const [inline]

Definition at line 207 of file vector.hpp.

00210 { return v->n; }

vector< C, V > & operator<< ( const vector< C, V > &  w  )  [inline]

Definition at line 672 of file vector.hpp.

References ASSERT, mmx::copy(), mmx::is_non_scalar(), mmx::N(), n, vector< C, V >::rep, vector< C, V >::secure(), and mmx::seg().

00672                                     {
00673   typedef implementation<vector_linear,V> Vec;
00674   ASSERT (is_non_scalar (*this) && is_non_scalar (w),
00675           "non-scalar vectors expected");
00676   secure ();
00677   nat n= rep->n, p= N(w);
00678   rep->resize (n + p);
00679   Vec::copy (rep->a + n, seg (w), p);
00680   return *this;
00681 }

vector< C, V > & operator<< ( const C append  )  [inline]

Definition at line 662 of file vector.hpp.

References ASSERT, mmx::is_non_scalar(), n, vector< C, V >::rep, and vector< C, V >::secure().

00662                                     {
00663   ASSERT (is_non_scalar (*this), "non-scalar vector expected");
00664   secure ();
00665   nat n= rep->n;
00666   rep->resize (n+1);
00667   rep->a[n]= append;
00668   return *this;
00669 }

vector< C, V > & operator= ( const vector< C, V > &  x  )  [inline]

Definition at line 207 of file vector.hpp.

00210 { return v->n; }

C& operator[] ( nat  i  )  [inline]

Definition at line 191 of file vector.hpp.

00191                                 {
00192     VERIFY (is_non_scalar (*this), "non-scalar vector expected");
00193     VERIFY (i<N(*this), "index out of range");
00194     secure(); return rep->a[i]; }

const C& operator[] ( nat  i  )  const [inline]

Definition at line 187 of file vector.hpp.

00187                                             {
00188     VERIFY (is_non_scalar (*this), "non-scalar vector expected");
00189     VERIFY (i<N(*this), "index out of range");
00190     return rep->a[i]; }

C& scalar (  )  [inline]

Definition at line 198 of file vector.hpp.

00198                       {
00199     VERIFY (is_a_scalar (*this), "scalar vector expected");
00200     return rep->a[0]; }

C scalar (  )  const [inline]
void secure (  )  [inline]

Definition at line 207 of file vector.hpp.

Referenced by vector< C, V >::operator<<(), and vector< observer >::operator[]().

00210 { return v->n; }

nat size (  )  const [inline]

Definition at line 201 of file vector.hpp.

00201                           {
00202     return rep->n; }


Member Data Documentation

vector_rep< C , V >* rep [protected]

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

Generated on 6 Dec 2012 for basix by  doxygen 1.6.1