ifw-odp 5.0.0
Loading...
Searching...
No Matches
clipm_priv_vector.c File Reference
#include "ifw/odp/clipm/clipm_priv_vector.h"
#include "ifw/odp/clipm/clipm_math.h"
#include "ifw/odp/clipm/clipm_compatibility_replacements.h"
#include "ifw/odp/clipm/clipm_priv_error.h"
#include <string.h>

Functions

double clipm_priv_vector_get_min (const cpl_vector *v, cpl_size *index)
 Return minimum and corresponding index of a vector.
 
double clipm_priv_vector_get_max (const cpl_vector *v, cpl_size *index)
 Return maximum and corresponding index of a vector.
 
cpl_vector * clipm_priv_vector_expand (const cpl_vector *v, cpl_size prepend_nr, cpl_size append_nr)
 Prepend and append borderwidth 0-elements to v, respectively.
 
cpl_vector * clipm_priv_vector_integrate (const cpl_vector *v)
 Integrate a signal stored in a vector.
 
cpl_vector * clipm_priv_vector_differentiate (const cpl_vector *v)
 Differentiate a signal stored in a vector.
 
cpl_vector * clipm_priv_vector_get_normal (const cpl_vector **dv)
 Get the n-dimensional normal vector to n-1 direction vectors.
 
void clipm_priv_vector_null (cpl_vector **v)
 Delete a CPL vector object and set the pointer to NULL.
 

Function Documentation

◆ clipm_priv_vector_differentiate()

cpl_vector * clipm_priv_vector_differentiate ( const cpl_vector * v)

Differentiate a signal stored in a vector.

Parameters
vInput vector
Returns
The minimum value, 0 in the case of error
Error Handling:
Possible error code set by this function:
  • CPL_ERROR_NULL_INPUT: v is NULL

outdata = indata[0] - indata[-1];

◆ clipm_priv_vector_expand()

cpl_vector * clipm_priv_vector_expand ( const cpl_vector * v,
cpl_size prepend_nr,
cpl_size append_nr )

Prepend and append borderwidth 0-elements to v, respectively.

Parameters
vInput vector
prepend_nrNumber of elements that are going to be prepended at the beginning of v
append_nrNumber of elements that are going to be appended to the end of v
Returns
Resulting vector, NULL in the case of error
Error Handling:
The following error codes can be set:
  • CPL_ERROR_NULL_INPUT: v is NULL
  • CPL_ERROR_ILLEGAL_INPUT: prepend_nr < 0 or append_nr < 0

◆ clipm_priv_vector_get_max()

double clipm_priv_vector_get_max ( const cpl_vector * v,
cpl_size * index )

Return maximum and corresponding index of a vector.

Parameters
vInput vector
indexOutput index, where the maximum has been found, can be NULL, returns -1 in the case of error
Returns
The maximum value, 0 in the case of error
Error Handling:
Possible error code set by this function:
  • CPL_ERROR_NULL_INPUT: v is NULL

◆ clipm_priv_vector_get_min()

double clipm_priv_vector_get_min ( const cpl_vector * v,
cpl_size * index )

Return minimum and corresponding index of a vector.

Parameters
vInput vector
indexOutput index, where the minimum has been found, can be NULL, returns -1 in the case of error
Returns
The minimum value, 0 in the case of error
Error Handling:
Possible error code set by this function:
  • CPL_ERROR_NULL_INPUT: v is NULL

◆ clipm_priv_vector_get_normal()

cpl_vector * clipm_priv_vector_get_normal ( const cpl_vector ** dv)

Get the n-dimensional normal vector to n-1 direction vectors.

Parameters
dvArray of n-1 direction vectors
Returns
Normal vector, NULL in the case of error
Overview:
  • The number of vectors in dv must be n-1, where n is the length of the vectors. All vectors must have the same length.
  • The number of dimensions must be at least 2.
  • The number of dimensions n is determined from the first vector in dv.
Mathematical Meaning:
  • The result vector is also referred to in literature as $n = dv_1 \times dv_2 \times \ldots \times dv_{ndims-1}$.
  • The norm of the result vector equals the (n-1)-dimensional volume of the parallelepiped spanned by the input vectors. This means, parallel input vectors will cause a result vector of zero length.
Note
If the size of dv is less than n-1, the function will crash the application!
Error Handling:
The following error codes can be set by this function:
  • CPL_ERROR_NULL_INPUT: dv == NULL, or any of the entries of dv is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT: not all entries (vectors) of dv have the same size
  • CPL_ERROR_ILLEGAL_INPUT: the number of dimensions is less than 2

◆ clipm_priv_vector_integrate()

cpl_vector * clipm_priv_vector_integrate ( const cpl_vector * v)

Integrate a signal stored in a vector.

Parameters
vInput vector
Returns
The minimum value, 0 in the case of error
Error Handling:
Possible error code set by this function:
  • CPL_ERROR_NULL_INPUT: v is NULL

◆ clipm_priv_vector_null()

void clipm_priv_vector_null ( cpl_vector ** v)

Delete a CPL vector object and set the pointer to NULL.

Parameters
vPointer to vector pointer
Returns
Nothing

The following code is executed:

if (v != NULL)
{
cpl_vector_delete(*v); // checks for NULL pointer
*v = NULL;
}
Error Handling:
No error can occur here.