fml  0.1-0
Fused Matrix Library
fml::dimops Namespace Reference

Row/column operations. More...

Enumerations

enum  sweep_op { SWEEP_ADD, SWEEP_SUB, SWEEP_MUL, SWEEP_DIV }
 

Functions

template<typename REAL >
void rowsums (const cpumat< REAL > &x, cpuvec< REAL > &s)
 Compute the row sums. More...
 
template<typename REAL >
void rowmeans (const cpumat< REAL > &x, cpuvec< REAL > &s)
 Compute the row means. More...
 
template<typename REAL >
void colsums (const cpumat< REAL > &x, cpuvec< REAL > &s)
 Compute the column sums. More...
 
template<typename REAL >
void colmeans (const cpumat< REAL > &x, cpuvec< REAL > &s)
 Compute the column means. More...
 
template<typename REAL >
void scale (const bool rm_mean, const bool rm_sd, cpumat< REAL > &x)
 Remove the mean and/or the sd from a matrix. More...
 
template<typename REAL >
void rowsums (const gpumat< REAL > &x, gpuvec< REAL > &s)
 Compute the row sums. More...
 
template<typename REAL >
void rowmeans (const gpumat< REAL > &x, gpuvec< REAL > &s)
 Compute the row means. More...
 
template<typename REAL >
void colsums (const gpumat< REAL > &x, gpuvec< REAL > &s)
 Compute the column sums. More...
 
template<typename REAL >
void colmeans (const gpumat< REAL > &x, gpuvec< REAL > &s)
 Compute the column means. More...
 
template<typename REAL >
void scale (const bool rm_mean, const bool rm_sd, gpumat< REAL > &x)
 Remove the mean and/or the sd from a matrix. More...
 
template<typename REAL >
void rowsums (const mpimat< REAL > &x, cpuvec< REAL > &s)
 Compute the row sums. More...
 
template<typename REAL >
void rowmeans (const mpimat< REAL > &x, cpuvec< REAL > &s)
 Compute the row means. More...
 
template<typename REAL >
void colsums (const mpimat< REAL > &x, cpuvec< REAL > &s)
 Compute the column sums. More...
 
template<typename REAL >
void colmeans (const mpimat< REAL > &x, cpuvec< REAL > &s)
 Compute the column means. More...
 
template<typename REAL >
void scale (const bool rm_mean, const bool rm_sd, mpimat< REAL > &x)
 Remove the mean and/or the sd from a matrix. More...
 

Detailed Description

Row/column operations.

Enumeration Type Documentation

◆ sweep_op

Enumerator
SWEEP_ADD 

Arithmetic operations for dimops::rowsweep() and dimops::colsweep() functions. These operate by either row or column-wise taking a matrix and applying an appropriately sized vector to the entries of that matrix by addition, subtraction, multiplication, or division.

Function Documentation

◆ colmeans() [1/3]

template<typename REAL >
void fml::dimops::colmeans ( const cpumat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the column means.

Parameters
[in]xInput data.
[out]sColumn means.
Template Parameters
REALshould be 'float' or 'double'.

◆ colmeans() [2/3]

template<typename REAL >
void fml::dimops::colmeans ( const gpumat< REAL > &  x,
gpuvec< REAL > &  s 
)

Compute the column means.

Parameters
[in]xInput data.
[out]sColumn means.

Implementation Details
Uses linalg::matmult() on a vector of ones.

Memory Allocations
If the output is inappropriately sized, it will automatically be re-allocated. Additionally, some temporary work storage is needed.

Exceptions
If a (re-)allocation is triggered and fails, a bad_alloc exception will be thrown.

Template Parameters
REALshould be 'float' or 'double'.

◆ colmeans() [3/3]

template<typename REAL >
void fml::dimops::colmeans ( const mpimat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the column means.

Parameters
[in]xInput data.
[out]sColumn means.
Template Parameters
REALshould be 'float' or 'double'.

◆ colsums() [1/3]

template<typename REAL >
void fml::dimops::colsums ( const cpumat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the column sums.

Parameters
[in]xInput data.
[out]sColumn sums.
Template Parameters
REALshould be 'float' or 'double'.

◆ colsums() [2/3]

template<typename REAL >
void fml::dimops::colsums ( const gpumat< REAL > &  x,
gpuvec< REAL > &  s 
)

Compute the column sums.

Parameters
[in]xInput data.
[out]sColumn sums.

Implementation Details
Uses linalg::matmult() on a vector of ones.

Memory Allocations
If the output is inappropriately sized, it will automatically be re-allocated. Additionally, some temporary work storage is needed.

Exceptions
If a (re-)allocation is triggered and fails, a bad_alloc exception will be thrown.

Template Parameters
REALshould be 'float' or 'double'.

◆ colsums() [3/3]

template<typename REAL >
void fml::dimops::colsums ( const mpimat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the column sums.

Parameters
[in]xInput data.
[out]sColumn sums.
Template Parameters
REALshould be 'float' or 'double'.

◆ rowmeans() [1/3]

template<typename REAL >
void fml::dimops::rowmeans ( const cpumat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the row means.

Parameters
[in]xInput data.
[out]sRow means.
Template Parameters
REALshould be 'float' or 'double'.

◆ rowmeans() [2/3]

template<typename REAL >
void fml::dimops::rowmeans ( const gpumat< REAL > &  x,
gpuvec< REAL > &  s 
)

Compute the row means.

Parameters
[in]xInput data.
[out]sRow means.

Implementation Details
Uses linalg::matmult() on a vector of ones.

Memory Allocations
If the output is inappropriately sized, it will automatically be re-allocated. Additionally, some temporary work storage is needed.

Exceptions
If a (re-)allocation is triggered and fails, a bad_alloc exception will be thrown.

Template Parameters
REALshould be 'float' or 'double'.

◆ rowmeans() [3/3]

template<typename REAL >
void fml::dimops::rowmeans ( const mpimat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the row means.

Parameters
[in]xInput data.
[out]sRow means.
Template Parameters
REALshould be 'float' or 'double'.

◆ rowsums() [1/3]

template<typename REAL >
void fml::dimops::rowsums ( const cpumat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the row sums.

Parameters
[in]xInput data.
[out]sRow sums.
Template Parameters
REALshould be 'float' or 'double'.

◆ rowsums() [2/3]

template<typename REAL >
void fml::dimops::rowsums ( const gpumat< REAL > &  x,
gpuvec< REAL > &  s 
)

Compute the row sums.

Parameters
[in]xInput data.
[out]sRow sums.

Implementation Details
Uses linalg::matmult() on a vector of ones.

Memory Allocations
If the output is inappropriately sized, it will automatically be re-allocated. Additionally, some temporary work storage is needed.

Exceptions
If a (re-)allocation is triggered and fails, a bad_alloc exception will be thrown.

Template Parameters
REALshould be 'float' or 'double'.

◆ rowsums() [3/3]

template<typename REAL >
void fml::dimops::rowsums ( const mpimat< REAL > &  x,
cpuvec< REAL > &  s 
)

Compute the row sums.

Parameters
[in]xInput data.
[out]sRow sums.
Template Parameters
REALshould be 'float' or 'double'.

◆ scale() [1/3]

template<typename REAL >
void fml::dimops::scale ( const bool  rm_mean,
const bool  rm_sd,
cpumat< REAL > &  x 
)

Remove the mean and/or the sd from a matrix.

Parameters
[in]rm_meanRemove the column means?
[in]rm_sdRemove the column sds?
[in,out]xData to center/scale.
Template Parameters
REALshould be 'float' or 'double'.

◆ scale() [2/3]

template<typename REAL >
void fml::dimops::scale ( const bool  rm_mean,
const bool  rm_sd,
gpumat< REAL > &  x 
)

Remove the mean and/or the sd from a matrix.

Parameters
[in]rm_meanRemove the column means?
[in]rm_sdRemove the column sds?
[in,out]xData to center/scale.

Memory Allocations
Some temporary work storage is needed to store vectors of means and/or standard deviations, depending on what is requested.

Exceptions
If an allocation fails, a bad_alloc exception will be thrown.

Template Parameters
REALshould be 'float' or 'double'.

◆ scale() [3/3]

template<typename REAL >
void fml::dimops::scale ( const bool  rm_mean,
const bool  rm_sd,
mpimat< REAL > &  x 
)

Remove the mean and/or the sd from a matrix.

Parameters
[in]rm_meanRemove the column means?
[in]rm_sdRemove the column sds?
[in,out]xData to center/scale.
Template Parameters
REALshould be 'float' or 'double'.