pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
prc
core
value
functions
mean.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSD-2-Clause
2
3
#ifndef pRC_CORE_VALUE_FUNCTIONS_MEAN_H
4
#define pRC_CORE_VALUE_FUNCTIONS_MEAN_H
5
6
#include <
prc/core/basic/type_traits.hpp
>
7
#include <
prc/core/functors/add.hpp
>
8
#include <
prc/core/functors/fold.hpp
>
9
#include <
prc/core/value/functions/div.hpp
>
10
#include <
prc/core/value/functions/fold.hpp
>
11
12
namespace
pRC
13
{
21
template
<
class
...
Xs
,
If<IsInvocable<Fold<Add>
,
Xs
...>> = 0>
22
static
inline
constexpr
auto
mean
(
Xs
&&...
args
)
23
{
24
using
R
=
RemoveConstReference<ResultOf<Fold<Add>
,
Xs
...>>;
25
return
fold<Add>
(
forward<Xs>
(
args
)...) /
26
identity<typename R::Value>
(
sizeof
...(
args
));
27
}
28
}
29
#endif
// pRC_CORE_VALUE_FUNCTIONS_MEAN_H
type_traits.hpp
add.hpp
fold.hpp
pRC
Definition
cholesky.hpp:18
pRC::mean
static constexpr auto mean(Xs &&...args)
Calculates the mean of a variable ammount of pRC objects.
Definition
mean.hpp:22
pRC::copy
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition
copy.hpp:13
pRC::RemoveConstReference
RemoveConst< RemoveReference< T > > RemoveConstReference
Definition
type_traits.hpp:62
div.hpp
fold.hpp
Generated by
1.9.8