MatrixSummer< T, I > Struct Template Reference

MatrixSummer objects store partial sums of a matrix, allowing quick computation of sum of any rectangle in the matrix. More...

#include <matrixUtil.h>

Inheritance diagram for MatrixSummer< T, I >:

Inheritance graph
[legend]

List of all members.

Public Member Functions

bool isValid () const
 Returns whether the object is filled with data.
void free ()
 Clears the object.
Result getSum (I x0, I y0, I xend, I yend) const
 Computes the sum of a rectangle (in constant time).
Result getSum (const Block &b) const
 A shortcut to get the sum of a block.
template<class Input >
void fill (Input inp, I width, I height)
 Prepares object to make sums for a matrix.

Public Attributes

MatrixSlice< T, I > sums
 Internal matrix containing precomputed partial sums.


Detailed Description

template<class T, class I = PtrInt>
struct MatrixSummer< T, I >

MatrixSummer objects store partial sums of a matrix, allowing quick computation of sum of any rectangle in the matrix.

It's parametrized by "type of the result", "type of the input" and "indexing type" (defaults to Int). Uses shallow copying.

Definition at line 113 of file matrixUtil.h.


Member Function Documentation

template<class T, class I = PtrInt>
template<class Input >
void MatrixSummer< T, I >::fill ( Input  inp,
width,
height 
) [inline]

Prepares object to make sums for a matrix.

If the summer has already been used before, the method assumes it was for a matrix of the same size

Definition at line 134 of file matrixUtil.h.


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

Generated on Thu Aug 6 22:33:14 2009 for Fractal Image Compressor by  doxygen 1.5.8