wvMatrix(3) USC Math Department
Back to wvlib matrix function index
wvMatrix(3)

Name

wvNewMatrix, wvDestroyMatrix - matrix functions

Synopsis

#include <wv/matrix.h>

WVmatrix *wvNewMatrix(const WVindexVector *size);

void wvDestroyMatrix(WVmatrix *matrix);

Description

wvNewMatrix returns a matrix of size. The matrix is initialized to be a zero matrix.

wvDestroyMatrix frees the memory used by matrix. It is the application programmer's responsibility to free this memory (by calling this function).

WVmatrix is defined in <wv/matrix.h> as:

  typedef struct _WVmatrix {
      WVindexVector *size;
      WVindexVector *bufSize;
      WVdata        *buf;
      wvBool         ownBuf;
  } WVmatrix;

Example

#include <wv/matrix.h>
  
    .
    .
    .
{
    WVindexVector *size;
    WVmatrix *mat;

    size = wvVaNewIndexVector(2, 256, 512);
    mat  = wvNewMatrix(size);

    .
    .
    .

    wvDestroyMatrix(mat);
    wvDestroyIndexVector(size);
}

See Also

wvMatrixClear(3), wvMatrixElt(3), wvMatrixForEachElt(3), wvMatrixGetDimensionality(3), wvMatrixSize(3), wvNewIndexVector(3), wvNewMatrixShareArray(3)

Diagnostics

A NULL pointer is returned if the request cannot be completed (usually indicating that the process has run out of memory).

Back to wvlib matrix function index Last Updated: 02 February 1999