Anasazi Version of the Day
Public Member Functions
TSQR::CacheBlocker< Ordinal, Scalar > Class Template Reference

#include <Tsqr_CacheBlocker.hpp>

List of all members.

Public Member Functions

 CacheBlocker (const Ordinal num_rows, const Ordinal num_cols, const CacheBlockingStrategy< Ordinal, Scalar > &strategy)
 CacheBlocker (const CacheBlocker &rhs)
 Copy constructor.
CacheBlockeroperator= (const CacheBlocker &rhs)
 Assignment operator.
size_t cache_block_size () const
 Cache block size in bytes.
Ordinal nrows () const
 Number of rows in the matrix corresponding to the cache blocking scheme.
Ordinal ncols () const
 Number of columns in the matrix corresponding to the cache blocking scheme.
template<class MatrixViewType >
MatrixViewType split_top_block (MatrixViewType &A, const bool contiguous_cache_blocks) const
template<class MatrixViewType >
MatrixViewType top_block (const MatrixViewType &A, const bool contiguous_cache_blocks) const
template<class MatrixViewType >
void fill_with_zeros (MatrixViewType A, const bool contiguous_cache_blocks) const
void cache_block (const Ordinal num_rows, const Ordinal num_cols, Scalar A_out[], const Scalar A_in[], const Ordinal lda_in) const
 Cache-block the given A_in matrix into A_out.
void un_cache_block (const Ordinal num_rows, const Ordinal num_cols, Scalar A_out[], const Ordinal lda_out, const Scalar A_in[]) const

Detailed Description

template<class Ordinal, class Scalar>
class TSQR::CacheBlocker< Ordinal, Scalar >

A CacheBlocker uses a particular cache blocking strategy ("class CBS") to know how to separate an nrows by ncols matrix into cache blocks, which in this case are row blocks. We can use this strategy to cache block any matrix of nrows rows, using the same distribution of rows to blocks, regardless of whether that latter matrix has a different number of columns than ncols.

Definition at line 64 of file Tsqr_CacheBlocker.hpp.


Constructor & Destructor Documentation

template<class Ordinal , class Scalar >
TSQR::CacheBlocker< Ordinal, Scalar >::CacheBlocker ( const Ordinal  num_rows,
const Ordinal  num_cols,
const CacheBlockingStrategy< Ordinal, Scalar > &  strategy 
) [inline]

Constructor

Parameters:
num_rowsNumber of rows in the matrix corresponding to the cache blocking scheme
num_colsNumber of columns in the matrix corresponding to the cache blocking scheme
strategyCache blocking strategy object

Definition at line 90 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
TSQR::CacheBlocker< Ordinal, Scalar >::CacheBlocker ( const CacheBlocker< Ordinal, Scalar > &  rhs) [inline]

Copy constructor.

Definition at line 115 of file Tsqr_CacheBlocker.hpp.


Member Function Documentation

template<class Ordinal , class Scalar >
CacheBlocker& TSQR::CacheBlocker< Ordinal, Scalar >::operator= ( const CacheBlocker< Ordinal, Scalar > &  rhs) [inline]

Assignment operator.

Definition at line 122 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
size_t TSQR::CacheBlocker< Ordinal, Scalar >::cache_block_size ( ) const [inline]

Cache block size in bytes.

Definition at line 130 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
Ordinal TSQR::CacheBlocker< Ordinal, Scalar >::nrows ( ) const [inline]

Number of rows in the matrix corresponding to the cache blocking scheme.

Definition at line 133 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
Ordinal TSQR::CacheBlocker< Ordinal, Scalar >::ncols ( ) const [inline]

Number of columns in the matrix corresponding to the cache blocking scheme.

Definition at line 136 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
template<class MatrixViewType >
MatrixViewType TSQR::CacheBlocker< Ordinal, Scalar >::split_top_block ( MatrixViewType &  A,
const bool  contiguous_cache_blocks 
) const [inline]

Return the topmost cache block of A, where the number of rows in each cache block is chosen according to the number of columns with which this CacheBlocker was set up (rather than the number of columns in A, which may not be the same). The idea is to have the number and distribution of rows in the cache blocks be the same as the original nrows() by ncols() matrix with which this CacheBlocker was initialized.

Definition at line 147 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
template<class MatrixViewType >
MatrixViewType TSQR::CacheBlocker< Ordinal, Scalar >::top_block ( const MatrixViewType &  A,
const bool  contiguous_cache_blocks 
) const [inline]

Return the topmost cache block of A. A is copied so it won't be modified.

Definition at line 161 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
template<class MatrixViewType >
void TSQR::CacheBlocker< Ordinal, Scalar >::fill_with_zeros ( MatrixViewType  A,
const bool  contiguous_cache_blocks 
) const [inline]

Fill the entries of A with Scalar(0).

Note:
This method only works if MatrixViewType has a method "fill(const Scalar)" or "fill(const Scalar&)". The intention is that the method be non-const and that it fill in the entries of the matrix with Scalar(0), though syntactically the method could even be const and / or do something else entirely.

Definition at line 193 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
void TSQR::CacheBlocker< Ordinal, Scalar >::cache_block ( const Ordinal  num_rows,
const Ordinal  num_cols,
Scalar  A_out[],
const Scalar  A_in[],
const Ordinal  lda_in 
) const [inline]

Cache-block the given A_in matrix into A_out.

Given an nrows by ncols (with nrows >= ncols) matrix A_in, stored in column-major order with leading dimension lda_in (>= nrows), copy it into A_out in a cache-blocked row block format. Each cache block is a matrix in column-major order, and the elements of a cache block are stored consecutively in A_out. The number of rows in each cache block depends on the cache-blocking strategy that this CacheBlocker uses.

Parameters:
num_rows[in] Total number of rows in the matrices A_in and A_out
num_cols[in] Number of columns in the matrices A_in and A_out
A_out[out] nrows*ncols contiguous storage into which to write the cache-blocked output matrix.
A_in[in] nrows by ncols matrix, stored in column-major order with leading dimension lda_in >= nrows
lda_in[in] Leading dimension of the matrix A_in

Definition at line 227 of file Tsqr_CacheBlocker.hpp.

template<class Ordinal , class Scalar >
void TSQR::CacheBlocker< Ordinal, Scalar >::un_cache_block ( const Ordinal  num_rows,
const Ordinal  num_cols,
Scalar  A_out[],
const Ordinal  lda_out,
const Scalar  A_in[] 
) const [inline]

"Un"-cache-block the given A_in matrix, writing the results to A_out.

Definition at line 260 of file Tsqr_CacheBlocker.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends