Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

mat::MatrixAdapter< M, T, ScaleT, RegionT > Class Template Reference

#include <matrixadapter.h>

Inheritance diagram for mat::MatrixAdapter< M, T, ScaleT, RegionT >:

Inheritance graph
[legend]
Collaboration diagram for mat::MatrixAdapter< M, T, ScaleT, RegionT >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class M, class T = typename M::value_type, class ScaleT = Scale::Linear<T>, class RegionT = Boundary::AAArbitraryRectangle<double,int>>
class mat::MatrixAdapter< M, T, ScaleT, RegionT >

Adapter that allows you to view an existing matrix as another matrix with arbitrary linear value scaling, width and height extension or reduction, spatial offsetting, etc. as needed.

Increases and decreases in size are not anti-aliased or smoothed, so the result may be blocky. All computation is done as the elements are accessed, and no temporary matrix is used.

One use for this adapter is for plotting a matrix whose values are in an inconvenient range, which you want to situate in a larger or smaller area, or of which you want only a portion.

The value_type of the adapter can be a different type from that of the underlying matrix as long as a suitable conversion exists (e.g. it is valid to have a 'double' adapter for an 'int' matrix). To achieve this, specify the desired value_type as the T template parameter.

Definition at line 41 of file matrixadapter.h.

Public Types

typedef M::size_type size_type
typedef T value_type
typedef ScaleT ScaleType
typedef RegionT Region
typedef int Coordinate

Public Methods

 MatrixAdapter (const M &x, const ScaleType &vscale_i=ScaleType(), const Region &region=Region(), const double &size_multiplier=1.0)
 Constructor for a reference to an external matrix with its own lifetime that is larger than that of this object.

 MatrixAdapter (M *x, const ScaleType &vscale_i=ScaleType(), const Region &region=Region(), const double &size_multiplier=1.0)
 Constructor to a newly-allocated object which will be owned by this object and deleted when this object is destroyed.

value_type operator() (const size_type row, const size_type col) const
 Element access.

size_type nrows () const
 Number of rows in the virtual matrix.

size_type ncols () const
 Number of columns in the virtual matrix.


Protected Methods

bool inbounds (const size_type r, const size_type c) const
 Returns true if the given coordinates are within the matrix.


Protected Attributes

const M & m
MemoryReference< M > allocated
ScaleT vscale
size_type height
size_type width
Coordinate originr
Coordinate originc
double size_divisor


Member Function Documentation

template<class M, class T = typename M::value_type, class ScaleT = Scale::Linear<T>, class RegionT = Boundary::AAArbitraryRectangle<double,int>>
value_type mat::MatrixAdapter< M, T, ScaleT, RegionT >::operator() const size_type    row,
const size_type    col
const [inline]
 

Element access.

Note that the semantics of this call depend on the definitions in matrix.h. That is, if matrix.h is set up to use a 1-based offset for operator(), so will this function (via the MatIndex() call), and otherwise it will used a 0-based offset. That way any MatrixAdapter can be used like a regular matrix defined in matrix.h.

Definition at line 109 of file matrixadapter.h.


The documentation for this class was generated from the following file:
Generated on Mon Jan 20 02:37:37 2003 for RF-LISSOM by doxygen1.3-rc2