Back to C-ASPT Contents Page
asptLclms32f
API Summary
API to create and delete an asptLclms32f filters
- DT32S lclms32fInit (asptLclms32f *lclms,DT32S L, DT32F mu, DT32F a, DT32F *C)
- DT32S lclms32fInitStatic(asptLclms32f *lclms,DT32S L, DT32F mu, DT32F a, DT32F *C, DT32F *pCof, DT32F *pDat)
- void lclms32fFree(asptLclms32f *lclms)
API to filter through and update an asptLclms32f filters
- DT32F lclms32fFilterUpdate(asptLclms32f *lclms, DT32F inp, DT32F des)
- DT32F lclms32fLCFilterUpdate(asptLclms32f *lclms, DT32F des)
- DT32F lclms32fFilterUpdateSignErr(asptLclms32f *lclms, DT32F inp, DT32F des)
- DT32F lclms32fLCFilterUpdateSignErr(asptLclms32f *lclms, DT32F des)
- DT32F lclms32fFilterUpdateSignReg(asptLclms32f *lclms, DT32F inp, DT32F des)
- DT32F lclms32fLCFilterUpdateSignReg(asptLclms32f *lclms, DT32F des)
- DT32F lclms32fFilterUpdateSignSign(asptLclms32f *lclms, DT32F inp, DT32F des)
- DT32F lclms32fLCFilterUpdateSignSign(asptLclms32f *lclms, DT32F des)
- DT32F lclms32fFilterOnly(asptLclms32f *lclms, DT32F inp)
- DT32F lclms32fLCFilterOnly(asptLclms32f *lclms)
API to retrieve the properties of an asptLclms32f filter
- DT32S lclms32fGetCoef(asptLclms32f *lclms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S lclms32fGetDelayLine(asptLclms32f *lclms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S lclms32fGetCVector(asptLclms32f *lclms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- lclms32fGetCoefPtr( asptLclms32f
*lclms )
- lclms32fGetFilterLength( asptLclms32f
*lclms )
- lclms32fGetDelayLineLength( asptLclms32f
*lclms )
- lclms32fGetLastErrorSample( asptLclms32f
*lclms )
- lclms32fGetStepSize( asptLclms32f
*lclms )
- lclms32fGetCScalar( asptLclms32f
*lclms )
API to set the properties of an asptLclms32f filter
- DT32S lclms32fReset(asptLclms32f *lclms)
- DT32S lclms32fResetDelayLine(asptLclms32f *lclms)
- DT32S lclms32fResize(asptLclms32f *lclms, DT32S newLength)
- DT32S lclms32fSetCoef(asptLclms32f *lclms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S lclms32fSetDelayLine(asptLclms32f *lclms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S lclms32fSetCVector(asptLclms32f *lclms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- lclms32fSetStepSize( asptLclms32f
*lclms, newStep )
- lclms32fSetCScalar( asptLclms32f
*lclms, newA )
Description
Implements the Linearly Constrained LMS adaptive filter algorithm.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
lclms32fInit
DT32S lclms32fInit (asptLclms32f *lclms,DT32S L, DT32F mu, DT32F a, DT32F *C)
Initializes an asptLclms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- lclms : asptLclms32f filter to be initialized
- L : number of filter coefficients
- mu : step size.
- a : constraint scalar, a.
- C : pointer to the constraint vector C of length L elements
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : lclms/C is a NULL pointer
- ASPT_RANGE_ERR : L is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
lclms32fInitStatic
DT32S lclms32fInitStatic(asptLclms32f *lclms,DT32S L, DT32F mu, DT32F a, DT32F *C, DT32F *pCof, DT32F *pDat)
Initializes an asptLclms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- lclms : asptLclms32f filter to be initialized
- L : number of filter coefficients
- mu : step size
- a : constraint scalar, a.
- C : pointer to the constraint vector C of length L elements
- 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 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 is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
lclms32fFilterUpdate
DT32F lclms32fFilterUpdate(asptLclms32f *lclms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Linearly Constrained LMS algorithm. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fFilterUpdateSignErr
DT32F lclms32fFilterUpdateSignErr(asptLclms32f *lclms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Error LCLMS algorithm. The sign of the error sample is used in the coefficients update instead of the error value itself. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fFilterUpdateSignReg
DT32F lclms32fFilterUpdateSignReg(asptLclms32f *lclms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Regressor LCLMS 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 :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fFilterUpdateSignSign
DT32F lclms32fFilterUpdateSignSign(asptLclms32f *lclms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign-Sign LCLMS algorithm. 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. value. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fFilterOnly
DT32F lclms32fFilterOnly(asptLclms32f *lclms, DT32F inp)
Calculates the filter output but does not updates the coefficients. It also updates the internal buffers. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- Remarks :
-
error sample is not calculated.
<< Back to top
lclms32fLCFilterUpdate
DT32F lclms32fLCFilterUpdate(asptLclms32f *lclms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the LCLMS algorithm for the Linear Combiner filter configuration. Assumes the delay line has been already updated before calling this function. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fLCFilterUpdateSignErr
DT32F lclms32fLCFilterUpdateSignErr(asptLclms32f *lclms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Error LCLMS algorithm for the Linear Combiner filter configuration. Assumes the delay line has been already updated before calling this function. The sign of the error sample is used in the coefficients update instead of the error value itself. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fLCFilterUpdateSignReg
DT32F lclms32fLCFilterUpdateSignReg(asptLclms32f *lclms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign Regressor LCLMS algorithm for the Linear Combiner filter configuration. Assumes the delay line has been already updated before calling this function. 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 :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fLCFilterUpdateSignSign
DT32F lclms32fLCFilterUpdateSignSign(asptLclms32f *lclms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Sign-Sign LCLMS algorithm for the Linear Combiner filter configuration. Assumes the delay line has been already updated before calling this function. 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. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling lclms32fGetLastErrorSample().
<< Back to top
lclms32fLCFilterOnly
DT32F lclms32fLCFilterOnly(asptLclms32f *lclms)
Calculates the filter output but does not updates the coefficients. It also updates the input power for the Linear Combiner filter configuration. Assumes the delay line has been already updated before calling this function. - Returns :
-
The filter output sample.
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- inp : new input sample.
- Remarks :
-
error sample is not calculated.
<< Back to top
lclms32fFree
void lclms32fFree(asptLclms32f *lclms)
Frees the allocated memory for this asptLclms32f filter. - Returns :
- Input Parameters :
- lclms : pointer to asptLclms32f filter
- Remarks :
-
Use this function only with filters created with lclms32fInit(). Do not use with asptLclms32f filters created using lclms32fInitStatic().
<< Back to top
lclms32fReset
DT32S lclms32fReset(asptLclms32f *lclms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- lclms : pointer to asptLclms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
lclms32fResetDelayLine
DT32S lclms32fResetDelayLine(asptLclms32f *lclms)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- lclms : pointer to asptLclms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
lclms32fGetCoef
DT32S lclms32fGetCoef(asptLclms32f *lclms, 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 :
- lclms : pointer to asptLclms32f 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/lclms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
lclms32fSetCoef
DT32S lclms32fSetCoef(asptLclms32f *lclms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal filter coefficients starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients initialized, otherwise the error code (negative int).
- Input Parameters :
- lclms : pointer to asptLclms32f 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/lclms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
lclms32fGetCVector
DT32S lclms32fGetCVector(asptLclms32f *lclms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N internal constraint vector coefficients starting from C[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- lclms : pointer to asptLclms32f 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/lclms->C is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
lclms32fSetCVector
DT32S lclms32fSetCVector(asptLclms32f *lclms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N constraint vector coefficients starting from C[ind] to the contents of newC. - Returns :
-
On success returns the number of coefficients initialized, otherwise the error code (negative int).
- Input Parameters :
- lclms : pointer to asptLclms32f filter to be set.
- newC : new constraint 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 : newC/lclms->C is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
lclms32fGetDelayLine
DT32S lclms32fGetDelayLine(asptLclms32f *lclms, 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 :
- lclms : pointer to asptLclms32f 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/lclms->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
lclms32fSetDelayLine
DT32S lclms32fSetDelayLine(asptLclms32f *lclms, 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 :
- lclms : pointer to asptLclms32f 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 :
- lclms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/lclms->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
lclms32fResize
DT32S lclms32fResize(asptLclms32f *lclms, DT32S newLength)
Resizes an asptLclms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- lclms : pointer to the asptLclms32f 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 asptLclms32f filters.