basix_doc 0.1
vector< C, V > Class Template Reference

#include <vector.hpp>

List of all members.

Public Member Functions


Detailed Description

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

Examples:

vector_test.cpp.

Definition at line 81 of file vector.hpp.


Constructor & Destructor Documentation

vector ( ) [inline]

Definition at line 86 of file vector.hpp.

            {
    nat n= Vec::def_len;
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, Format (no_format ()));
    rep= new Vector_rep (a, n, l, false, Format (no_format ()));
  }
vector ( const format< C > &  fm) [inline]

Definition at line 92 of file vector.hpp.

                            {
    nat n= Vec::def_len;
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, fm);
    rep= new Vector_rep (a, n, l, false, fm);
  }
vector ( const T c) [inline]

Definition at line 99 of file vector.hpp.

                      {
    Format fm= as<Format > (get_format (c));
    nat n= Vec::init_len;
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, fm);
    Vec::set (a, as<C> (c), n);
    rep= new Vector_rep (a, n, l, true, fm);
  }
vector ( const T c,
const format< C > &  fm 
) [inline]

Definition at line 108 of file vector.hpp.

                                        {
    nat n= Vec::init_len;
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, fm);
    Vec::set_as (a, c, n);
    rep= new Vector_rep (a, n, l, true, fm);
  }
vector ( const C x) [inline]

Definition at line 115 of file vector.hpp.

                      {
    Format fm= as<Format > (get_format (x));
    nat n= Vec::init_len;
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, fm);
    Vec::set (a, x, n);
    rep= new Vector_rep (a, n, l, true, fm);
  }
vector ( const vector< T, W > &  v) [inline]

Definition at line 124 of file vector.hpp.

                                {
    Format fm= as<Format > (CF(v));
    nat l= aligned_size<C,V> (N(v));
    C* a= mmx_formatted_new<C> (l, fm);
    Vec::cast (a, seg (v), N(v));
    rep= new Vector_rep (a, N(v), l, is_a_scalar (v), fm);
  }
vector ( const vector< T, W > &  v,
const format< C > &  fm 
) [inline]

Definition at line 132 of file vector.hpp.

                                                  {
    nat l= aligned_size<C,V> (N(v));
    C* a= mmx_formatted_new<C> (l, fm);
    Vec::cast (a, seg (v), N(v));
    rep= new Vector_rep (a, N(v), l, is_a_scalar (v), fm);
  }
vector ( const T c,
nat  n 
) [inline]

Definition at line 139 of file vector.hpp.

                             {
    Format fm= as<Format > (get_format (c));
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, fm);
    Vec::set (a, as<C> (c), n);
    rep= new Vector_rep (a, n, l, true, fm);
  }
vector ( const C x,
nat  n 
) [inline]

Definition at line 146 of file vector.hpp.

                             {
    nat l= aligned_size<C,V> (n);
    C* a= mmx_formatted_new<C> (l, get_format (x));
    Vec::set (a, x, n);
    rep= new Vector_rep (a, n, l, false, get_format (x));
  }
vector ( C a,
nat  n,
const format< C > &  fm 
) [inline]

Definition at line 152 of file vector.hpp.

                                                {
    rep= new Vector_rep (a, n, false, fm);
  }
vector ( C a,
nat  n,
nat  l,
const format< C > &  fm 
) [inline]

Definition at line 155 of file vector.hpp.

                                                       {
    rep= new Vector_rep (a, n, l, false, fm);
  }
vector ( C a,
nat  n,
nat  l,
bool  flag,
const format< C > &  fm 
) [inline]

Definition at line 158 of file vector.hpp.

                                                                  {
    rep= new Vector_rep (a, n, l, flag, fm);
  }
vector ( const iterator< C > &  it) [inline]

Definition at line 161 of file vector.hpp.

                                 {
    Format fm= CF(it);
    nat i, l= Vec::def_len;
    if (l==0) l= aligned_size<C,V> ((nat) 1);
    C* a= mmx_formatted_new<C> (l, fm);
    for (i=0; busy (it); i++, ++it) {
      if (i >= l) {
        C* b= mmx_formatted_new<C> (aligned_size<C,V> (l<<1), fm);
        Vec::copy (b, a, l);
        mmx_delete (a, l);
        a= b;
        l= l<<1;
      }
      a[i]= *it;
    }
    rep= new Vector_rep (a, i, l, false, fm);
  }

Member Function Documentation

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

Definition at line 646 of file vector.hpp.

References mmx::append(), ASSERT, mmx::is_non_scalar(), and n.

                                    {
  ASSERT (is_non_scalar (*this), "non-scalar vector expected");
  secure ();
  nat n= rep->n;
  rep->resize (n+1);
  rep->a[n]= append;
  return *this;
}
vector< C, V > & operator<< ( const vector< C, V > &  w)

Definition at line 656 of file vector.hpp.

References ASSERT, mmx::copy(), mmx::is_non_scalar(), mmx::N(), n, and mmx::seg().

                                    {
  typedef implementation<vector_linear,V> Vec;
  ASSERT (is_non_scalar (*this) && is_non_scalar (w),
          "non-scalar vectors expected");
  secure ();
  nat n= rep->n, p= N(w);
  rep->resize (n + p);
  Vec::copy (rep->a + n, seg (w), p);
  return *this;
}
C& operator[] ( nat  i) [inline]

Definition at line 183 of file vector.hpp.

                                {
    VERIFY (is_non_scalar (*this), "non-scalar vector expected");
    VERIFY (i<N(*this), "index out of range");
    secure(); return rep->a[i]; }
const C& operator[] ( nat  i) const [inline]

Definition at line 179 of file vector.hpp.

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

Definition at line 190 of file vector.hpp.

                      {
    VERIFY (is_a_scalar (*this), "scalar vector expected");
    return rep->a[0]; }
C scalar ( ) const [inline]
nat size ( ) const [inline]

Definition at line 193 of file vector.hpp.

                          {
    return rep->n; }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines