Classes | Functions

external/matrix_utils.h File Reference

#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <stdint.h>
#include <boost/numeric/ublas/matrix.hpp>
Include dependency graph for matrix_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ms_summary
struct  Abs< T >
 Template class for generic, type-inferred absolute value. More...

Functions

bool isDivisibleBy2 (size_t n, int level)
 True if and only if n is divisible by 2 <level> times.
template<class Matrix >
bool in_bounds (const Matrix &mat, size_t row, size_t col)
bool read_matrix (const char *filename, boost::numeric::ublas::matrix< double > &mat)
template<class Matrix >
void output (const Matrix &mat, std::ostream &out=std::cout)
template<class Matrix >
ms_summary get_summary (const Matrix &orig, const Matrix &repro, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix >
double rmse (const Matrix &orig, const Matrix &repro, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix >
double nrmse (const Matrix &orig, const Matrix &repro, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
 Normalized rms error.
template<class Matrix >
double psnr (const Matrix &orig, const Matrix &repro)
 Peak Signal to Noise Ratio.
template<class Matrix >
double similarity (const Matrix &orig, const Matrix &repro)
 Similarity (NRMSE defined to be symmetric, with max and min taken from both matrices)
template<class Matrix >
void standardize (Matrix &mat)
template<typename T >
abs_val (T num)
 Generic, type-inferred absolute value function.
template<class Matrix >
Matrix::value_type sum (const Matrix &mat, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix >
double mean_val (const Matrix &mat, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix >
Matrix::value_type max_val (const Matrix &mat, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix >
Matrix::value_type min_val (const Matrix &mat, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix >
Matrix::value_type abs_max_val (const Matrix &mat, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<class Matrix , typename V >
void set_all (const Matrix &mat, V value, size_t row_start=0, size_t row_end=std::numeric_limits< size_t >::max(), size_t col_start=0, size_t col_end=std::numeric_limits< size_t >::max())
template<typename Iterator1 , typename Iterator2 >
double manhattan_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2)
template<typename Iterator1 , typename Iterator2 >
double euclidean_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2)
template<class Matrix >
double interp_bilinear (const Matrix &mat, double x, double y)
 Interpolates a value for point (x,y) based on values in the Matrix.

Function Documentation

Matrix::value_type abs_max_val ( const Matrix &  mat,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 265 of file matrix_utils.h.

T abs_val ( num )

Generic, type-inferred absolute value function.

Applies fabs to doubles, labs to longs, etc.

Definition at line 188 of file matrix_utils.h.

double euclidean_distance ( Iterator1  first1,
Iterator1  last1,
Iterator2  first2 
)

Definition at line 313 of file matrix_utils.h.

ms_summary get_summary ( const Matrix &  orig,
const Matrix &  repro,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 62 of file matrix_utils.h.

bool in_bounds ( const Matrix &  mat,
size_t  row,
size_t  col 
)

Definition at line 21 of file matrix_utils.h.

double interp_bilinear ( const Matrix &  mat,
double  x,
double  y 
)

Interpolates a value for point (x,y) based on values in the Matrix.

Finds the nearest values by taking floor and ceil of x and y, then uses bilinear interpolation to estimate the value at (x,y).

Definition at line 331 of file matrix_utils.h.

bool isDivisibleBy2 ( size_t  n,
int  level 
)

True if and only if n is divisible by 2 <level> times.

double manhattan_distance ( Iterator1  first1,
Iterator1  last1,
Iterator2  first2 
)

Definition at line 299 of file matrix_utils.h.

Matrix::value_type max_val ( const Matrix &  mat,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 228 of file matrix_utils.h.

double mean_val ( const Matrix &  mat,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 213 of file matrix_utils.h.

Matrix::value_type min_val ( const Matrix &  mat,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 247 of file matrix_utils.h.

double nrmse ( const Matrix &  orig,
const Matrix &  repro,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Normalized rms error.

Definition at line 110 of file matrix_utils.h.

void output ( const Matrix &  mat,
std::ostream &  out = std::cout 
)

Definition at line 30 of file matrix_utils.h.

double psnr ( const Matrix &  orig,
const Matrix &  repro 
)

Peak Signal to Noise Ratio.

Definition at line 129 of file matrix_utils.h.

bool read_matrix ( const char *  filename,
boost::numeric::ublas::matrix< double > &  mat 
)
double rmse ( const Matrix &  orig,
const Matrix &  repro,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 92 of file matrix_utils.h.

void set_all ( const Matrix &  mat,
value,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 283 of file matrix_utils.h.

double similarity ( const Matrix &  orig,
const Matrix &  repro 
)

Similarity (NRMSE defined to be symmetric, with max and min taken from both matrices)

Definition at line 141 of file matrix_utils.h.

void standardize ( Matrix &  mat )

Definition at line 152 of file matrix_utils.h.

Matrix::value_type sum ( const Matrix &  mat,
size_t  row_start = 0,
size_t  row_end = std::numeric_limits<size_t>::max(),
size_t  col_start = 0,
size_t  col_end = std::numeric_limits<size_t>::max() 
)

Definition at line 195 of file matrix_utils.h.

Muster. Copyright © 2010, Lawrence Livermore National Laboratory, LLNL-CODE-433662.
Distribution of Muster and its documentation is subject to terms of the Muster LICENSE.
Generated on Mon Dec 20 2010 using Doxygen 1.7.2