Main Page | Modules | Alphabetical List | Class List | Directories | Class Members

Two vectors object


Functions

cpl_bivector * cpl_bivector_new (int n)
 Create a new cpl_bivector.
cpl_bivector * cpl_bivector_wrap_vectors (cpl_vector *x, cpl_vector *y)
 Create a new cpl_bivector from two cpl_vectors.
cpl_bivector * cpl_bivector_duplicate (const cpl_bivector *in)
 Duplicate a cpl_bivector.
void cpl_bivector_delete (cpl_bivector *f)
 Delete a cpl_bivector.
void cpl_bivector_unwrap_vectors (cpl_bivector *f)
 Free memory associated to a cpl_bivector, excluding the two vectors.
void cpl_bivector_dump (const cpl_bivector *f, FILE *stream)
 Dump a cpl_bivector as ASCII to a stream.
cpl_bivector * cpl_bivector_load (const char *filename)
 Read a list of values from an ASCII file and create 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 (const cpl_bivector *in)
 Get a pointer to the x vector of the cpl_bivector.
cpl_vector * cpl_bivector_get_y (const cpl_bivector *in)
 Get a pointer to the y vector of the cpl_bivector.
double * cpl_bivector_get_x_data (const cpl_bivector *in)
 Get a pointer to the x data part of the cpl_bivector.
double * cpl_bivector_get_y_data (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.

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

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
Each element is preceded by its index number (starting with 1!) and written on a single line.

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_load(). 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:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input bivector contains vectors of different sizes

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_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input bivector contains vectors of different sizes

cpl_vector* cpl_bivector_get_x 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
The returned pointer refers to an already created cpl_vector.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

double* cpl_bivector_get_x_data 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_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:
  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

cpl_vector* cpl_bivector_get_y 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
The returned pointer refers to an already created cpl_vector.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

double* cpl_bivector_get_y_data 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_vector_get_x_data
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

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_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DATA_NOT_FOUND if fout is too short
  • CPL_ERROR_ILLEGAL_INPUT if one of the requirements on the 2 input bivectors is not respected.

cpl_bivector* cpl_bivector_load 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 returned object must be deallocated using cpl_bivector_delete()

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

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if the file cannot be read
  • CPL_ERROR_BAD_FILE_FORMAT if the file contains no valid lines

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_ERROR_ILLEGAL_INPUT if n is < 1.

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:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input vectors have different sizes


Generated on Mon Sep 26 14:38:17 2005 for Common Pipeline Library Reference Manual by  doxygen 1.4.1