mtx Class Reference

mtx class More...

#include <mtx/mtx.h>

Inheritance diagram for mtx:

Inheritance graph
[legend]
Collaboration diagram for mtx:

Collaboration graph
[legend]

List of all members.

Public Types

typedef mtx_base< data_holderBase
typedef index_iterator_base
< mtx_base, double > 
iterator
typedef index_iterator_base
< const mtx_base, const double > 
const_iterator
typedef colmaj_iterator_base
< double > 
colmaj_iter
typedef colmaj_iterator_base
< const double > 
const_colmaj_iter
typedef rowmaj_iterator_base
< double > 
rowmaj_iter
typedef rowmaj_iterator_base
< const double > 
const_rowmaj_iter
enum  init_policy { ZEROS, NO_INIT }
enum  storage_policy { COPY, BORROW, REFER }

Public Member Functions

 mtx (const mtx_specs &specs, const data_holder &data)
 mtx (const slice &s)
 mtx (const mtx &other)
mtxoperator= (const mtx &other)
void resize (int mrows_new, int ncols_new)
mtx contig () const
data_holderget_data_holder ()
void print (std::ostream &s, const char *mtx_name="") const
 Print the mtx to the given ostream, including the matrix name if non-empty.
void print_stdout () const
 Print the mtx to stdout.
void print_stdout_named (const char *mtx_name) const
 Print the mtx to stdout along with a name for the mtx.
rutz::fstring as_string () const
 Convert the mtx to a string, by printing it to a string stream.
void scan (std::istream &s)
 Read the mtx from the given istream.
void scan_string (const char *s)
 Read the mtx from the given string.
double & at (int row, int col)
const double & at (int row, int col) const
double & at (int elem)
const double & at (int elem) const
bool same_size (const mtx &x) const
sub_mtx_ref sub (const row_index_range &rng)
sub_mtx_ref sub (const col_index_range &rng)
sub_mtx_ref sub (const row_index_range &rr, const col_index_range &cc)
mtx sub (const row_index_range &rng) const
mtx sub (const col_index_range &rng) const
mtx sub (const row_index_range &rr, const col_index_range &cc) const
mtx operator() (const row_index_range &rng) const
mtx operator() (const col_index_range &rng) const
mtx operator() (const row_index_range &rr, const col_index_range &cc) const
mtx as_shape (const mtx_shape &s) const
mtx as_shape (int mr, int nc) const
slice row (int r) const
mtx_iter row_iter (int r)
mtx_const_iter row_iter (int r) const
mtx as_row () const
void reorder_rows (const mtx &index)
slice column (int c) const
mtx_iter column_iter (int c)
mtx_const_iter column_iter (int c) const
mtx as_column () const
void reorder_columns (const mtx &index)
void swap_columns (int c1, int c2)
mtx mean_row () const
mtx mean_column () const
const_iterator find_min () const
const_iterator find_max () const
double min () const
double max () const
double sum () const
double mean () const
mtxoperator+= (double x)
mtxoperator-= (double x)
mtxoperator*= (double fac)
mtxoperator/= (double div)
mtxoperator+= (const mtx &other)
mtxoperator-= (const mtx &other)
bool operator== (const mtx &other) const
bool operator!= (const mtx &other) const
void assign_MMmul (const mtx &m1, const mtx &m2)
void make_unique ()
void swap (mtx_specs &other)
int offset_from_storage (int elem) const
const mtx_shapeshape () const
const mtx_specsspecs () const
double & at_nc (int i)
void apply (F func)
iterator begin_nc ()
iterator end_nc ()
const_iterator begin () const
const_iterator end () const
colmaj_iter colmaj_begin_nc ()
colmaj_iter colmaj_end_nc ()
const_colmaj_iter colmaj_begin () const
const_colmaj_iter colmaj_end () const
rowmaj_iter rowmaj_begin_nc ()
rowmaj_iter rowmaj_end_nc ()
const_rowmaj_iter rowmaj_begin () const
const_rowmaj_iter rowmaj_end () const
void clear (double x=0.0)
void select_rows (const row_index_range &rng)
void select_cols (const col_index_range &rng)
mtx_specs sub_rows (const row_index_range &rng) const
mtx_specs sub_cols (const col_index_range &rng) const
ptrdiff_t offset () const
int max_dim () const
int nelems () const
int mrows () const
int rowstride () const
int ncols () const
int colstride () const
unsigned int rowgap () const
int offset_from_start (int row, int col) const
int offset_from_start (int elem) const

Static Public Member Functions

static const mtxempty_mtx ()
static mtx colmaj_copy_of (const double *data, int mrows, int ncols)
 Set up a mtx with a storage policy of COPY.
static mtx colmaj_borrow_from (double *data, int mrows, int ncols)
 Set up a mtx with a storage_policy of BORROW.
static mtx colmaj_refer_to (double *data, int mrows, int ncols)
 Set up a mtx with a storage_policy of REFER.
static mtx zeros (const mtx_shape &s)
static mtx uninitialized (const mtx_shape &s)
static mtx zeros (int mrows, int ncols)
static mtx uninitialized (int mrows, int ncols)
static mtx from_stream (std::istream &s)
static mtx from_string (const char *s)
static void VMmul_assign (const slice &vec, const mtx &mtx, slice &result)

Protected Member Functions

void swap (mtx_base &other)
ptrdiff_t offset_from_storage (int r, int c) const
double * address_nc (int row, int col)
const double * address (int row, int col) const
ptrdiff_t end_offset_from_storage (int r, int c) const
double * end_address_nc (int row, int col)
const double * end_address (int row, int col) const
const double * storage () const
double * storage_nc ()

Protected Attributes

data_holder m_data

Friends

class slice


Detailed Description

mtx class

Definition at line 824 of file mtx.h.


Member Function Documentation

mtx mtx::contig (  )  const

Makes sure that the data are in contiguous storage; if called on a submatrix, contig() will make a new matrix of the proper size and copy the elements there; otherwise, it will just return the current matrix.

Definition at line 643 of file mtx.cc.

References mtx_base< Data >::colmaj_begin_nc().


The documentation for this class was generated from the following files:

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:55:36 2008 by Doxygen version 1.5.5.