name: LogAreaRatio : public AlgorithmBase

synopsis:

```g++ [flags ...] file ... -l /isip/tools/lib/\$ISIP_BINARY/lib_algo.a

#include <LogAreaRatio.h>

LogAreaRatio(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, long order = DEF_ORDER);
boolean eq(const LogAreaRatio& arg);
boolean setAlgorithm(ALGORITHM algorithm);
boolean compute(VectorFloat& vector_out, const VectorFloat& vector_in, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
```
quick start:

```LogAreaRatio lar;
VectorFloat input(L"1, 0, -1");
VectorFloat output;
lar.setAlgorithm(LATTICE);
lar.compute(output, input, AlgorithmData::REFLECTION);
```
description:

The LogAreaRatio class is used to compute the log area ratio coefficients from a linear predictive model. A more detailed discussion of this approach can be found in:
J.D. Markel and A.H. Gray, Linear Prediction of Speech, Springer-Verlag, New York, New York, USA, pp. 229-235, 1980.
The input signal can either be the reflection coefficients or the prediction coefficients. LATTICE algorithm and KELLY_LOCHBAUM implementation is currently supported.

The mathematical descriptions of these algorithms are provided below for reference purposes:

Log area ratios have historically been useful in speech coding and synthesis applications, since they directly describe (in theory) the vocal tract area function. They have not been used extensively in speech recognition applications.

dependencies:

public constants:

• define the class name:
`static const String CLASS_NAME = L"LogAreaRatio";`
• define the algorithm choices:
`enum ALGORITHM { LATTICE = 0, DEF_ALGORITHM = LATTICE };`
• define the implementation choices:
`enum IMPLEMENTATION { KELLY_LOCHBAUM = 0,  DEF_IMPLEMENTATION = KELLY_LOCHBAUM };`
• define the static NameMap objects
`static const NameMap LogAreaRatio::ALGO_MAP(L"LATTICE");`
`static const NameMap LogAreaRatio::IMPL_MAP(L"KELLY_LOCHBAUM");`
• define i/o related constants:
`static const String LogAreaRatio::DEF_PARAM = L"";`
`static const String LogAreaRatio::PARAM_ALGORITHM = L"algorithm";`
`static const String LogAreaRatio::PARAM_IMPLEMENTATION = L"implementation";`
• define default argument(s):
`static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE = AlgorithmData::REFLECTION;`
error codes:

protected data:

required public methods:

• static methods:
`static const String& name();`
`static boolean diagnose(Integral::DEBUG debug_level);`
• debug methods: setDebug method is inherited from base class
`boolean debug(const unichar* message) const;`
• destructor/constructor(s):
`~LogAreaRatio();`
`LogAreaRatio(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, long order = DEF_ORDER);`
`LogAreaRatio(const LogAreaRatio& arg);`
• assign methods:
`boolean assign(const LogAreaRatio& arg);`
• operator= methods:
`LogAreaRatio& operator= (const LogAreaRatio& arg);`
• i/o methods:
`long sofSize() const;`
`boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);`
`boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;`
`boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);`
`boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;`
• equality methods:
`boolean eq(const LogAreaRatio& arg) const;`
• memory management methods:
`static void* operator new(size_t size);`
`static void* operator new[](size_t size);`
`static void operator delete(void* ptr);`
`static void operator delete[](void* ptr);`
`static boolean setGrowSize(long grow_size);`
`boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);`
class-specific public methods:

• set methods:
`boolean setAlgorithm(ALGORITHM algorithm);`
`boolean setImplementation(IMPLEMENTATION implementation);`
`boolean setOrder(long order);`
`boolean set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, long order = DEF_ORDER);`
• get methods:
`ALGORITHM getAlgorithm() const;`
`IMPLEMENTATION getImplementation() const;`
`long getOrder() const;`
`boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation, long& order);`
• computational methods:
`boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long index);`
• AlgorithmBase interface contract methods:
`boolean assign(const AlgorithmBase& arg);`
`boolean eq(const AlgorithmBase& arg) const;`
`const String& className() const;`
`boolean apply(Vector<CircularBuffer<AlgorithmData>>& output, const Vector<AlgorithmData>& input);`
`boolean setParser(SofParser* parser);`
private methods:

• common i/o methods:
`boolean readDataCommon(Sof& sof, const String& pname, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);`
`boolean writeDataCommon(Sof& sof, const String& pname = DEF_PARAM) const;`
• algorithm and implementation specific computational methods:
`boolean computeLatticeKellyLochbaum(VectorFloat& output, const VectorFloat& input);`
examples:

• This example shows how to compute the log area ratios from the reflection coefficients:
```// declare an LogAreaRatio object and an output vector
//
LogAreaRatio lar;
VectorFloat output;

// set the input vector
//
VectorFloat input(L"0, 1, 2");

// chooose algorithm
//
lar.setAlgorithm(LogAreaRatio::LATTICE);

// chooose implementation
//
lar.setImplementation(LogAreaRatio::KELLY_LOCHBAUM);

// compute the LogAreaRatio of input data
//
lar.compute(output, input, AlgorithmData::REFLECTION);```
notes:

• none.