Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Vector


Files

file  psVector.h
 Contains basic vector definitions and operations.

Data Structures

struct  psVector
 An vector to support primitive types. More...

Functions

bool psMemCheckVector (psPtr ptr)
 Checks the type of a particular pointer.
psVectorpsVectorAlloc (long nalloc, psElemType type)
 Allocate a vector.
psVectorpsVectorRealloc (psVector *vector, long nalloc)
 Reallocate a vector.
psVectorpsVectorExtend (psVector *vector, long delta, long nExtend)
 Extend a vector's length.
psVectorpsVectorRecycle (psVector *vector, long nalloc, psElemType type)
 Recycle a vector.
psVectorpsVectorCopy (psVector *output, const psVector *input, psElemType type)
 Copy a vector, converting types.
psVectorpsVectorSort (psVector *outVector, const psVector *inVector)
 Sort an array of floats.
psVectorpsVectorSortIndex (psVector *outVector, const psVector *inVector)
 Creates an array of indices based on sort ordered of array.
char * psVectorToString (psVector *vector, int maxLength)
 Creates a string from a psVector's values in the form "[x0,x1,x2]".
psF64 p_psVectorGetElementF64 (psVector *vector, int position)
 Returns an element in the vector as a psF64 value.
bool p_psVectorPrint (int fd, psVector *a, char *name)
 Print a vector to a stream.
bool psVectorInit (psVector *image,...)
 Initializes the vector with the given value.


Function Documentation

psF64 p_psVectorGetElementF64 psVector vector,
int  position
 

Returns an element in the vector as a psF64 value.

Returns:
psF64 the value at specified position, or NAN if position is invalid.
Parameters:
vector  vector to retrieve element
position  the vector position to get

bool p_psVectorPrint int  fd,
psVector a,
char *  name
 

Print a vector to a stream.

Returns:
psBool TRUE is successful, otherwise FALSE.
Parameters:
fd  output file descriptor
a  vector to print
name  name of vector (for title)

bool psMemCheckVector psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psVector structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

psVector* psVectorAlloc long  nalloc,
psElemType  type
 

Allocate a vector.

Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type.

Returns:
psVector* Pointer to psVector.
Parameters:
nalloc  Total number of elements to make available.
type  Type of data to be held by vector.

psVector* psVectorCopy psVector output,
const psVector input,
psElemType  type
 

Copy a vector, converting types.

Performs a deep copy of the elements of one psVector to a new psVector, converting numeric types to a specified type.

Returns:
psVector* Pointer to resulting psVector.
Parameters:
output  if non-NULL, a psVector to recycle
input  the vector to copy.
type  the data type of the resulting psVector

psVector* psVectorExtend psVector vector,
long  delta,
long  nExtend
 

Extend a vector's length.

Increments a vector's length, n, by the specified number of elements. If the allocated storage is less than the current vector's length plus twice the number of elements to be added, it is reallocated larger by a given amount.

Returns:
psVector* Pointer to the adjusted psVector
Parameters:
vector  Vector to extend
delta  Amount to expand allocation, if necessary
nExtend  Number of elements to add to vector length

bool psVectorInit psVector image,
  ...
 

Initializes the vector with the given value.

The input data is cast to match the vector datatype, allowing for integers to be preserved.

Returns:
bool: True if successful, otherwise false.
Parameters:
image  the vector to be initialized

psVector* psVectorRealloc psVector vector,
long  nalloc
 

Reallocate a vector.

Uses psLib memory allocation functions to reallocate a vector collection of data. The vector is reallocated according to the psType type member contained within the vector.

Returns:
psVector* Pointer to psVector.
Parameters:
vector  Vector to reallocate.
nalloc  Total number of elements to make available.

psVector* psVectorRecycle psVector vector,
long  nalloc,
psElemType  type
 

Recycle a vector.

Uses psLib memory allocation functions to reallocate a vector collection of data. The vector is reallocated according to the psElemType type parameter.

Returns:
psVector* Pointer to psVector.
Parameters:
vector  Vector to recycle. If NULL, a new vector is created. No effort taken to preserve the values.
nalloc  Total number of elements to make available.
type  the datatype of the returned vector

psVector* psVectorSort psVector outVector,
const psVector inVector
 

Sort an array of floats.

Sorts an array of floats in ascending order. This function is valid for all non-complex data types.

Returns:
psVector* Pointer to sorted psVector.
Parameters:
outVector  the output vector to recycle, or NULL if new vector desired.
inVector  the vector to sort.

psVector* psVectorSortIndex psVector outVector,
const psVector inVector
 

Creates an array of indices based on sort ordered of array.

Sorts a vector and creates an integer array holding indices of sorted float values based on pre-sort index positions.

Returns:
psVector* vector of the indices of sort.
Parameters:
outVector  vector to recycle
inVector  vector to sort

char* psVectorToString psVector vector,
int  maxLength
 

Creates a string from a psVector's values in the form "[x0,x1,x2]".

Returns:
psPtr a newly allocated string
Parameters:
vector  vector to create a string from
maxLength  the maximum length of the resulting string


Generated on Wed Sep 14 10:43:47 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2