spLib
|
Vector type that contains the elements of long type. More...
#include <sp/vector.h>
Public Member Functions | |
Text I/O for Vector (<sp/fileio.h>) | |
spBool | lvreadlvector_txt (const char *filename, spLVector vector) |
spLVector | xlvreadlvector_txt (const char *filename) |
spBool | lvreadcol_txt (const char *filename, int col, spLVector vector) |
spLVector | xlvreadcol_txt (const char *filename, int col) |
spBool | lvwritelvector_txt (const char *filename, spLVector vector) |
Vector Dump (<sp/fileio.h>) | |
void | lvdump (spLVector vec) |
void | lvfdump (spLVector vec, FILE *fp) |
void | lvnfdump (FILE *fp,...) |
Memory Allocation and Deallocation | |
spLVector | xlvalloc (long length) |
void | xlvfree (spLVector vector) |
spLVector | xlvallocul (spPlugin *plugin, long length, spBool unlock_flag) |
spLVector | xlvalloculfromv (spLVector x, long length) |
void | lvrfree (spLVector x) |
void | lvialloc (spLVector x) |
void | lvifree (spLVector x) |
spLVector | xlvriallocul (spPlugin *plugin, long length, spBool unlock_flag) |
spLVector | xlvrialloc (long length) |
spLVector | xlvrealloc (spLVector x, long length) |
Lock and Unlock | |
spBool | lvisplugincomputable (spLVector x) |
spBool | lvislocked (spLVector x) |
spBool | lvlock (spLVector x) |
spBool | lvunlock (spLVector x) |
spBool | lvsetlock (spLVector x, spBool lock) |
spBool | lvsync (spLVector x) |
Complex Number Handling | |
spLVector | xlvcplx (spLVector xr, spLVector xi) |
void | lvreal (spLVector x) |
void | lvimag (spLVector x) |
spLVector | xlvreal (spLVector x) |
spLVector | xlvimag (spLVector x) |
void | lvconj (spLVector x) |
spLVector | xlvconj (spLVector x) |
void | lvriswap (spLVector x) |
spLVector | xlvriswap (spLVector x) |
Data Copy | |
void | lvcopy (spLVector y, spLVector x) |
void | lvrcopyi (spLVector y, spLVector x) |
void | lvicopyr (spLVector y, spLVector x) |
long | lvcopyfromarray (spLVector y, long y_offset, long *data, long length) |
long | lvcopyfromriarray (spLVector y, long y_offset, long *data, long *imag, long length) |
long | lvcopytoarray (spLVector x, long x_offset, long *data, long length) |
long | lvcopytoriarray (spLVector x, long x_offset, long *data, long *imag, long length) |
spLVector | xlvclone (spLVector x) |
spLVector | xlvcat (spLVector x, spLVector y) |
void | lvcat (spLVector x, spLVector y) |
Data Initialization | |
spBool | lvinit (spLVector x, long m, long incr, long n) |
spLVector | xlvinit (long m, long incr, long n) |
spLVector | xlvinitul (spPlugin *plugin, long m, long incr, long n, spBool unlock_flag) |
spBool | lviinit (spLVector x, long m, long incr, long n) |
spBool | lvriinit (spLVector x, long m, long incr, long n) |
spLVector | xlvriinit (long m, long incr, long n) |
spLVector | xlvriinitul (spPlugin *plugin, long m, long incr, long n, spBool unlock_flag) |
Data Editing | |
spLVector | xlvcut (spLVector x, long offset, long length) |
long | lvpaste (spLVector y, spLVector x, long y_offset, long x_length, spBool overlap) |
long | lvadd (spLVector y, long y_offset, spLVector x, long x_offset, long x_length, spBool overlap) |
void | lverase (spLVector x, long offset, long length, spBool inv) |
Data Modification | |
void | lvset (spLVector x, long *data, long length) |
void | lviset (spLVector x, long *imag, long length) |
spLVector | xlvsetve (spPlugin *plugin, long *data, long length) |
spLVector | xlvset (long *data, long length) |
spLVector | xlvsetnew (long *data, long length) |
spBool | lvsetval (spLVector x, long index, long value) |
spBool | lvsetival (spLVector x, long index, long value) |
Absolute Value (<sp/vmath.h>) | |
void | lvabs (spLVector x) |
spLVector | xlvabs (spLVector x) |
Square Root (<sp/vmath.h>) | |
void | lvsqrt (spLVector x) |
spLVector | xlvsqrt (spLVector x) |
Square (<sp/vmath.h>) | |
void | lvsquare (spLVector x) |
spLVector | xlvsquare (spLVector x) |
Sign Function (<sp/vmath.h>) | |
void | lvsign (spLVector x) |
spLVector | xlvsign (spLVector x) |
Cumulative Sum (<sp/vmath.h>) | |
void | lvcumsum (spLVector x) |
spLVector | xlvcumsum (spLVector x) |
Cumulative Product (<sp/vmath.h>) | |
void | lvcumprod (spLVector x) |
spLVector | xlvcumprod (spLVector x) |
Differences (<sp/vmath.h>) | |
void | lvcodiff (spLVector x, double coef) |
spLVector | xlvcodiff (spLVector x, double coef) |
#define | lvdiff(x) lvcodiff(x, 1.0); |
#define | xlvdiff(x) xlvcodiff(x, 1.0); |
Sum (<sp/vmath.h>) | |
long | lvsum (spLVector x) |
long | lvisum (spLVector x) |
long | lvsqsum (spLVector x) |
long | lvabssum (spLVector x) |
Product (<sp/vmath.h>) | |
long | lvprod (spLVector x) |
long | lvriprod (spLVector x, long *oiprod) |
Norm (<sp/vmath.h>) | |
double | lvnorm (spLVector x, long p) |
Dot Product (<sp/vmath.h>) | |
long | lvdot (spLVector x, spLVector y) |
void | lvcplxdot (spLVector x, spLVector y, long *re, long *im) |
Mean and Variance (<sp/vmath.h>) | |
double | lvvar (spLVector x, double *mean) |
double | lvstd (spLVector x, double *mean) |
#define | lvmean(x) ((double)lvsum(x) / (double)x->length) |
Minimum and Maximum (<sp/vmath.h>) | |
long | lvmin (spLVector x, long *index) |
long | lvmax (spLVector x, long *index) |
void | lvscmin (spLVector x, long a) |
void | lvscmax (spLVector x, long a) |
void | lvelmin (spLVector x, spLVector y) |
void | lvelmax (spLVector x, spLVector y) |
Sort and Median (<sp/vmath.h>) | |
void | lvsort (spLVector x) |
spLVector | xlvsort (spLVector x) |
spLVector | xlvsortidx (spLVector x) |
double | lvmedian (spLVector x) |
spLVector | xlvmedian (spLVector x, double *median) |
Zero-Crossing Count (<sp/vmath.h>) | |
long | lvzerocross (spLVector x, int slope_sign) |
Vector Operation (<sp/voperate.h>) | |
void | lvoper (spLVector a, const char *op, spLVector b) |
spLVector | xlvoper (spLVector a, const char *op, spLVector b) |
void | lvscoper (spLVector a, const char *op, double t) |
spLVector | xlvscoper (spLVector a, const char *op, double t) |
void | lvcplxoper (spLVector a, const char *op, double tr, double ti) |
spLVector | xlvcplxoper (spLVector a, const char *op, double tr, double ti) |
Element Reorder (<sp/voperate.h>) | |
spLVector | xlvremap (spLVector x, spLVector map) |
Element Extraction (<sp/voperate.h>) | |
spLVector | xlvfind (spLVector x) |
spLVector | xlvfindv (spLVector x) |
Element Comparison (<sp/voperate.h>) | |
void | lvsceval (spLVector x, const char *op, long t) |
spLVector | xlvsceval (spLVector x, const char *op, long t) |
spLVector | xlvscfind (spLVector x, const char *op, long t) |
spLVector | xlvscfindv (spLVector x, const char *op, long t) |
Data Fields | |
long | length |
long * | data |
long * | imag |
Related Symbols | |
(Note that these are not member symbols.) | |
#define | lvnums(x, length, value) lvinit(x, (long)(value), 0, (long)(length)) |
#define | lvzeros(x, length) lvnums(x, length, 0) |
#define | lvones(x, length) lvnums(x, length, 1) |
#define | lvinums(x, length, value) lviinit(x, (long)(value), 0, (long)(length)) |
#define | lvizeros(x, length) lvinums(x, length, 0.0) |
#define | lviones(x, length) lvinums(x, length, 1.0) |
#define | lvrinums(x, length, value) lvriinit(x, (long)(value), 0, (long)(length)) |
#define | lvrizeros(x, length) lvrinums(x, length, 0.0) |
#define | lvriones(x, length) lvrinums(x, length, 1.0) |
#define | xlvnums(length, value) xlvinit((long)(value), 0, (long)(length)) |
#define | xlvnumsul(plugin, length, value, unlock_flag) xlvinitul(plugin, (long)(value), 0, (long)(length), unlock_flag) |
#define | xlvzeros(length) xlvnums(length, 0) |
#define | xlvzerosul(plugin, length, unlock_flag) xlvnumsul(plugin, length, 0, unlock_flag) |
#define | xlvones(length) xlvnums(length, 1) |
#define | xlvonesul(plugin, length, unlock_flag) xlvnumsul(plugin, length, 1, unlock_flag) |
#define | xlvnull() xlvalloc(0) |
#define | xlvnullul(plugin, unlock_flag) xlvallocul(plugin, 0, unlock_flag) |
#define | xlvrinums(length, value) xlvriinit((long)(value), 0, (long)(length)) |
#define | xlvrinumsul(plugin, length, value, unlock_flag) xlvriinitul(plugin, (long)(value), 0, (long)(length), unlock_flag) |
#define | xlvrizeros(length) xlvrinums(length, 0) |
#define | xlvrizerosul(plugin, length, unlock_flag) xlvrinumsul(plugin, length, 0, unlock_flag) |
#define | xlvriones(length) xlvrinums(length, 1) |
#define | xlvrionesul(plugin, length, unlock_flag) xlvrinumsul(plugin, length, 1, unlock_flag) |
#define | lvunset(x) lvset(x, NULL, 0) |
#define | lviunset(x) lviset(x, NULL, 0) |
File I/O for Vector (<sp/fileio.h>) | |
spLVector | xlvreadlsignal (const char *filename, long headlen, int swap) |
spBool | lvwritelsignal (const char *filename, spLVector vector, int swap) |
#define | xlvreadlvector(filename, swap) xlvreadlsignal((filename), 0, (swap)) |
#define | lvwritelvector(filename, vector, swap) lvwritelsignal(filename, vector, swap) |
Vector type that contains the elements of long type.
Actually, This is a typedefed type by typedef struct _spLVector *spLVector;
. To allocate memory for spLVector, call a function with prefix xlv such as xlvalloc() , xlvinit() , etc. To deallocate memory, call xlvfree() .
Allocates memory for spLVector and sets it in the lock/unlock state.
Allocates memory for spLVector and updates its lock/unlock state by using the status of the input vector.
Allocates memory of both the real and imaginary parts for spLVector and sets it in the lock/unlock state.
spLVector xlvrialloc | ( | long | length | ) |
Allocates memory of both the real and imaginary parts for spLVector.
Expands the size of the vector and resets the expanded elements to 0.
x
for success, SP_NODATA for failure. Checks whether the vector is ready for plugin-based computation.
Sets the vector in the locked/unlocked state without data synchronization.
Synchronizes the vector data (->data
and ->imag
) with the internal data without changing the locked/unlocked state.
Creates a new vector whose real and imaginary parts are xr
and xi
, respectively.
void lvreal | ( | spLVector | x | ) |
Deallocates the imaginary part of x
if it exists.
void lvimag | ( | spLVector | x | ) |
Sets the imaginary part of x
as the real part.
void lvconj | ( | spLVector | x | ) |
Takes the complex conjugate of x
.
void lvriswap | ( | spLVector | x | ) |
Swaps the real part of x
for the imaginary part.
Creates a new vector whose real and imaginary parts are the imaginary and real parts of x
respectively.
Copies data of x
to y
. The imaginary part of x
is not copied unless y->imag != NULL
.
Copies data of the real part of x
to the imaginary part of y
.
Copies data of the imaginary part of x
to the real part of y
.
long lvcopyfromarray | ( | spLVector | y, |
long | y_offset, | ||
long * | data, | ||
long | length ) |
Copies data of the array data
to the target location y_offset
of y
.
long lvcopyfromriarray | ( | spLVector | y, |
long | y_offset, | ||
long * | data, | ||
long * | imag, | ||
long | length ) |
Copies the complex array of the real part data
and the imaginary part imag
to the target location y_offset
of y
.
long lvcopytoarray | ( | spLVector | x, |
long | x_offset, | ||
long * | data, | ||
long | length ) |
Copies data extracted from x_offset
of x
to the array data
.
long lvcopytoriarray | ( | spLVector | x, |
long | x_offset, | ||
long * | data, | ||
long * | imag, | ||
long | length ) |
Copies data extracted from x_offset
of x
to the complex array of the real part data
and the imaginary part imag
.
Appends data of y
to a new vector which is a clone of x
.
Initialize the vector x
so that the elements range from m
to n
using incr
as the increment between elements.
spLVector xlvinit | ( | long | m, |
long | incr, | ||
long | n ) |
Creates a new vector ranging from m
to n
using incr
as the increment between elements.
Creates a new plugin-based vector ranging from m
to n
using incr
as the increment between elements.
Initialize the imaginary part of the vector x
so that the elements range from m
to n
using incr
as the increment between elements.
Initialize the real and imaginary parts of the vector x
so that the elements of both parts range from m
to n
using incr
as the increment between elements.
spLVector xlvriinit | ( | long | m, |
long | incr, | ||
long | n ) |
Creates a new vector whose real and imaginary parts range from m
to n
using incr
as the increment between elements.
Creates a new plugin-based vector whose real and imaginary parts range from m
to n
using incr
as the increment between elements.
Extracts data of length
from offset
of x
.
Pastes data of x
cropped with x_length
to the target location y_offset
of y
. The argument overlap
determines whether the overlap addition is performed in pasting data.
long lvadd | ( | spLVector | y, |
long | y_offset, | ||
spLVector | x, | ||
long | x_offset, | ||
long | x_length, | ||
spBool | overlap ) |
Pastes data of x_length
extracted from x_offset
of x
to the target location y_offset
of y
. The argument overlap
determines whether the overlap addition is performed in pasting data.
Erases data of length
from offset
. The argument inv
determines whether the erasing location is inverted.
void lvset | ( | spLVector | x, |
long * | data, | ||
long | length ) |
Sets the address of data
to x->data
.
void lviset | ( | spLVector | x, |
long * | imag, | ||
long | length ) |
Sets the address of imag
to x->imag
.
Sets the address of data
to data
of a plugin-based new vector.
spLVector xlvset | ( | long * | data, |
long | length ) |
Sets the address of data
to data
of a new vector.
spLVector xlvsetnew | ( | long * | data, |
long | length ) |
Creates a new vector whose real part is a clone of data
.
Copies a value to the location of index
of the real part of x
.
Copies a value to the location of index
of the imaginary part of x
.
Initialize the vector x
so that the elements within length
are all value
.
Initialize the vector x
so that the elements within length
are all zeros.
Initialize the vector x
so that the elements within length
are all ones.
Initialize the imaginary part of the vector x
so that the elements within length
are all value
.
Initialize the imaginary part of the vector x
so that the elements within length
are all zeros.
Initialize the imaginary part of the vector x
so that the elements within length
are all ones.
Initialize the real and imaginary parts of the vector x
so that the elements of both parts are all value
.
Initialize the real and imaginary parts of the vector x
so that the elements of both parts are all zeros.
Initialize the real and imaginary parts of the vector x
so that the elements of both parts are all ones.
Creates a new vector whose elements within length
are all value
.
|
related |
Creates a new plugin-based vector whose elements within length
are all value
.
Creates a new vector whose elements within length
are all zeros.
|
related |
Creates a new plugin-based vector whose elements within length
are all zeros.
Creates a new vector whose elements within length
are all ones.
Creates a new plugin-based vector whose elements within length
are all ones.
|
related |
Creates a new null vector.
|
related |
Creates a new null plugin-based vector.
Creates a new vector whose real and imaginary parts are all value
.
|
related |
Creates a new plugin-based vector whose real and imaginary parts are all value
.
Creates a new vector whose real and imaginary parts are all zeros.
|
related |
Creates a new plugin-based vector whose real and imaginary parts are all zeros.
Creates a new vector whose real and imaginary parts are all ones.
|
related |
Creates a new plugin-based vector whose real and imaginary parts are all ones.
|
related |
Sets x->data
to NULL.
|
related |
Sets x->imag
to NULL.
long length |
long* data |