The Complete SPRLIB & ANNLIB
vector
- a Numerical Recipes in C datatype
SYNOPSIS
| double *vector |
(min, max) |
| void *free_ivector |
(iv, min, max) |
| void free_vector |
(v, min, max) |
ARGUMENTS
int | min | The minimum index. |
int | max | The maximum index. |
int | *iv | A vector of integers. |
double | *v | A vector of doubles. |
DESCRIPTION
In SPRANNLIB, the datatype used for vectors (and matrices) is the same as the
type used in the Numerical Recipes in C functions. The only difference with
a normal C array is that the first element is thought to have index 1;
i.e., to fill a vector with n units, the code is something like:
int *v, i;
v = ivector (1, n);
for (i = 1; i <= n; i++)
{
v[i] = i;
}
The ivector function can be used to allocate an integer vector, vector
to allocate a vector of doubles. The free_... function speak for themselves.
NOTE
In Numerical Recipes in C, the authors chose to work with floats (4-byte
floating point variables). In SPRANNLIB, the default value for a floating
point variable is double. Hence, all Numerical Recipes in C functions have
been rewritten to work with doubles.
SEE ALSO
All the Numerical Recipe functions are described in, "Numerical Recipes in C,
the Art of Scientific Computing", Second Edition, 1992, Cambridge University
Press.
matrix
This document was generated using api2html on Thu Mar 5 09:00:00 MET DST 1998