Back to C-ASPT Contents Page
asptRdrlms32f
API Summary
API to create and delete an asptRdrlms32f filters
API to filter through and update an asptRdrlms32f filters
- DT32F rdrlms32fFilterUpdate(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
- DT32F rdrlms32fFilterUpdateSignErr(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
- DT32F rdrlms32fFilterUpdateSignReg(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
- DT32F rdrlms32fFilterUpdateSignSign(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
- DT32F rdrlms32fFilterOnly(asptRdrlms32f *rdrlms, DT32F inp)
- DT32F rdrlms32fLCFilterUpdate(asptRdrlms32f *rdrlms, DT32F des)
- DT32F rdrlms32fLCFilterUpdateSignErr(asptRdrlms32f *rdrlms, DT32F des)
- DT32F rdrlms32fLCFilterUpdateSignReg(asptRdrlms32f *rdrlms, DT32F des)
- DT32F rdrlms32fLCFilterUpdateSignSign(asptRdrlms32f *rdrlms, DT32F des)
- DT32F rdrlms32fLCFilterOnly(asptRdrlms32f *rdrlms)
API to retrieve the properties of an asptRdrlms32f filter
API to set the properties of an asptRdrlms32f filter
- DT32S rdrlms32fReset(asptRdrlms32f *rdrlms)
- DT32S rdrlms32fResetDelayLine(asptRdrlms32f *rdrlms)
- DT32S rdrlms32fResize(asptRdrlms32f *rdrlms, DT32S newLength)
- DT32S rdrlms32fSetCoef(asptRdrlms32f *rdrlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S rdrlms32fSetDelayLine(asptRdrlms32f *rdrlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- rdrlms32fSetStepSize( asptRdrlms32f
*rdrlms, newStep )
Description
Implements the Recent Data Reusing Least Mean Squares (RDRLMS) adaptive filter algorithm.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
rdrlms32fInit
DT32S rdrlms32fInit (asptRdrlms32f *rdrlms,DT32S L, DT32F mu, DT32S R)
Initializes an asptRdrlms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- rdrlms : asptRdrlms32f filter to be initialized
- L : number of filter coefficients
- mu : step size
- R : number of data reusing cycles; R=0 is the LMS case
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_RANGE_ERR : L/R is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
rdrlms32fInitStatic
DT32S rdrlms32fInitStatic(asptRdrlms32f *rdrlms,DT32S L, DT32F mu, DT32S R, DT32F *pCof, DT32F *pDat)
Initializes an asptRdrlms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- rdrlms : asptRdrlms32f filter to be initialized
- L : number of filter coefficients
- mu : step size
- R : number of data reusing cycles; R=0 is the LMS case
- pCof : pointer to a pre-allocated memory block to be used
for the adaptive filter coefficients. At least L memory locations must be available starting at this memory address.
- pDat : pointer to a pre-allocated memory block to be used
for data storage. At least L+2*R+1 memory locations must be available starting at this memory address
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : L/R is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
rdrlms32fFilterUpdate
DT32F rdrlms32fFilterUpdate(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the DRLMS algorithm. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fFilterUpdateSignErr
DT32F rdrlms32fFilterUpdateSignErr(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Recent Data Reusing Sign Error LMS algorithm. The sign of the error sample is used in the coefficients update instead of the error value. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fFilterUpdateSignReg
DT32F rdrlms32fFilterUpdateSignReg(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Recent Data Reusing Sign Regressor LMS algorithm. The sign of the input sample is used in the coefficients update instead of the input sample value. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fFilterUpdateSignSign
DT32F rdrlms32fFilterUpdateSignSign(asptRdrlms32f *rdrlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Recent Data Reusing Sign-Sign LMS algorithm. The sign of the input sample as well as the sign of the error sample are used in the coefficients update instead of the input sample value and the input sample value. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fFilterOnly
DT32F rdrlms32fFilterOnly(asptRdrlms32f *rdrlms, DT32F inp)
Calculates the filter output but does not updates the coefficients. It also updates the power estimate of the input signal. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- inp : new input sample.
- Remarks :
-
error sample is not calculated.
<< Back to top
rdrlms32fLCFilterUpdate
DT32F rdrlms32fLCFilterUpdate(asptRdrlms32f *rdrlms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the RDRLMS algorithm for the linear combiner filter configuration. Assumes that the data delay line is externally filled with samples, therefore does not update the internal delay line. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fLCFilterUpdateSignErr
DT32F rdrlms32fLCFilterUpdateSignErr(asptRdrlms32f *rdrlms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Error RDRLMS algorithm for the Linear Combiner filter configuration. The sign of the error sample is used in the coefficients update instead of the error value itself. Assumes that the data delay line is externally filled with samples, therefore does not update the internal delay line. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fLCFilterUpdateSignReg
DT32F rdrlms32fLCFilterUpdateSignReg(asptRdrlms32f *rdrlms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Regressor RDRLMS algorithm for the Linear Combiner filter configuration. The sign of the input sample is used in the coefficients update instead of the input sample value. Assumes that the data delay line is externally filled with samples, therefore does not update the internal delay line. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fLCFilterUpdateSignSign
DT32F rdrlms32fLCFilterUpdateSignSign(asptRdrlms32f *rdrlms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Sign RDRLMS algorithm for the Linear Combiner filter configuration. The sign of the error sample as well as the sign of the input sample are used in the coefficients update instead of the error and input values. Assumes that the data delay line is externally filled with samples, therefore does not update the internal delay line. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling rdrlms32fGetLastErrorSample().
<< Back to top
rdrlms32fLCFilterOnly
DT32F rdrlms32fLCFilterOnly(asptRdrlms32f *rdrlms)
Calculates the filter output but does not updates the coefficients for the Linear Combiner Configuration. Assumes that the data delay line is externally filled with samples, therefore does not update the internal delay line. - Returns :
-
The filter output sample.
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- Remarks :
-
error sample is not calculated.
<< Back to top
rdrlms32fFree
void rdrlms32fFree(asptRdrlms32f *rdrlms)
Frees the allocated memory for this asptRdrlms32f filter. - Returns :
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter
- Remarks :
-
Use this function only with filters created with rdrlms32fInit(). Do not use with asptRdrlms32f filters created using rdrlms32fInitStatic().
<< Back to top
rdrlms32fReset
DT32S rdrlms32fReset(asptRdrlms32f *rdrlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- rdrlms : pointer to asptRdrlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
rdrlms32fResetDelayLine
DT32S rdrlms32fResetDelayLine(asptRdrlms32f *rdrlms)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- rdrlms : pointer to asptRdrlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
rdrlms32fGetCoef
DT32S rdrlms32fGetCoef(asptRdrlms32f *rdrlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N internal filter coefficients starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- rdrlms : pointer to asptRdrlms32f filter.
- dstBuf : destination buffer.
- ind : index to the first coefficient to be copied.
- N : number of coefficients to be copied.
- flip : if not 0, will flip the coefficients order
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/rdrlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
rdrlms32fSetCoef
DT32S rdrlms32fSetCoef(asptRdrlms32f *rdrlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal filter coefficients starting from coef[ind] to the contents of newBuf. - Returns :
-
On success returns the number of coefficients initialized, otherwise the error code (negative int).
- Input Parameters :
- rdrlms : pointer to asptRdrlms32f filter to be set.
- newCoef : new coefficients vector.
- ind : index to the first coefficient to be set.
- N : number of coefficients to be set.
- flip : if not 0, will copy the coefficients in reverse order
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/rdrlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
rdrlms32fGetDelayLine
DT32S rdrlms32fGetDelayLine(asptRdrlms32f *rdrlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N internal delay line samples starting from delayLine[ind] to dstBuf. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative int).
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter.
- dstBuf : destination buffer.
- ind : index to the first sample to be copied.
- N : number of samples to be copied.
- flip : if not 0, will flip the samples order.
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/rdrlms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
- Remarks :
-
Samples are stored in dstBuf with newest sample at index 0, and oldest at index N-1, when flip == 0.
<< Back to top
rdrlms32fSetDelayLine
DT32S rdrlms32fSetDelayLine(asptRdrlms32f *rdrlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal delay line samples starting from delayLine[ind] to the contents of the given array. - Returns :
-
On success returns the number of samples initialized, otherwise the error code (negative int).
- Input Parameters :
- rdrlms : pointer to asptRdrlms32f filter.
- newBuf : new data buffer.
- ind : index to the first sample to be copied.
- N : number of samples to be copied.
- flip : if not 0, will flip the samples order.
- Output Parameters :
- rdrlms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/rdrlms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
- Remarks :
-
Samples assumed to be stored in newBuf with newest sample at index 0, and oldest at index N-1, when flip == 0.
<< Back to top
rdrlms32fResize
DT32S rdrlms32fResize(asptRdrlms32f *rdrlms, DT32S newLength)
Resizes an asptRdrlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- rdrlms : pointer to the asptRdrlms32f filter to be resized.
- newLen : required new filter length.
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newLength is not a valid input value
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Use this function only with dynamically allocated asptRdrlms32f filters.