spLib
Loading...
Searching...
No Matches
<sp/vector.h>: Vector

Data Structures

class  spSVector
 Vector type that contains the elements of short type. More...
 
class  spLVector
 Vector type that contains the elements of long type. More...
 
class  spFVector
 Vector type that contains the elements of float type. More...
 
class  spDVector
 Vector type that contains the elements of double type. More...
 

Macros

#define SP_LOW_FLOAT_PRECISION   SP_32BIT_PRECISION
 
#define SP_LONG_PRECISION   SP_32BIT_PRECISION
 
#define SP_SHORT_PRECISION   SP_16BIT_PRECISION
 
#define SP_CHAR_PRECISION   SP_8BIT_PRECISION
 

Enumerations

enum  spPrecision {
  SP_HIGHEST_PRECISION = 128 , SP_HIGH_DOUBLE_PRECISION = 72 , SP_DOUBLE_PRECISION = 64 , SP_LOW_DOUBLE_PRECISION = 48 ,
  SP_HIGH_FLOAT_PRECISION = 34 , SP_FLOAT_PRECISION = 33 , SP_32BIT_PRECISION = 32 , SP_24BIT_PRECISION = 24 ,
  SP_16BIT_PRECISION = 16 , SP_8BIT_PRECISION = 8 , SP_IGNORE_PRECISION = 0 , SP_UNKNOWN_PRECISION = 255
}
 
enum  spComputeSpeed {
  SP_COMPUTE_SPEED_EXTREMELY_FAST = 35 , SP_COMPUTE_SPEED_VERY_FAST = 30 , SP_COMPUTE_SPEED_FASTER = 25 , SP_COMPUTE_SPEED_FAST = 20 ,
  SP_COMPUTE_SPEED_NORMAL = 10 , SP_COMPUTE_SPEED_SLOW = 5 , SP_COMPUTE_SPEED_SLOWER = 4 , SP_COMPUTE_SPEED_VERY_SLOW = 3 ,
  SP_COMPUTE_SPEED_EXTREMELY_SLOW = 2 , SP_COMPUTE_SPEED_UNKNOWN = -1
}
 

Detailed Description

#include <sp/vector.h>

Introduction

The vector type is a type which is used as an argument or a return value of many signal processing functions of this library. Types of spSVector for short type, spLVector for long type, spFVector for float type and spDVector for double type are provided.

The memory of spSVector , spLVector , spFVector or spDVector can be allocated by the functions which have a prefix xsv, xlv, xfv or xdv respectively. If you don't use the vector anymore, you have to deallocate the memory by calling xsvfree() , xlvfree() , xfvfree() or xdvfree() .

Lock and Unlock

Lock and unlock functions for the vector type, which are introduced from version 0.9, are important for fast computation. When you access the data array of the vector such as ->data and ->imag, you must lock the vector, i.e. must call lock function, before access. Since the unlocked vector has correct data only in the internal data structure which enables fast computation internally, fast computation can be realized by applying processing directly to the internal data structure which can be different from the data structure of the vector type. So, you have to unlock the vector before calling the function when you need fast computation (the initial allocated vector is normally locked). In the case of a function with multiple argument vectors, fast computation cannot be performed unless all the argument vectors are locked. Note that the gain of fast computation will be small when you call the unlock/lock functions many times, because the unlock/lock functions include big overhead on some environments. Therefore, calling multiple signal processing functions after unlocking the vector, then locking the vector is desirable.

Macro Definition Documentation

◆ SP_LOW_FLOAT_PRECISION

#define SP_LOW_FLOAT_PRECISION   SP_32BIT_PRECISION

float type precision lower than normal float type

◆ SP_LONG_PRECISION

#define SP_LONG_PRECISION   SP_32BIT_PRECISION

long type precision.

◆ SP_SHORT_PRECISION

#define SP_SHORT_PRECISION   SP_16BIT_PRECISION

short type precision.

◆ SP_CHAR_PRECISION

#define SP_CHAR_PRECISION   SP_8BIT_PRECISION

char type precision.

Enumeration Type Documentation

◆ spPrecision

Indicates precision of computation.

Enumerator
SP_HIGHEST_PRECISION 

Highest precision.

SP_HIGH_DOUBLE_PRECISION 

Double type precision higher than normal double type.

SP_DOUBLE_PRECISION 

double type precision.

SP_LOW_DOUBLE_PRECISION 

double type precision lower than normal double type

SP_HIGH_FLOAT_PRECISION 

float type precision higher than normal double type.

SP_FLOAT_PRECISION 

float type precision.

SP_32BIT_PRECISION 

32-bit integer precision.

SP_24BIT_PRECISION 

24-bit integer precision.

SP_16BIT_PRECISION 

16-bit integer precision.

SP_8BIT_PRECISION 

8-bit integer precision.

SP_IGNORE_PRECISION 

Indicates that precision is ignored.

SP_UNKNOWN_PRECISION 

Unknown precision.

◆ spComputeSpeed

Indicates speed of computation.

Enumerator
SP_COMPUTE_SPEED_EXTREMELY_FAST 

Extremely fast speed.

SP_COMPUTE_SPEED_VERY_FAST 

Very fast speed.

SP_COMPUTE_SPEED_FASTER 

Faster speed.

SP_COMPUTE_SPEED_FAST 

Fast speed.

SP_COMPUTE_SPEED_NORMAL 

Normal speed.

SP_COMPUTE_SPEED_SLOW 

Slow speed.

SP_COMPUTE_SPEED_SLOWER 

Slower speed.

SP_COMPUTE_SPEED_VERY_SLOW 

Very slow speed.

SP_COMPUTE_SPEED_EXTREMELY_SLOW 

Extremely slow speed.

SP_COMPUTE_SPEED_UNKNOWN 

Unknown speed.