quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_algo.a #include <Covariance.h> Covariance(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, NORMALIZATION normalization = DEF_NORMALIZATION, long order = DEF_ORDER); boolean eq(const Covariance& arg) const; boolean compute(MatrixFloat& output, const VectorFloat& input);
description:VectorFloat input(L"1.0, 2.0, 3.0, 4.0, 5.0"); MatrixFloat output; Covariance cov(4); cov.compute(output, input);
static const String CLASS_NAME = L"Covariance";
enum ALGORITHM { NORMAL = 0, DEF_ALGORITHM = NORMAL };
enum IMPLEMENTATION { FACTORED = 0, UNFACTORED, DEF_IMPLEMENTATION = FACTORED };
enum NORMALIZATION { NONE = 0, LENGTH, UNIT_ENERGY, DEF_NORMALIZATION = NONE };
static const NameMap Covariance::ALGO_MAP(L"NORMAL");
static const NameMap Covariance::IMPL_MAP(L"FACTORED, UNFACTORED");
static const NameMap NORM_MAP = L"NONE, LENGTH, UNIT_ENERGY";
static const String Covariance::DEF_PARAM = L"";
static const String Covariance::PARAM_ALGORITHM = L"algorithm";
static const String Covariance::PARAM_IMPLEMENTATION = L"implementation";
static const String Covariance::PARAM_MODE = L"mode";
static const String Covariance::PARAM_NORMALIZATION = L"normalization";
static const String Covariance::PARAM_ORDER = L"order";
static const long DEF_ORDER = (long)-1;
static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE = AlgorithmData::SIGNAL;
static const long ERR = 70400;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
NORMALIZATION normalization_d;
Long order_d;
Vector>MatrixFloat< accum_cov_d;
Vector>VectorFloat< accum_sum_d;
Long accum_frame_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Covariance();
Covariance(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, NORMALIZATION normalization = DEF_NORMALIZATION, long order = DEF_ORDER);
Covariance(const Covariance& arg);
boolean assign(const Covariance& arg);
Covariance& operator= (const Covariance& arg);
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, constString& pname = DEF_PARAM) const;
boolean eq(const Covariance& arg) const;
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);
boolean setAlgorithm(ALGORITHM algorithm);
boolean setImplementation(IMPLEMENTATION implementation);
boolean setNormalization(NORMALIZATION normalization);
boolean setOrder(long order);
boolean set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, NORMALIZATION normalization = DEF_NORMALIZATION, long order = DEF_ORDER);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
NORMALIZATION getNormalization() const;
long getOrder() const;
boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation, NORMALIZATION& normalization, long& order) const;
boolean compute(MatrixFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean compute(MatrixComplexFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean assign(const AlgorithmBase& arg);
boolean eq(const AlgorithmBase& arg) const;
boolean const String& className() const;
boolean init();
boolean apply(Vector<AlgorithmData>& output, const Vector< CircularBuffer<AlgorithmData> >& input);
long getLeadingPad() const;
long getTrailingPad() const;
boolean setParser(SofParser* parser);
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);
boolean computeNormalFactored(MatrixFloat& covcoeff, const VectorFloat& input);
boolean computeNormalUnFactored(MatrixFloat& covcoeff, const VectorFloat& input);
boolean computeAccumulate(MatrixFloat& output, const VectorFloat& input, long chan);
// declare the Covariance object // Covariance cov; // declare the input and output vectors // VectorFloat input; MatrixFloat output; // calculate the covariance for the following function // x(n) = 0 when n = 0, 1, 2, 3; // x(n) = pow(0.9, 2(n-4)) - pow(0.9, (n-4)), when 4 <= n < 20; // x(n) = 0 when n = 20, 21, 22, 23 // input.setLength(24); double z = 1; for (long i = 4; i < 20; i++) { input(i) = z * z - z; z = 0.9 * z; } // set the order // cov.setOrder(4); // compute the output // cov.compute(output, input);