#include <matrix.h>
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. |
Matrix | ( | ) | [inline] |
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.
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:
void WriteToFile | ( | const char * | filename | ) | const |
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.
void ReadFromFile | ( | const char * | filename | ) |