Crate basic_dsp [−] [src]
Basic digital signal processing (DSP) operations
The basic building blocks are 1xN (one times N) or Nx1 real or complex vectors where N is typically at least in the order of magnitude of a couple of thousand elements. This crate tries to balance between a clear API and performance in terms of processing speed. This project started as small pet project to learn more about DSP, CPU architecture and Rust. Since learning involves making mistakes, don't expect things to be flawless or even close to flawless.
This library isn't suited - from my point of view - for game programming. If you are looking for vector types to do
2D or 3D graphics calculations then you unfortunately have to continue with your search. However there seem to be
a lot of suitable crates on crates.io
for you.
The vector types don't distinguish between 1xN or Nx1. This is a difference to other conventions such as in MATLAB or GNU Octave. The reason for this decision is that it seems to be more practical to ignore the shape of the vector.
Right now the library uses pretty aggressive parallelization. So this means that it will keep all CPU cores busy even if the performance gain is minimal e.g. because the multi core overhead is nearly as large as the performance boost of multiple cores. In future there will be likely an option which tells the library how it should balance betweeen processing time and CPU utilization. The library also avoids to allocate and free memory and it allocates memory for temporary allocation. so the library is likely not suitable for devices which are tight on memory. On normal desktop computers there is usually plenty of memory available so that the optimization focus is on decreasing the processing time for every (common) operation.
Modules
conv_types |
Types around a convolution, see also https://en.wikipedia.org/wiki/Convolution. |
interop_facade |
Clients using other programming languages should use the functions in this mod. Please refer to the other chapters of the help for documentation of the functions. |
window_functions |
This mod contains a definition for window functions and provides implementations for a
few standard windows. See the |
Structs
ComplexFreqVector |
A 1xN (one times N elements) or Nx1 data vector as used for most digital signal processing (DSP) operations. All data vector operations consume the vector they operate on and return a new vector. A consumed vector must not be accessed again. |
ComplexTimeVector |
A 1xN (one times N elements) or Nx1 data vector as used for most digital signal processing (DSP) operations. All data vector operations consume the vector they operate on and return a new vector. A consumed vector must not be accessed again. |
GenericDataVector |
A 1xN (one times N elements) or Nx1 data vector as used for most digital signal processing (DSP) operations. All data vector operations consume the vector they operate on and return a new vector. A consumed vector must not be accessed again. |
MultiCoreSettings |
Holds parameters which specifiy how multiple cores are used to execute an operation. |
RealFreqVector |
A 1xN (one times N elements) or Nx1 data vector as used for most digital signal processing (DSP) operations. All data vector operations consume the vector they operate on and return a new vector. A consumed vector must not be accessed again. |
RealTimeVector |
A 1xN (one times N elements) or Nx1 data vector as used for most digital signal processing (DSP) operations. All data vector operations consume the vector they operate on and return a new vector. A consumed vector must not be accessed again. |
Statistics |
Statistics about the data in a vector |
Enums
DataVectorDomain |
The domain of a data vector |
ErrorReason |
Enumeration of all error reasons |
Operation |
An alternative way to define operations on a vector. Warning: Highly unstable and not even fully implemented right now. |
PaddingOption |
An option which defines how a vector should be padded |
Traits
ComplexVectorOperations |
Defines all operations which are valid on |
Convolution |
Provides a convolution operation for data vectors. |
CrossCorrelation |
Cross-correlation of data vectors. See also https://en.wikipedia.org/wiki/Cross-correlation |
DataVector |
DataVector gives access to the basic properties of all data vectors |
FrequencyDomainOperations |
Defines all operations which are valid on |
FrequencyMultiplication |
Provides a frequency response multiplication operation for data vectors. |
GenericVectorOperations |
Defines all operations which are valid on all |
Interpolation |
Provides interpolation operations for real and complex data vectors. |
Offset |
An operation which adds a constant to each vector element |
RealInterpolation |
Provides interpolation operations which are only applicable for real data vectors. |
RealNumber |
A real floating pointer number intended to abstract over |
RealVectorOperations |
Defines all operations which are valid on |
RededicateVector |
This trait allows to change a vector type. The operations will
convert a vector to a different type and set |
Scale |
An operation which multiplies each vector element with a constant |
SymmetricFrequencyDomainOperations |
Defines all operations which are valid on |
SymmetricTimeDomainOperations |
Defines all operations which are valid on |
TimeDomainOperations |
Defines all operations which are valid on |
VectorConvolution |
Provides a convolution operation for data vectors with data vectors. |
Type Definitions
ComplexFreqVector32 |
Specialization of a vector for a certain data type. |
ComplexFreqVector64 |
Specialization of a vector for a certain data type. |
ComplexTimeVector32 |
Specialization of a vector for a certain data type. |
ComplexTimeVector64 |
Specialization of a vector for a certain data type. |
DataVector32 |
Specialization of a vector for a certain data type. |
DataVector64 |
Specialization of a vector for a certain data type. |
RealFreqVector32 |
Specialization of a vector for a certain data type. |
RealFreqVector64 |
Specialization of a vector for a certain data type. |
RealTimeVector32 |
Specialization of a vector for a certain data type. |
RealTimeVector64 |
Specialization of a vector for a certain data type. |
VecResult |
Result contains on success the vector. On failure it contains an error reason and an vector with invalid data which still can be used in order to avoid memory allocation. |
VoidResult |
Void/nothing in case of success or a reason in case of an error. |