lmat2viff(3)

LIBRARY ROUTINE
lmat2viff - converts a matrix to an image

LIBRARY CALL
#include "vinclude.h"
int lmat2viff(image,filename)
  struct xvimage **image;
  char *filename;

INPUT

image
    pointer to VIFF structure containing image data to be processed.

procdir
    process direction: 0 indicated vector oriented processing, 1 indicates band oriented processing.

OUTPUT

image
    pointer to VIFF structure containing image data after processing.

Return Value:
    1 on success, 0 on failure.

MODIFICATIONS

B. Martensson and J. Worley 9 Aug  1991 10:52 MDT
    explicitly set matrix to null so that readmatrix does not get confused.

Jeremy Worley 19 Mar 1992 17:32 MST
    changed code so that transport stuff in vgparm was used instead of FILE oriented operations.

DESCRIPTION
The lmat2viff routine will read a single matrix from the file specified and place it in an image structure. It expects to see all comments prefixed by a pound ('#') sign. Anything following this symbol on the same line will be ignored. Matrices are expected to be preceeded by either an open bracket ('[') or a "less than" symbol ('<') and succeeded by a close bracket (']') or a "greater than" symbol ('>'). For example:

        [ 4.0 3.0 2.0 1.0 ]

Specifies a single row matrix with 4 elements.

Each row, with the exception of the final row, of the matrix is expected to be delimited by a semicolon (';'). For example:

        [ 4.0 3.0 2.0 1.0 ;
          3.0 2.0 1.0 0.0 ]

The above example specifies a two row matrix. Each row contains four elements. Carraige returns are insignificant. The matrix above could be equivelantly input as:

        [ 4.0 3.0 2.0 1.0 ; 3.0 2.0 1.0 0.0 ]

or as:

        [ 4.0 3.0 2.0
          1.0 ; 3.0 2.0
          1.0
          0.0
        ]

Complex numbers are entered by enclosing them in parentheses ('()') and separating their real and imaginary parts by a comma (','). For example:

        [ (4.0,3.0) ; (-3.0,2.0) ]

If a complete row is not specified (i.e. not enough row elements to complete a row), then the row will be zero padded. For example:

        [ 3.0 2.0 1.0 ; 3.0 -1.0 ;; 1.0 2.0 4 ]

is equivelant to:

        [ 3.0  2.0  1.0 ;
          3.0 -1.0  0.0 ;
          0.0  0.0  0.0 ;
          1.0  2.0  4.0 ]

The only major limitation of the current implementation is that the first row should contain the maximum number of elements that a row will have in the entire matrix explicitly specified. Failure to comply with this limitation will result in illogical, erroneous, and ridiculous results.

SEE ALSO
mat2viff(1), intro(3), vipl(3), verror(3), vutils(3)

RESTRICTIONS

AUTHOR
Jeremy Worley

COPYRIGHT
Copyright 1992, University of New Mexico. All rights reserved.