Matrix Class Reference

#include <matrix.h>

List of all members.


Detailed Description

Data structure for a matrix of doubles.


Public Member Functions

 Matrix ()
 Creates an empty (0x0) matrix.
 Matrix (int rows, int cols)
 Creates a (rows x cols) matrix full of 0s.
int num_rows () const
 Gets the number of rows.
int num_cols () const
 Gets the number of columns.
void Resize (int new_rows, int new_cols)
 Resizes the matrix.
double & at (int row, int col)
 Get a ref to the kernel value at row, col.
double at (int row, int col) const
 Get the kernel value at row, col.
void WriteToStream (ostream &output_stream) const
 Write the matrix to a stream.
void WriteToFile (const char *filename) const
 Write the matrix to a file.
void ReadFromStream (istream &input_stream)
 Replaces all data in this matrix with new data from the stream.
void ReadFromFile (const char *filename)
 Replaces all data in this matrix with new data from the file.


Constructor & Destructor Documentation

Matrix (  )  [inline]

Creates an empty (0x0) matrix.

Matrix ( int  rows,
int  cols 
)

Creates a (rows x cols) matrix full of 0s.


Member Function Documentation

int num_rows (  )  const

Gets the number of rows.

int num_cols (  )  const

Gets the number of columns.

void Resize ( int  new_rows,
int  new_cols 
)

Resizes the matrix.

Warning: this can cause data loss if you are shrinking the matrix. If rows or columns are added, any new elements are 0.

double & at ( int  row,
int  col 
)

Get a ref to the kernel value at row, col.

double at ( int  row,
int  col 
) const

Get the kernel value at row, col.

void WriteToStream ( ostream &  output_stream  )  const

Write the matrix to a stream.

File format:

Aborts if the stream is bad.

void WriteToFile ( const char *  filename  )  const

Write the matrix to a file.

See also:
WriteToStream

void ReadFromStream ( istream &  input_stream  ) 

Replaces all data in this matrix with new data from the stream.

Aborts if the stream is bad. See WriteToStream() for the file format.

See also:
WriteToStream()

void ReadFromFile ( const char *  filename  ) 

Replaces all data in this matrix with new data from the file.

See also:
ReadFromStream


The documentation for this class was generated from the following files:
Generated on Fri Sep 21 11:39:06 2007 for libpmk2 by  doxygen 1.5.1