packed<int MemLoc=internal> [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:containers,selectors Component type:type
Description
This storage type is equivalent to the BLAS/LAPACK packed storage format. The packed storage format is similar to the banded format, except that the storage for each row/column of the band is variable so there is no wasted space. This is better for efficiently storing triangular matrices.
 [  1   2   3   4   5  ]
 [  0   6   7   8   9  ]
 [  0   0  10  11  12  ]
 [  0   0   0  13  14  ]
 [  0   0   0   0  15  ]

 [  1   2   3   4   5  ]
 [  6   7   8   9  ]
 [  10  11  12  ]
 [  13  14  ]
 [  15  ]

 mapped to linear memory with row-major order:

 [  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ]
 
Example
In tri_pack_vect.cc:
  typedef matrix< double, 
                  triangle<lower>, 
                  packed<external>, 
                  column_major >::type Matrix; 
  typedef dense1D<double> Vector;
  //         1               3
  //     A = 2  4       x =  2
  //         3  5  6         1
  const Matrix::size_type N = 3;
  double dA[] = { 1, 2, 3, 4, 5, 6 };
  Matrix A(dA, N, N);
  Vector x(N), Ax(N);
  for (unsigned int i = 0; i < N; ++i)
    x[i] = 3-i;
  mult(A, x, Ax);

Definition
Template Parameters

ParameterDescriptionDefault
MemLocSpecify whether the memory used is "owned" by the matrix or if it was provided to the matrix from some external source (with a pointer to some data) internal
Model of
Members
Member Where defined Description
size_type    
enum { id = PACKED, oned_id, ext=MemLoc, issparse=0, index }    
New members
Notes
See also

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