#include <matrixadapter.h>
Inheritance diagram for mat::MatrixAdapter< M, T, ScaleT, RegionT >:
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 ®ion=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 ®ion=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 |
|
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. |