18.08.2013 Views

Vega FEM Library (v1.1) User's Manual - University of Southern ...

Vega FEM Library (v1.1) User's Manual - University of Southern ...

Vega FEM Library (v1.1) User's Manual - University of Southern ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.15 matrix<br />

Provides functions to write and read dense matrices to and from a file. The templated functions, where type<br />

real may be float or double, operate on real-typed matrices stored as column-major arrays. If an error<br />

occurs, functions ending in an underscore exit with non-zero status, and functions without an underscore<br />

return a non-zero integer.<br />

int ReadMatrixFromDisk(char* filename, int * m, int * n, real ** matrix)<br />

int ReadMatrixFromDisk (char* filename, int * m, int * n, real ** matrix)<br />

Reads a binary-format matrix from filename into a newly-allocated (malloc) array, writes the pointer<br />

to this array to *matrix, and writes the matrix dimensions to *m and *n. An error occurs if the file reports<br />

a different matrix size or if file IO fails.<br />

int WriteMatrixToDisk(char* filename, int m, int n, real * matrix)<br />

int WriteMatrixToDisk (char* filename, int m, int n, real * matrix)<br />

Writes an m-by-n matrix stored in the array matrix to filename. An error occurs if file IO fails.<br />

int ReadMatrixFromDiskTextFile(char* filename, int * m, int * n, real ** matrix)<br />

int WriteMatrixToDiskTextFile(char* filename, int m, int n, real * matrix)<br />

Read and write matrices similarly to ReadMatrixFromDisk and WriteMatrixToDisk, but encode the<br />

float or double values in text format.<br />

int ReadMatrixFromDiskListOfFiles(char * fileList, int * m, int * n, real ** matrix)<br />

Concatenates the columns <strong>of</strong> the matrices from several (binary-format) matrix files into a single matrix.<br />

The file <strong>of</strong> name fileList is read, and each line <strong>of</strong> the file is assumed to be a matrix filename. Each <strong>of</strong><br />

these matrices must have the same number <strong>of</strong> rows. The resulting concatenation is written to *matrix, and<br />

its dimensions are written to *m and *n.<br />

2.16 minivector<br />

class Vec2d Provides basic functionality for two-dimensional vectors with double-valued coordinates.<br />

Overloads addition and subtraction <strong>of</strong> vectors, scalar (pre- and post-)multiplication and division, equality<br />

testing, [] member access, and

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!