Bi-vector object


Functions

void cpl_bivector_delete (cpl_bivector *f)
 Delete a cpl_bivector.
void cpl_bivector_dump (const cpl_bivector *f, FILE *stream)
 Dump a cpl_bivector as ASCII to a stream.
cpl_bivector * cpl_bivector_duplicate (const cpl_bivector *in)
 Duplicate a cpl_bivector.
int cpl_bivector_get_size (const cpl_bivector *in)
 Get the size of the cpl_bivector.
cpl_vector * cpl_bivector_get_x (cpl_bivector *in)
 Get a pointer to the x vector of the cpl_bivector.
const cpl_vector * cpl_bivector_get_x_const (const cpl_bivector *in)
 Get a pointer to the x vector of the cpl_bivector.
double * cpl_bivector_get_x_data (cpl_bivector *in)
 Get a pointer to the x data part of the cpl_bivector.
const double * cpl_bivector_get_x_data_const (const cpl_bivector *in)
 Get a pointer to the x data part of the cpl_bivector.
cpl_vector * cpl_bivector_get_y (cpl_bivector *in)
 Get a pointer to the y vector of the cpl_bivector.
const cpl_vector * cpl_bivector_get_y_const (const cpl_bivector *in)
 Get a pointer to the y vector of the cpl_bivector.
double * cpl_bivector_get_y_data (cpl_bivector *in)
 Get a pointer to the y data part of the cpl_bivector.
const double * cpl_bivector_get_y_data_const (const cpl_bivector *in)
 Get a pointer to the y data part of the cpl_bivector.
cpl_error_code cpl_bivector_interpolate_linear (cpl_bivector *fout, const cpl_bivector *fref)
 Linear interpolation of a 1d-function.
cpl_bivector * cpl_bivector_new (int n)
 Create a new cpl_bivector.
cpl_bivector * cpl_bivector_read (const char *filename)
 Read a list of values from an ASCII file and create a cpl_bivector.
void cpl_bivector_unwrap_vectors (cpl_bivector *f)
 Free memory associated to a cpl_bivector, excluding the two vectors.
cpl_bivector * cpl_bivector_wrap_vectors (cpl_vector *x, cpl_vector *y)
 Create a new cpl_bivector from two cpl_vectors.

Detailed Description

This module provides functions to handle cpl_bivector.

A cpl_bivector is composed of two vectors of the same size. It can be used to store 1d functions, with the x and y positions of the samples, offsets in x and y or simply positions in an image.

This module provides the possibility to compute a local maximum, to cross-correlate two signals, etc...

Synopsis:
   #include "cpl_bivector.h"

Function Documentation

void cpl_bivector_delete ( cpl_bivector *  f  ) 

Delete a cpl_bivector.

Parameters:
f cpl_bivector to delete
Returns:
void
This function deletes a bivector. If the input bivector f is NULL, nothing is done, and no error is set.

void cpl_bivector_dump ( const cpl_bivector *  f,
FILE *  stream 
)

Dump a cpl_bivector as ASCII to a stream.

Parameters:
f Input cpl_bivector to dump or NULL
stream Output stream, accepts stdout or stderr or NULL
Returns:
void
Comment lines start with the hash character.

stream may be NULL in which case stdout is used.

Note:
In principle a cpl_bivector can be saved using cpl_bivector_dump() and re-read using cpl_bivector_read(). This will however introduce significant precision loss due to the limited accuracy of the ASCII representation.

cpl_bivector* cpl_bivector_duplicate ( const cpl_bivector *  in  ) 

Duplicate a cpl_bivector.

Parameters:
in cpl_bivector to duplicate
Returns:
1 newly allocated cpl_bivector or NULL on error
The returned object must be deallocated using cpl_bivector_delete()

Possible _cpl_error_code_ set in this function:

int cpl_bivector_get_size ( const cpl_bivector *  in  ) 

Get the size of the cpl_bivector.

Parameters:
in the input bivector
Returns:
The size or a negative number on error
Possible _cpl_error_code_ set in this function:

cpl_vector* cpl_bivector_get_x ( cpl_bivector *  in  ) 

Get a pointer to the x vector of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the x vector or NULL on error
The returned pointer refers to an already created cpl_vector.

Possible _cpl_error_code_ set in this function:

const cpl_vector* cpl_bivector_get_x_const ( const cpl_bivector *  in  ) 

Get a pointer to the x vector of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the x vector or NULL on error
See also:
cpl_bivector_get_x

