matrix< C, V > Class Template Reference

#include <matrix.hpp>

List of all members.

Public Member Functions


Detailed Description

template<typename C, typename V = typename matrix_variant_helper< C >::MV>
class mmx::matrix< C, V >

Definition at line 71 of file matrix.hpp.


Constructor & Destructor Documentation

matrix ( const format< C > &  fm = format<C> (no_format ())  )  [inline]

Definition at line 79 of file matrix.hpp.

00079                                                    {
00080     nat nc = Mat::def_rows;
00081     nat nr = Mat::def_cols;
00082     nat l  = aligned_size<C,V> (nr * nc);
00083     C*  tab= mmx_formatted_new<C> (l, fm);
00084     rep= new Matrix_rep (tab, nr, nc, false, fm);
00085   }

matrix ( const T &  c  )  [inline]

Definition at line 88 of file matrix.hpp.

00088                       {
00089     Format fm= get_format (as<C> (c));
00090     nat nr = Mat::init_rows;
00091     nat nc = Mat::init_cols;
00092     nat l  = aligned_size<C,V> (nr * nc);
00093     C*  tab= mmx_formatted_new<C> (l, fm);
00094     rep= new Matrix_rep (tab, nr, nc, true, fm);
00095     Mat::set (rep->a, as<C> (c), nr, nc);
00096   }

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

Definition at line 99 of file matrix.hpp.

00099                                         {
00100     nat nr = Mat::init_rows;
00101     nat nc = Mat::init_cols;
00102     nat l  = aligned_size<C,V> (nr * nc);
00103     C*  tab= mmx_formatted_new<C> (l, fm);
00104     rep= new Matrix_rep (tab, nr, nc, true, fm);
00105     Mat::set (rep->a, as<C> (c), nr, nc);
00106   }

matrix ( const matrix< T, W > &  m  )  [inline]

Definition at line 109 of file matrix.hpp.

00109                                 {
00110     Format fm= as<Format > (CF(m));
00111     nat l= aligned_size<C,V> (rows(m) * cols(m));
00112     C*  t= mmx_formatted_new<C> (l, fm);
00113     rep= new Matrix_rep (t, rows(m), cols(m), is_a_scalar (m), fm);
00114     Vec::cast (rep->a, tab(m), rows(m) * cols(m));
00115   }

matrix ( const matrix< T, W > &  m,
const format< C > &  fm 
) [inline]

Definition at line 118 of file matrix.hpp.

00118                                                   {
00119     nat l= aligned_size<C,V> (rows(m) * cols(m));
00120     C*  t= mmx_formatted_new<C> (l, fm);
00121     rep= new Matrix_rep (t, rows(m), cols(m), is_a_scalar (m), fm);
00122     Vec::cast (rep->a, tab(m), rows(m) * cols(m));
00123   }

matrix ( const C x  )  [inline]

Definition at line 125 of file matrix.hpp.

00125                       {
00126     Format fm= get_format (x);
00127     nat nr = Mat::init_rows;
00128     nat nc = Mat::init_cols;
00129     nat l  = aligned_size<C,V> (nr * nc);
00130     C*  tab= mmx_formatted_new<C> (l, fm);
00131     rep= new Matrix_rep (tab, nr, nc, true, fm);
00132     Mat::set (rep->a, x, nr, nc);
00133   }

matrix ( const C x,
nat  nr,
nat  nc 
) [inline]

Definition at line 135 of file matrix.hpp.

00135                                       {
00136     Format fm= get_format (x);
00137     nat l  = aligned_size<C,V> (nr * nc);
00138     C*  tab= mmx_formatted_new<C> (l, fm);
00139     rep= new Matrix_rep (tab, nr, nc, false, fm);
00140     Mat::set (rep->a, x, nr, nc);
00141   }

matrix ( C tab,
nat  nr,
nat  nc,
const format< C > &  fm 
) [inline]

Definition at line 143 of file matrix.hpp.

00143                                                     {
00144     rep= new Matrix_rep (tab, nr, nc, false, fm);
00145   }

matrix ( C tab,
nat  nr,
nat  nc,
bool  flag,
const format< C > &  fm 
) [inline]

Definition at line 147 of file matrix.hpp.

00147                                                                {
00148     rep= new Matrix_rep (tab, nr, nc, flag, fm);
00149   }

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

Definition at line 151 of file matrix.hpp.

00151                                  {
00152     Format fm= CF(it);
00153     nat i, j, nr= Mat::def_rows, nc= Mat::def_cols;
00154     if (nr==0) nr=1;
00155     nat l  = aligned_size<C,V> (nr * nc);
00156     C*  tab= mmx_formatted_new<C> (l, fm);
00157     for (i=0; i<nr; i++, ++it)
00158       for (j=0; j<nc; j++, ++it)
00159         tab[Mat::index (i, j, nr, nc)]= *it;
00160     rep= new Matrix_rep (tab, nc, nr, false, fm);
00161   }


Member Function Documentation

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

Definition at line 168 of file matrix.hpp.

00168                                        {
00169     VERIFY (is_non_scalar (*this), "non-scalar matrix expected");
00170     VERIFY (i<rep->nr, "row out of range");
00171     VERIFY (j<rep->nc, "column out of range");
00172     return rep->a[Mat::index (i, j, rows (*this), cols(*this))]; }

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

Definition at line 163 of file matrix.hpp.

00163                                                    {
00164     VERIFY (is_non_scalar (*this), "non-scalar matrix expected");
00165     VERIFY (i<rep->nr, "row out of range");
00166     VERIFY (j<rep->nc, "column out of range");
00167     return rep->a[Mat::index (i, j, rows (*this), cols(*this))]; }

C& scalar (  )  [inline]

Definition at line 176 of file matrix.hpp.

00176                       {
00177     VERIFY (is_a_scalar (*this), "scalar matrix expected");
00178     return rep->a[0]; }

C scalar (  )  const [inline]

Definition at line 173 of file matrix.hpp.

Referenced by mmx::binary_map(), mmx::binary_map_scalar(), mmx::binary_test(), mmx::operator*(), mmx::unary_map(), mmx::unary_set(), and mmx::unary_set_scalar().

00173                            {
00174     VERIFY (is_a_scalar (*this), "scalar matrix expected");
00175     return rep->a[0]; }


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

Generated on 6 Dec 2012 for algebramix by  doxygen 1.6.1