spLib
|
Vector type that contains the elements of double type. More...
#include <sp/vector.h>
Public Member Functions | |
Text I/O for Vector (<sp/fileio.h>) | |
spBool | dvreaddvector_txt (const char *filename, spDVector vector) |
spDVector | xdvreaddvector_txt (const char *filename) |
spBool | dvreadcol_txt (const char *filename, int col, spDVector vector) |
spDVector | xdvreadcol_txt (const char *filename, int col) |
spBool | dvwritedvector_txt (const char *filename, spDVector vector) |
Vector Modification for I/O (<sp/fileio.h>) | |
double | dvmaxamp (spDVector vec) |
double | dvadjustamp (spDVector vec, double amp) |
double | dvlimitamp (spDVector vec, double amp) |
spDVector | xdvextractchannel (spDVector x, int channel, int num_channel) |
Vector Dump (<sp/fileio.h>) | |
void | dvdump (spDVector vec) |
void | dvfdump (spDVector vec, FILE *fp) |
void | dvnfdump (FILE *fp,...) |
Memory Allocation and Deallocation | |
spDVector | xdvalloc (long length) |
void | xdvfree (spDVector vector) |
spDVector | xdvallocul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvalloculfromv (spDVector x, long length) |
void | dvrfree (spDVector x) |
void | dvialloc (spDVector x) |
void | dvifree (spDVector x) |
spDVector | xdvriallocul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvrialloc (long length) |
spDVector | xdvrealloc (spDVector x, long length) |
Lock and Unlock | |
spBool | dvisplugincomputable (spDVector x) |
spBool | dvislocked (spDVector x) |
spBool | dvlock (spDVector x) |
spBool | dvunlock (spDVector x) |
spBool | dvsetlock (spDVector x, spBool lock) |
spBool | dvsync (spDVector x) |
Complex Number Handling | |
spDVector | xdvcplx (spDVector xr, spDVector xi) |
void | dvreal (spDVector x) |
void | dvimag (spDVector x) |
spDVector | xdvreal (spDVector x) |
spDVector | xdvimag (spDVector x) |
void | dvconj (spDVector x) |
spDVector | xdvconj (spDVector x) |
void | dvriswap (spDVector x) |
spDVector | xdvriswap (spDVector x) |
Data Copy | |
void | dvcopy (spDVector y, spDVector x) |
void | dvrcopyi (spDVector y, spDVector x) |
void | dvicopyr (spDVector y, spDVector x) |
long | dvcopyfromarray (spDVector y, long y_offset, double *data, long length) |
long | dvcopyfromriarray (spDVector y, long y_offset, double *data, double *imag, long length) |
long | dvcopytoarray (spDVector x, long x_offset, double *data, long length) |
long | dvcopytoriarray (spDVector x, long x_offset, double *data, double *imag, long length) |
spSVector | xdvtos (spDVector x) |
spLVector | xdvtol (spDVector x) |
spFVector | xdvtof (spDVector x) |
spDVector | xdvclone (spDVector x) |
spDVector | xdvcat (spDVector x, spDVector y) |
void | dvcat (spDVector x, spDVector y) |
Data Initialization | |
spBool | dvinit (spDVector x, double m, double incr, double n) |
spDVector | xdvinit (double m, double incr, double n) |
spDVector | xdvinitul (spPlugin *plugin, double m, double incr, double n, spBool unlock_flag) |
spBool | dviinit (spDVector x, double m, double incr, double n) |
spBool | dvriinit (spDVector x, double m, double incr, double n) |
spDVector | xdvriinit (double m, double incr, double n) |
spDVector | xdvriinitul (spPlugin *plugin, double m, double incr, double n, spBool unlock_flag) |
Data Editing | |
spDVector | xdvcut (spDVector x, long offset, long length) |
long | dvpaste (spDVector y, spDVector x, long y_offset, long x_length, spBool overlap) |
long | dvadd (spDVector y, long y_offset, spDVector x, long x_offset, long x_length, spBool overlap) |
void | dverase (spDVector x, long offset, long length, spBool inv) |
Data Modification | |
void | dvset (spDVector x, double *data, long length) |
void | dviset (spDVector x, double *imag, long length) |
spDVector | xdvsetve (spPlugin *plugin, double *data, long length) |
spDVector | xdvset (double *data, long length) |
spDVector | xdvsetnew (double *data, long length) |
spBool | dvsetval (spDVector x, long index, double value) |
spBool | dvsetival (spDVector x, long index, double value) |
Absolute Value (<sp/vmath.h>) | |
void | dvabs (spDVector x) |
spDVector | xdvabs (spDVector x) |
Square Root (<sp/vmath.h>) | |
void | dvsqrt (spDVector x) |
spDVector | xdvsqrt (spDVector x) |
Square (<sp/vmath.h>) | |
void | dvsquare (spDVector x) |
spDVector | xdvsquare (spDVector x) |
Sign Function (<sp/vmath.h>) | |
void | dvsign (spDVector x) |
spDVector | xdvsign (spDVector x) |
Cumulative Sum (<sp/vmath.h>) | |
void | dvcumsum (spDVector x) |
spDVector | xdvcumsum (spDVector x) |
Cumulative Product (<sp/vmath.h>) | |
void | dvcumprod (spDVector x) |
spDVector | xdvcumprod (spDVector x) |
Differences (<sp/vmath.h>) | |
void | dvcodiff (spDVector x, double coef) |
spDVector | xdvcodiff (spDVector x, double coef) |
#define | dvdiff(x) dvcodiff(x, 1.0); |
#define | xdvdiff(x) xdvcodiff(x, 1.0); |
Sum (<sp/vmath.h>) | |
double | dvsum (spDVector x) |
double | dvisum (spDVector x) |
double | dvsqsum (spDVector x) |
double | dvabssum (spDVector x) |
Product (<sp/vmath.h>) | |
double | dvprod (spDVector x) |
double | dvriprod (spDVector x, double *oiprod) |
Norm (<sp/vmath.h>) | |
double | dvnorm (spDVector x, long p) |
Dot Product (<sp/vmath.h>) | |
double | dvdot (spDVector x, spDVector y) |
void | dvcplxdot (spDVector x, spDVector y, double *re, double *im) |
Mean and Variance (<sp/vmath.h>) | |
double | dvvar (spDVector x, double *mean) |
double | dvstd (spDVector x, double *mean) |
#define | dvmean(x) (dvsum(x) / (double)x->length) |
Minimum and Maximum (<sp/vmath.h>) | |
double | dvmin (spDVector x, long *index) |
double | dvmax (spDVector x, long *index) |
void | dvscmin (spDVector x, double a) |
void | dvscmax (spDVector x, double a) |
void | dvelmin (spDVector x, spDVector y) |
void | dvelmax (spDVector x, spDVector y) |
Sort and Median (<sp/vmath.h>) | |
void | dvsort (spDVector x) |
spDVector | xdvsort (spDVector x) |
spLVector | xdvsortidx (spDVector x) |
double | dvmedian (spDVector x) |
spDVector | xdvmedian (spDVector x, double *median) |
Zero-Crossing Count (<sp/vmath.h>) | |
long | dvzerocross (spDVector x, int slope_sign) |
Phase Angle (<sp/vmath.h>) | |
void | dvangle (spDVector x) |
spDVector | xdvangle (spDVector x) |
Trigonometric functions (<sp/vmath.h>) | |
void | dvcos (spDVector x) |
spDVector | xdvcos (spDVector x) |
void | dvsin (spDVector x) |
spDVector | xdvsin (spDVector x) |
void | dvtan (spDVector x) |
spDVector | xdvtan (spDVector x) |
void | dvcosh (spDVector x) |
spDVector | xdvcosh (spDVector x) |
void | dvsinh (spDVector x) |
spDVector | xdvsinh (spDVector x) |
void | dvtanh (spDVector x) |
spDVector | xdvtanh (spDVector x) |
void | dvacos (spDVector x) |
spDVector | xdvacos (spDVector x) |
void | dvasin (spDVector x) |
spDVector | xdvasin (spDVector x) |
void | dvatan (spDVector x) |
spDVector | xdvatan (spDVector x) |
void | dvatan2 (spDVector y, spDVector x, spBool reverse) |
spDVector | xdvatan2 (spDVector y, spDVector x) |
Exponents and Logarithms (<sp/vmath.h>) | |
void | dvexp (spDVector x) |
spDVector | xdvexp (spDVector x) |
void | dvlog (spDVector x) |
spDVector | xdvlog (spDVector x) |
void | dvlog10 (spDVector x) |
spDVector | xdvlog10 (spDVector x) |
void | dvdecibela (spDVector x) |
spDVector | xdvdecibela (spDVector x) |
void | dvdecibelp (spDVector x) |
spDVector | xdvdecibelp (spDVector x) |
void | dvundecibelp (spDVector x) |
spDVector | xdvundecibelp (spDVector x) |
void | dvdecibel (spDVector x) |
spDVector | xdvdecibel (spDVector x) |
void | dvundecibel (spDVector x) |
spDVector | xdvundecibel (spDVector x) |
Random Number (<sp/vmath.h>) | |
void | dvrandun (spDVector x) |
spDVector | xdvrandunul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvrandun (long length) |
void | dvgauss (spDVector x, double mu, double sigma) |
spDVector | xdvgaussul (spPlugin *plugin, long length, double mu, double sigma, spBool unlock_flag) |
spDVector | xdvgauss (long length, double mu, double sigma) |
void | dvrandn (spDVector x) |
spDVector | xdvrandnul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvrandn (long length) |
Vector Operation (<sp/voperate.h>) | |
void | dvoper (spDVector a, const char *op, spDVector b) |
spDVector | xdvoper (spDVector a, const char *op, spDVector b) |
void | dvscoper (spDVector a, const char *op, double t) |
spDVector | xdvscoper (spDVector a, const char *op, double t) |
void | dvcplxoper (spDVector a, const char *op, double tr, double ti) |
spDVector | xdvcplxoper (spDVector a, const char *op, double tr, double ti) |
Element Reorder (<sp/voperate.h>) | |
spDVector | xdvremap (spDVector x, spLVector map) |
Element Extraction (<sp/voperate.h>) | |
spLVector | xdvfind (spDVector x) |
spDVector | xdvfindv (spDVector x) |
Element Comparison (<sp/voperate.h>) | |
void | dvsceval (spDVector x, const char *op, double t) |
spDVector | xdvsceval (spDVector x, const char *op, double t) |
spLVector | xdvscfind (spDVector x, const char *op, double t) |
spDVector | xdvscfindv (spDVector x, const char *op, double t) |
Blackman Window for Vector (<sp/window.h>) | |
spDVector | xdvblackmanul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvblackman (long length) |
spDVector | xdvnblackmanul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvnblackman (long length) |
Hamming Window for Vector (<sp/window.h>) | |
spDVector | xdvhammingul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvhamming (long length) |
spDVector | xdvnhammingul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvnhamming (long length) |
Hanning Window for Vector (<sp/window.h>) | |
spDVector | xdvhanningul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvhanning (long length) |
spDVector | xdvnhanningul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvnhanning (long length) |
Hann Window for Vector (<sp/window.h>) | |
spDVector | xdvhannul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvhann (long length) |
spDVector | xdvnhannul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvnhann (long length) |
Gaussian Window for Vector (<sp/window.h>) | |
spDVector | xdvgausswinexul (spPlugin *plugin, long length, double alpha, spBool unlock_flag) |
spDVector | xdvgausswinex (long length, double alpha) |
spDVector | xdvgausswinul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvgausswin (long length) |
spDVector | xdvngausswinexul (spPlugin *plugin, long length, double alpha, spBool unlock_flag) |
spDVector | xdvngausswinex (long length, double alpha) |
spDVector | xdvngausswinul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvngausswin (long length) |
Rectangular Window for Vector (<sp/window.h>) | |
spDVector | xdvnboxcarul (spPlugin *plugin, long length, spBool unlock_flag) |
spDVector | xdvnboxcar (long length) |
Data Fields | |
long | length |
double * | data |
double * | imag |
Related Symbols | |
(Note that these are not member symbols.) | |
#define | dvnums(x, length, value) dvinit(x, (double)(value), 0.0, (double)(length)) |
#define | dvzeros(x, length) dvnums(x, length, 0.0) |
#define | dvones(x, length) dvnums(x, length, 1.0) |
#define | dvinums(x, length, value) dviinit(x, (double)(value), 0.0, (double)(length)) |
#define | dvizeros(x, length) dvinums(x, length, 0.0) |
#define | dviones(x, length) dvinums(x, length, 1.0) |
#define | dvrinums(x, length, value) dvriinit(x, (double)(value), 0.0, (double)(length)) |
#define | dvrizeros(x, length) dvrinums(x, length, 0.0) |
#define | dvriones(x, length) dvrinums(x, length, 1.0) |
#define | xdvnums(length, value) xdvinit((double)(value), 0.0, (double)(length)) |
#define | xdvnumsul(plugin, length, value, unlock_flag) xdvinitul(plugin, (double)(value), 0.0, (double)(length), unlock_flag) |
#define | xdvzeros(length) xdvnums(length, 0.0) |
#define | xdvzerosul(plugin, length, unlock_flag) xdvnumsul(plugin, length, 0.0, unlock_flag) |
#define | xdvones(length) xdvnums(length, 1.0) |
#define | xdvonesul(plugin, length, unlock_flag) xdvnumsul(plugin, length, 1.0, unlock_flag) |
#define | xdvnull() xdvalloc(0) |
#define | xdvnullul(plugin, unlock_flag) xdvallocul(plugin, 0, unlock_flag) |
#define | xdvrinums(length, value) xdvriinit((double)(value), 0.0, (double)(length)) |
#define | xdvrinumsul(plugin, length, value, unlock_flag) xdvriinitul(plugin, (double)(value), 0.0, (double)(length), unlock_flag) |
#define | xdvrizeros(length) xdvrinums(length, 0.0) |
#define | xdvrizerosul(plugin, length, unlock_flag) xdvrinumsul(plugin, length, 0.0, unlock_flag) |
#define | xdvriones(length) xdvrinums(length, 1.0) |
#define | xdvrionesul(plugin, length, unlock_flag) xdvrinumsul(plugin, length, 1.0, unlock_flag) |
#define | dvunset(x) dvset(x, NULL, 0) |
#define | dviunset(x) dviset(x, NULL, 0) |
File I/O for Vector (<sp/fileio.h>) | |
spDVector | xdvreaddsignal (const char *filename, long headlen, int swap) |
spDVector | xdvreadssignal (const char *filename, long headlen, int swap) |
spDVector | xdvreadlsignal (const char *filename, long headlen, int swap) |
spDVector | xdvreadfsignal (const char *filename, long headlen, int swap) |
spBool | dvwritedsignal (const char *filename, spDVector vector, int swap) |
spBool | dvwritessignal (const char *filename, spDVector vector, int swap) |
spBool | dvwritelsignal (const char *filename, spDVector vector, int swap) |
spBool | dvwritefsignal (const char *filename, spDVector vector, int swap) |
#define | xdvreaddvector(filename, swap) xdvreaddsignal((filename), 0, (swap)) |
#define | xdvreadsvector(filename, swap) xdvreadssignal((filename), 0, (swap)) |
#define | xdvreadlvector(filename, swap) xdvreadlsignal((filename), 0, (swap)) |
#define | xdvreadfvector(filename, swap) xdvreadfsignal((filename), 0, (swap)) |
#define | dvwritedvector(filename, vector, swap) dvwritedsignal(filename, vector, swap) |
#define | dvwritesvector(filename, vector, swap) dvwritessignal(filename, vector, swap) |
#define | dvwritelvector(filename, vector, swap) dvwritelsignal(filename, vector, swap) |
#define | dvwritefvector(filename, vector, swap) dvwritefsignal(filename, vector, swap) |
Vector type that contains the elements of double type.
Actually, This is a typedefed type by typedef struct _spDVector *spDVector;
. To allocate memory for spDVector, call a function with prefix xdv such as xdvalloc() , xdvinit() , etc. To deallocate memory, call xdvfree() .
Allocates memory for spDVector and sets it in the lock/unlock state.
Allocates memory for spDVector and updates its lock/unlock state by using the status of the input vector.
Allocates memory of both the real and imaginary parts for spDVector and sets it in the lock/unlock state.
spDVector xdvrialloc | ( | long | length | ) |
Allocates memory of both the real and imaginary parts for spDVector.
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 dvreal | ( | spDVector | x | ) |
Deallocates the imaginary part of x
if it exists.
void dvimag | ( | spDVector | x | ) |
Sets the imaginary part of x
as the real part.
void dvconj | ( | spDVector | x | ) |
Takes the complex conjugate of x
.
void dvriswap | ( | spDVector | 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 dvcopyfromarray | ( | spDVector | y, |
long | y_offset, | ||
double * | data, | ||
long | length ) |
Copies data of the array data
to the target location y_offset
of y
.
long dvcopyfromriarray | ( | spDVector | y, |
long | y_offset, | ||
double * | data, | ||
double * | 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 dvcopytoarray | ( | spDVector | x, |
long | x_offset, | ||
double * | data, | ||
long | length ) |
Copies data extracted from x_offset
of x
to the array data
.
long dvcopytoriarray | ( | spDVector | x, |
long | x_offset, | ||
double * | data, | ||
double * | 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.
spDVector xdvinit | ( | double | m, |
double | incr, | ||
double | 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.
spDVector xdvriinit | ( | double | m, |
double | incr, | ||
double | 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 dvadd | ( | spDVector | y, |
long | y_offset, | ||
spDVector | 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 dvset | ( | spDVector | x, |
double * | data, | ||
long | length ) |
Sets the address of data
to x->data
.
void dviset | ( | spDVector | x, |
double * | imag, | ||
long | length ) |
Sets the address of imag
to x->imag
.
Sets the address of data
to data
of a plugin-based new vector.
spDVector xdvset | ( | double * | data, |
long | length ) |
Sets the address of data
to data
of a new vector.
spDVector xdvsetnew | ( | double * | 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.
|
related |
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 |
The number of elements of spDVector. You can access the number of elements as x->length
for the memory allocated x
of spDVector.
double* data |
Data of the real part of spDVector. You can access the 0-th element of the data as x->data
[0] for the memory allocated x
of spDVector.