spLib
|
Vector type that contains the elements of short type. More...
#include <sp/vector.h>
Public Member Functions | |
Text I/O for Vector (<sp/fileio.h>) | |
spBool | svreadsvector_txt (const char *filename, spSVector vector) |
spSVector | xsvreadsvector_txt (const char *filename) |
spBool | svreadcol_txt (const char *filename, int col, spSVector vector) |
spSVector | xsvreadcol_txt (const char *filename, int col) |
spBool | svwritesvector_txt (const char *filename, spSVector vector) |
Vector Dump (<sp/fileio.h>) | |
void | svdump (spSVector vec) |
void | svfdump (spSVector vec, FILE *fp) |
void | svnfdump (FILE *fp,...) |
Memory Allocation and Deallocation | |
spSVector | xsvalloc (long length) |
void | xsvfree (spSVector vector) |
spSVector | xsvallocul (spPlugin *plugin, long length, spBool unlock_flag) |
spSVector | xsvalloculfromv (spSVector x, long length) |
void | svrfree (spSVector x) |
void | svialloc (spSVector x) |
void | svifree (spSVector x) |
spSVector | xsvriallocul (spPlugin *plugin, long length, spBool unlock_flag) |
spSVector | xsvrialloc (long length) |
spSVector | xsvrealloc (spSVector x, long length) |
Lock and Unlock | |
spBool | svisplugincomputable (spSVector x) |
spBool | svislocked (spSVector x) |
spBool | svlock (spSVector x) |
spBool | svunlock (spSVector x) |
spBool | svsetlock (spSVector x, spBool lock) |
spBool | svsync (spSVector x) |
Complex Number Handling | |
spSVector | xsvcplx (spSVector xr, spSVector xi) |
void | svreal (spSVector x) |
void | svimag (spSVector x) |
spSVector | xsvreal (spSVector x) |
spSVector | xsvimag (spSVector x) |
void | svconj (spSVector x) |
spSVector | xsvconj (spSVector x) |
void | svriswap (spSVector x) |
spSVector | xsvriswap (spSVector x) |
Data Copy | |
void | svcopy (spSVector y, spSVector x) |
void | svrcopyi (spSVector y, spSVector x) |
void | svicopyr (spSVector y, spSVector x) |
long | svcopyfromarray (spSVector y, long y_offset, short *data, long length) |
long | svcopyfromriarray (spSVector y, long y_offset, short *data, short *imag, long length) |
long | svcopytoarray (spSVector x, long x_offset, short *data, long length) |
long | svcopytoriarray (spSVector x, long x_offset, short *data, short *imag, long length) |
spLVector | xsvtol (spSVector x) |
spFVector | xsvtof (spSVector x) |
spDVector | xsvtod (spSVector x) |
spSVector | xsvclone (spSVector x) |
spSVector | xsvcat (spSVector x, spSVector y) |
void | svcat (spSVector x, spSVector y) |
Data Initialization | |
spBool | svinit (spSVector x, long m, long incr, long n) |
spSVector | xsvinit (long m, long incr, long n) |
spSVector | xsvinitul (spPlugin *plugin, long m, long incr, long n, spBool unlock_flag) |
spBool | sviinit (spSVector x, long m, long incr, long n) |
spBool | svriinit (spSVector x, long m, long incr, long n) |
spSVector | xsvriinit (long m, long incr, long n) |
spSVector | xsvriinitul (spPlugin *plugin, long m, long incr, long n, spBool unlock_flag) |
Data Editing | |
spSVector | xsvcut (spSVector x, long offset, long length) |
long | svpaste (spSVector y, spSVector x, long y_offset, long x_length, spBool overlap) |
long | svadd (spSVector y, long y_offset, spSVector x, long x_offset, long x_length, spBool overlap) |
void | sverase (spSVector x, long offset, long length, spBool inv) |
Data Modification | |
void | svset (spSVector x, short *data, long length) |
void | sviset (spSVector x, short *imag, long length) |
spSVector | xsvsetve (spPlugin *plugin, short *data, long length) |
spSVector | xsvset (short *data, long length) |
spSVector | xsvsetnew (short *data, long length) |
spBool | svsetval (spSVector x, long index, short value) |
spBool | svsetival (spSVector x, long index, short value) |
Absolute Value (<sp/vmath.h>) | |
void | svabs (spSVector x) |
spSVector | xsvabs (spSVector x) |
Square Root (<sp/vmath.h>) | |
void | svsqrt (spSVector x) |
spSVector | xsvsqrt (spSVector x) |
Square (<sp/vmath.h>) | |
void | svsquare (spSVector x) |
spSVector | xsvsquare (spSVector x) |
Sign Function (<sp/vmath.h>) | |
void | svsign (spSVector x) |
spSVector | xsvsign (spSVector x) |
Cumulative Sum (<sp/vmath.h>) | |
void | svcumsum (spSVector x) |
spSVector | xsvcumsum (spSVector x) |
Cumulative Product (<sp/vmath.h>) | |
void | svcumprod (spSVector x) |
spSVector | xsvcumprod (spSVector x) |
Differences (<sp/vmath.h>) | |
void | svcodiff (spSVector x, double coef) |
spSVector | xsvcodiff (spSVector x, double coef) |
#define | svdiff(x) svcodiff(x, 1.0); |
#define | xsvdiff(x) xsvcodiff(x, 1.0); |
Sum (<sp/vmath.h>) | |
long | svsum (spSVector x) |
long | svisum (spSVector x) |
long | svsqsum (spSVector x) |
long | svabssum (spSVector x) |
Product (<sp/vmath.h>) | |
long | svprod (spSVector x) |
long | svriprod (spSVector x, long *oiprod) |
Norm (<sp/vmath.h>) | |
double | svnorm (spSVector x, long p) |
Dot Product (<sp/vmath.h>) | |
long | svdot (spSVector x, spSVector y) |
void | svcplxdot (spSVector x, spSVector y, long *re, long *im) |
Mean and Variance (<sp/vmath.h>) | |
double | svvar (spSVector x, double *mean) |
double | svstd (spSVector x, double *mean) |
#define | svmean(x) ((double)svsum(x) / (double)x->length) |
Minimum and Maximum (<sp/vmath.h>) | |
short | svmin (spSVector x, long *index) |
short | svmax (spSVector x, long *index) |
void | svscmin (spSVector x, short a) |
void | svscmax (spSVector x, short a) |
void | svelmin (spSVector x, spSVector y) |
void | svelmax (spSVector x, spSVector y) |
Sort and Median (<sp/vmath.h>) | |
void | svsort (spSVector x) |
spSVector | xsvsort (spSVector x) |
spLVector | xsvsortidx (spSVector x) |
double | svmedian (spSVector x) |
spSVector | xsvmedian (spSVector x, double *median) |
Zero-Crossing Count (<sp/vmath.h>) | |
long | svzerocross (spSVector x, int slope_sign) |
Vector Operation (<sp/voperate.h>) | |
void | svoper (spSVector a, const char *op, spSVector b) |
spSVector | xsvoper (spSVector a, const char *op, spSVector b) |
void | svscoper (spSVector a, const char *op, double t) |
spSVector | xsvscoper (spSVector a, const char *op, double t) |
void | svcplxoper (spSVector a, const char *op, double tr, double ti) |
spSVector | xsvcplxoper (spSVector a, const char *op, double tr, double ti) |
Element Reorder (<sp/voperate.h>) | |
spSVector | xsvremap (spSVector x, spLVector map) |
Element Extraction (<sp/voperate.h>) | |
spLVector | xsvfind (spSVector x) |
spSVector | xsvfindv (spSVector x) |
Element Comparison (<sp/voperate.h>) | |
void | svsceval (spSVector x, const char *op, short t) |
spSVector | xsvsceval (spSVector x, const char *op, short t) |
spLVector | xsvscfind (spSVector x, const char *op, short t) |
spSVector | xsvscfindv (spSVector x, const char *op, short t) |
Data Fields | |
long | length |
short * | data |
short * | imag |
Related Symbols | |
(Note that these are not member symbols.) | |
#define | svnums(x, length, value) svinit(x, (long)(value), 0, (long)(length)) |
#define | svzeros(x, length) svnums(x, length, 0) |
#define | svones(x, length) svnums(x, length, 1) |
#define | svinums(x, length, value) sviinit(x, (long)(value), 0, (long)(length)) |
#define | svizeros(x, length) svinums(x, length, 0.0) |
#define | sviones(x, length) svinums(x, length, 1.0) |
#define | svrinums(x, length, value) svriinit(x, (long)(value), 0, (long)(length)) |
#define | svrizeros(x, length) svrinums(x, length, 0.0) |
#define | svriones(x, length) svrinums(x, length, 1.0) |
#define | xsvnums(length, value) xsvinit((long)(value), 0, (long)(length)) |
#define | xsvnumsul(plugin, length, value, unlock_flag) xsvinitul(plugin, (long)(value), 0, (long)(length), unlock_flag) |
#define | xsvzeros(length) xsvnums(length, 0) |
#define | xsvzerosul(plugin, length, unlock_flag) xsvnumsul(plugin, length, 0, unlock_flag) |
#define | xsvones(length) xsvnums(length, 1) |
#define | xsvonesul(plugin, length, unlock_flag) xsvnumsul(plugin, length, 1, unlock_flag) |
#define | xsvnull() xsvalloc(0) |
#define | xsvnullul(plugin, unlock_flag) xsvallocul(plugin, 0, unlock_flag) |
#define | xsvrinums(length, value) xsvriinit((long)(value), 0, (long)(length)) |
#define | xsvrinumsul(plugin, length, value, unlock_flag) xsvriinitul(plugin, (long)(value), 0, (long)(length), unlock_flag) |
#define | xsvrizeros(length) xsvrinums(length, 0) |
#define | xsvrizerosul(plugin, length, unlock_flag) xsvrinumsul(plugin, length, 0, unlock_flag) |
#define | xsvriones(length) xsvrinums(length, 1) |
#define | xsvrionesul(plugin, length, unlock_flag) xsvrinumsul(plugin, length, 1, unlock_flag) |
#define | svunset(x) svset(x, NULL, 0) |
#define | sviunset(x) sviset(x, NULL, 0) |
File I/O for Vector (<sp/fileio.h>) | |
spSVector | xsvreadssignal (const char *filename, long headlen, int swap) |
spBool | svwritessignal (const char *filename, spSVector vector, int swap) |
#define | xsvreadsvector(filename, swap) xsvreadssignal((filename), 0, (swap)) |
#define | svwritesvector(filename, vector, swap) svwritessignal(filename, vector, swap) |
Vector type that contains the elements of short type.
Actually, This is a typedefed type by typedef struct _spSVector *spSVector;
. To allocate memory for spSVector, call a function with prefix xsv such as xsvalloc() , xsvinit() , etc. To deallocate memory, call xsvfree() .
Allocates memory for spSVector and sets it in the lock/unlock state.
Allocates memory for spSVector and updates its lock/unlock state by using the status of the input vector.
Allocates memory of both the real and imaginary parts for spSVector and sets it in the lock/unlock state.
spSVector xsvrialloc | ( | long | length | ) |
Allocates memory of both the real and imaginary parts for spSVector.
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 svreal | ( | spSVector | x | ) |
Deallocates the imaginary part of x
if it exists.
void svimag | ( | spSVector | x | ) |
Sets the imaginary part of x
as the real part.
void svconj | ( | spSVector | x | ) |
Takes the complex conjugate of x
.
void svriswap | ( | spSVector | 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 svcopyfromarray | ( | spSVector | y, |
long | y_offset, | ||
short * | data, | ||
long | length ) |
Copies data of the array data
to the target location y_offset
of y
.
long svcopyfromriarray | ( | spSVector | y, |
long | y_offset, | ||
short * | data, | ||
short * | 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 svcopytoarray | ( | spSVector | x, |
long | x_offset, | ||
short * | data, | ||
long | length ) |
Copies data extracted from x_offset
of x
to the array data
.
long svcopytoriarray | ( | spSVector | x, |
long | x_offset, | ||
short * | data, | ||
short * | 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.
spSVector xsvinit | ( | 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.
spSVector xsvriinit | ( | 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 svadd | ( | spSVector | y, |
long | y_offset, | ||
spSVector | 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 svset | ( | spSVector | x, |
short * | data, | ||
long | length ) |
Sets the address of data
to x->data
.
void sviset | ( | spSVector | x, |
short * | imag, | ||
long | length ) |
Sets the address of imag
to x->imag
.
Sets the address of data
to data
of a plugin-based new vector.
spSVector xsvset | ( | short * | data, |
long | length ) |
Sets the address of data
to data
of a new vector.
spSVector xsvsetnew | ( | short * | 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 |
short* data |