Commit 61188689 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP]: start coding first triple function

parent fc2d5da7
......@@ -138,7 +138,6 @@ OBJFILES=pairs_adapter.o \
pairs.o \
patsubst.o \
report_collection.o \
triples.o \
write_name_series.o
croposptest croposp: \
......
......@@ -628,6 +628,36 @@ int main(int iargc, char* argv[])
} // if (opt.compute_coherency)
/* ---------------------------------------------------------------------- */
/* compute amplitude transfer function
* -----------------------------------
*/
if (opt.compute_transfer)
{
if (opt.verbose)
{
cout << endl
<< "Compute amplitude transfer function for all pairs of signals."
<< endl;
}
TFXX_assert(pairs.size()>2, "requires at least three input time series");
croposp::TNamedSeriesVector transfer_vector(pairs.triples());
TFXX_assert(PSD_vector.size()==pairs.size(),
"inconsistency; report this as a bug");
TFXX_assert(CPSD_vector.size()==pairs.pairs(),
"inconsistency; report this as a bug");
/* ======================================================================
* NOTICE: the direct access to a linear vector of triples requires its
* own indexing scheme; this cannot be accomplished by means of class
* Pairs.
* */
} // if (opt.compute_coherency)
} // main()
/* ----- END OF croposp.cc ----- */
......@@ -96,21 +96,11 @@ namespace croposp {
const unsigned int& l) const;
unsigned int size() const;
unsigned int pairs() const;
unsigned int triples() const;
private:
unsigned int Mn;
}; // class Pairs
/* ---------------------------------------------------------------------- */
/*! provide index values to triples
*
* cycle through a complete set
*/
class Triples {
public:
Triples(const unsigned int& n);
}; // class Triples
/* ====================================================================== */
/* functions
* ---------
......
......@@ -96,10 +96,20 @@ namespace croposp {
unsigned int Pairs::pairs() const
{
TFXX_assert(this->size()>1, "size is too small to build pairs");
unsigned int retval=(this->Mn*(this->Mn-1))/2;
return(retval);
} // unsigned int Pairs::size() const
/* ---------------------------------------------------------------------- */
unsigned int Pairs::triples() const
{
TFXX_assert(this->size()>2, "size is too small to build triples");
unsigned int retval=(this->Mn*(this->Mn-1)*(this->Mn-2))/2;
return(retval);
} // unsigned int Pairs::triples() const
} // namespace croposp
/* ----- END OF pairs.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment