Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
953a25eb
Commit
953a25eb
authored
Feb 08, 2019
by
thomas.forbriger
Browse files
croposp [WP]: provide triples indexer
parent
99ad57c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/ts/croposp/croposp.cc
View file @
953a25eb
...
...
@@ -644,7 +644,8 @@ int main(int iargc, char* argv[])
TFXX_assert
(
pairs
.
size
()
>
2
,
"requires at least three input time series"
);
croposp
::
TNamedSeriesVector
transfer_vector
(
pairs
.
triples
());
croposp
::
Triples
triples
(
pairs
,
true
);
croposp
::
TNamedSeriesVector
transfer_vector
(
triples
.
triples
());
TFXX_assert
(
PSD_vector
.
size
()
==
pairs
.
size
(),
"inconsistency; report this as a bug"
);
...
...
src/ts/croposp/croposp.h
View file @
953a25eb
...
...
@@ -109,7 +109,8 @@ namespace croposp {
class
Triples
{
public:
Triples
(
const
Pairs
&
p
,
const
bool
&
pairs_first
=
false
);
unsigned
int
operator
()(
const
unsigned
int
&
k
,
unsigned
int
operator
()(
const
unsigned
int
&
i
,
const
unsigned
int
&
k
,
const
unsigned
int
&
l
)
const
;
bool
swap
(
const
unsigned
int
&
k
,
const
unsigned
int
&
l
)
const
;
...
...
src/ts/croposp/pairs.cc
View file @
953a25eb
...
...
@@ -101,15 +101,6 @@ namespace croposp {
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 ----- */
src/ts/croposp/triples.cc
View file @
953a25eb
...
...
@@ -47,14 +47,59 @@
namespace
croposp
{
Triples
::
Triples
(
const
Pairs
&
p
,
const
bool
&
pairs_first
=
false
)
:
Triples
::
Triples
(
const
Pairs
&
p
,
const
bool
&
pairs_first
)
:
Mpairs
(
p
),
Mpairs_first
(
pairs_first
)
{
TFXX_assert
(
this
->
size
()
>
2
,
"collection must have at least three elements to make a triple"
);
}
}
// Triples::Triples(const Pairs& p, const bool& pairs_first=false):
/* ---------------------------------------------------------------------- */
unsigned
int
Triples
::
operator
()(
const
unsigned
int
&
i
,
const
unsigned
int
&
k
,
const
unsigned
int
&
l
)
const
{
unsigned
int
retval
=
0
;
TFXX_assert
((
i
!=
k
)
&&
(
k
!=
l
)
&&
(
l
!=
i
),
"triple indices must be unique"
);
return
(
retval
);
}
// unsigned int Triples::operator()(const unsigned int& i,
// const unsigned int& k,
// const unsigned int& l) const
/* ---------------------------------------------------------------------- */
bool
Triples
::
swap
(
const
unsigned
int
&
k
,
const
unsigned
int
&
l
)
const
{
return
(
this
->
Mpairs
.
swap
(
k
,
l
));
}
// bool Triples::swap(const unsigned int& k,
// const unsigned int& l) const
/* ---------------------------------------------------------------------- */
unsigned
int
Triples
::
size
()
const
{
return
(
this
->
Mpairs
.
size
());
}
// unsigned int Triples::size() const
/* ---------------------------------------------------------------------- */
unsigned
int
Triples
::
pairs
()
const
{
return
(
this
->
Mpairs
.
pairs
());
}
// unsigned int Triples::pairs() const
/* ---------------------------------------------------------------------- */
unsigned
int
Triples
::
triples
()
const
{
unsigned
int
n
=
this
->
size
();
unsigned
int
retval
=
n
*
(
n
-
1
)
*
(
n
-
2
)
/
2
;
return
(
retval
);
}
// unsigned int Triples::triples() const
}
// namespace croposp
/* ----- END OF triples.cc ----- */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment