array2D<OneD_> [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:containers Component type:type
Description
This is the model of TwoDStorage that implements the array storage format. array2D is actually implemented with a Container of 1-D Containers (whereas the other TwoDStorage types just act like Containers of Containers). In this way the array2D storage type is the most flexible, since many different types of 1-D containers can be used in conjunction with this class. The 1-D containers include linked_list (sparse1D), tree (sparse1D), dense (std::vector), sparse_pair (sparse1D), and compressed (mtl::compressed1D). One special feature of the array2D is that one can swap and assign the Vectors inside the array in constant time, as mentioned in the array interface description. The backbone container of the array2D is not implemented with std::vector due to some subtle interactions between copy/default constructors and handle objects. JGS, bad to have this dependence
Example
In array2D.cc:
  typedef matrix< double, 
                  rectangle<>, 
                  array< dense<> >, 
                  row_major>::type MatA;

  typedef matrix< double, 
                  rectangle<>, 
                  array< compressed<> >, 
                  row_major>::type MatB;

  typedef matrix< double, 
                  rectangle<>, 
                  array< sparse_pair >, 
                  row_major>::type MatC;
  cout << "start" << endl;
  MatA A(M,N);
  MatB B(M,N);
  MatC C(M, N);
  // Fill A ...
  mtl::copy(A, B); // JGS, this is broken!
#if 0
  MatB::Row tmp = B[2];
  B[2] = B[3];
  B[3] = tmp;

  mtl::copy(B, C);

Definition
array2D.h
Template Parameters

ParameterDescriptionDefault
OneDthe one dimensional container the array is composed of 
Model of
TwoDStorage
Members
Member Where defined Description
template <class SubMatrix>
struct partitioned
   
transpose_type    
submatrix_type    
banded_view_type    
submatrix_type    
banded_view_type    
OneD    
OneDRef    
ConstOneDRef    
storage_loc    
sparsity    
strideability    
value_type   The 1D container type
reference   A reference to the value type
const_reference   A const reference to the value type
size_type   The integral type for dimensions and indices
iterator   The iterator type
const_iterator   The const iterator type
const_iterator   The const iterator type
reverse_iterator   The reverse iterator type
const_reverse_iterator   The const reverse iterator type
dim_type   A pair type for the dimension
band_type   A pair type for the bandwidth
array2D ()   Default Constructor
array2D (dim_type d, size_type start_index = 0)   Normal Constructor
array2D (dim_type d, band_type band, size_type start_index = 0)   Banded Constructor
template <class TwoD>
array2D (const TwoD& x, band_type, banded_tag)
  sparse banded view constructor
template <class MatrixStream, class Orien>
array2D (MatrixStream& s, Orien)
  Matrix Stream Constructor
template <class MatrixStream, class Orien>
array2D (MatrixStream& s, Orien, band_type bw)
  Banded Matrix Stream Constructor
array2D (const self& x)   Copy Constructor (shallow)
iterator begin ()   Return an iterator pointing to the first 1D container
iterator end ()   Return an iterator pointing past the end of the 2D container
const_iterator begin () const   Return a const iterator pointing to the first 1D container
const_iterator end () const   Return a const iterator pointing past the end of the 2D container
reverse_iterator rbegin ()   Return a reverse iterator pointing to the last 1D container
reverse_iterator rend ()   Return a reverse iterator pointing past the start of the 2D container
const_reverse_iterator rbegin () const   Return a const reverse iterator pointing to the last 1D container
const_reverse_iterator rend () const   Return a const reverse iterator pointing past the start of the 2D container
OneD_reference operator () (size_type i, size_type j)   Return a reference to the (i,j) element, where (i,j) is in the 2D coordinate system
OneD_const_reference operator () (size_type i, size_type j) const   Return a const reference to the (i,j) element, where (i,j) is in the 2D coordinate system
OneDRef operator [] (size_type i)   Return a reference to the ith 1D container
ConstOneDRef operator [] (size_type i) const   Return a const reference to the ith 1D container
size_type major () const   The dimension of the 2D container
size_type minor () const   The dimension of the 1D containers
size_type nnz () const   The number of non-zeros
size_type capacity () const   Capacity
void print () const    
size_type first_index () const    
template <class Matrix>
void fast_copy (const Matrix& x)
  A faster specialization for copying
New members
Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.