double* cpl_bivector_get_x_data ( cpl_bivector *  in  ) 

Get a pointer to the x data part of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the double x array or NULL on error
See also:
cpl_vector_get_data The returned pointer refers to already allocated data.
Note:
Use at your own risk: direct manipulation of vector data rules out any check performed by the vector object interface, and may introduce inconsistencies between the information maintained internally, and the actual vector data and structure.
Possible _cpl_error_code_ set in this function:

const double* cpl_bivector_get_x_data_const ( const cpl_bivector *  in  ) 

Get a pointer to the x data part of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the double x array or NULL on error
See also:
cpl_bivector_get_x_data

cpl_vector* cpl_bivector_get_y ( cpl_bivector *  in  ) 

Get a pointer to the y vector of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the y vector or NULL on error
The returned pointer refers to an already created cpl_vector.

Possible _cpl_error_code_ set in this function:

const cpl_vector* cpl_bivector_get_y_const ( const cpl_bivector *  in  ) 

Get a pointer to the y vector of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the y vector or NULL on error

double* cpl_bivector_get_y_data ( cpl_bivector *  in  ) 

Get a pointer to the y data part of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the double y array or NULL on error
See also:
cpl_vector_get_x_data
Possible _cpl_error_code_ set in this function:

const double* cpl_bivector_get_y_data_const ( const cpl_bivector *  in  ) 

Get a pointer to the y data part of the cpl_bivector.

Parameters:
in a cpl_bivector
Returns:
Pointer to the double y array or NULL on error
See also:
cpl_bivector_get_y_data

cpl_error_code cpl_bivector_interpolate_linear ( cpl_bivector *  fout,
const cpl_bivector *  fref 
)

Linear interpolation of a 1d-function.

Parameters:
fref Reference 1d-function
fout Preallocated 1d-function to contain result
Returns:
CPL_ERROR_NONE or the relevant _cpl_error_code_
fref must have both its abscissa and ordinate defined. fout must have its abscissa defined and its ordinate allocated.

The linear interpolation will be done from the values in fref to the abscissa points in fout.

The abscissa points of both fref and fout must be growing, x_i < x_i+1.

The abscissa points of fout must be in range of those of fref (i.e. extrapolation is not allowed).

fref must be of at least length 2.

Possible _cpl_error_code_ set in this function:

cpl_bivector* cpl_bivector_new ( int  n  ) 

Create a new cpl_bivector.

Parameters:
n Positive number of points
Returns:
1 newly allocated cpl_bivector or NULL on error
The returned object must be deallocated using cpl_bivector_delete() or cpl_bivector_unwrap_vectors(), provided the two cpl_vectors are deallocated separately.

Possible _cpl_error_code_ set in this function:

cpl_bivector* cpl_bivector_read ( const char *  filename  ) 

Read a list of values from an ASCII file and create a cpl_bivector.

Parameters:
filename Name of the input ASCII file
Returns:
1 newly allocated cpl_bivector or NULL on error
See also:
cpl_vector_load
The input ASCII file must contain two values per line.

The returned object must be deallocated using cpl_bivector_delete() Two columns of numbers are expected in the input file.

In addition to normal files, FIFO (see man mknod) are also supported.

Possible _cpl_error_code_ set in this function:

void cpl_bivector_unwrap_vectors ( cpl_bivector *  f  ) 

Free memory associated to a cpl_bivector, excluding the two vectors.

Parameters:
f cpl_bivector to delete
Returns:
void
See also:
cpl_bivector_wrap_vectors

cpl_bivector* cpl_bivector_wrap_vectors ( cpl_vector *  x,
cpl_vector *  y 
)

Create a new cpl_bivector from two cpl_vectors.

Parameters:
x the x cpl_vector
y the y cpl_vector
Returns:
1 cpl_bivector or NULL on error
Note:
The input cpl_vectors must have identical sizes. Afterwards one of those two vectors may be resized, which will corrupt the bivector. Such a corrupted bivector should not be used any more, but rather deallocated, using cpl_bivector_unwrap_vectors() or cpl_bivector_delete().
The returned object must be deallocated using cpl_bivector_delete() or with cpl_bivector_unwrap_vectors(), provided the two cpl_vectors are deallocated separately.

Possible _cpl_error_code_ set in this function:


Generated on Wed Mar 18 09:40:12 2009 for Common Pipeline Library Reference Manual by  doxygen 1.4.7