Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

matrect.h File Reference

Double-precision rectangular matrix module. More...

#include <stdlib.h>
#include <stdio.h>

Include dependency graph for matrect.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct  Matrect_
 Matrect_: a struct storing a rectangular double matrix. More...


Functions

void init_matrect (Matrect_ *M, unsigned int Rno, unsigned int Cno)
 init_matrect(M, Rno, Cno): Sets up the matrix *M to contain Rno rows and Cno columns. More...

void array_matrect (Matrect_ *M, const double *Array)
 array_matrect(M, Array): Assumes that Array contains a matrix in row major order and copies its contents into M. More...

void resize_matrect (Matrect_ *M, unsigned int Newrno, unsigned int Newcno)
 resize_matrect(M, Newrno, Newcno): changes the size of *M so that Newrno rows and Newcno columns can be stored. More...

void copy_matrect (const Matrect_ *From, Matrect_ *To)
 copy_matrect(From, To): Copies the contents of *From to *To. More...

int read_matrect (FILE *In, Matrect_ *M)
 read_matrect(In, M): reads a matrix from the file In into *M. More...

void write_matrect (FILE *Out, const Matrect_ *M, int Prec)
 write_matrect(Out, M, Linewidth, Width, Prec): lists M to the open stream Out with entries in scientific format, Prec digits precision. More...

void free_matrect (Matrect_ *M)
 free_matrect(M): frees up all storage associated with *M. More...


Detailed Description

Double-precision rectangular matrix module.

Supports safe creation, destruction, copy, resize, input/output.

Definition in file matrect.h.


Function Documentation

void init_matrect ( Matrect_ * M,
unsigned int Rno,
unsigned int Cno )
 

init_matrect(M, Rno, Cno): Sets up the matrix *M to contain Rno rows and Cno columns.

If Rno==0 or Cno==0 then they will be set to 1. This must be the first operation performed on a Matrect_ struct. Disaster strikes if *M is initialised more than once.

Referenced by Matrect_::Rlen().

void array_matrect ( Matrect_ * M,
const double * Array )
 

array_matrect(M, Array): Assumes that Array contains a matrix in row major order and copies its contents into M.

It is your responsibility to make sure that Array has the right size and the appropriate layout. This routine assumes no responsibility and performs no dim checks. M must have been initialised and set to the desired size before calling this routine. The only support you can expect that nothing is done if either of the parameters is NULL.

Referenced by Matrect_::Rlen().

void resize_matrect ( Matrect_ * M,
unsigned int Newrno,
unsigned int Newcno )
 

resize_matrect(M, Newrno, Newcno): changes the size of *M so that Newrno rows and Newcno columns can be stored.

Does nothing if the dimensions are the same as before. If *M was empty then it will be initialised. Newly added rows/cols will be initialised to 0.0. If Newrno or Newcno are 0, then they will be set to 1.

Referenced by Matrect_::Rlen().

void copy_matrect ( const Matrect_ * From,
Matrect_ * To )
 

copy_matrect(From, To): Copies the contents of *From to *To.

*To will be initialised and/or resized if necessary.

Referenced by Matrect_::Rlen().

int read_matrect ( FILE * In,
Matrect_ * M )
 

read_matrect(In, M): reads a matrix from the file In into *M.

Format is the "nice format" produced by write_matrect(). Returns 0 on error, the number of lines processed otherwise.

Referenced by Matrect_::Rlen().

void write_matrect ( FILE * Out,
const Matrect_ * M,
int Prec )
 

write_matrect(Out, M, Linewidth, Width, Prec): lists M to the open stream Out with entries in scientific format, Prec digits precision.

If a row takes up more than 80 chars, then the matrix is cut up nicely.

Referenced by Matrect_::Rlen().

void free_matrect ( Matrect_ * M )
 

free_matrect(M): frees up all storage associated with *M.

*M will be kept, it will be set to an invalid empty state. This must be the last operation performed on a Matrect_ struct.

Referenced by Matrect_::Rlen().


Generated at Wed Aug 21 09:33:46 2002 for The Razorback C library: Linear Algebra by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001