35 value_t<A>
sum(
const A& a) {
36 if constexpr (is_dma<A>) {
40 a.ensure_cpu_up_to_date();
42 [[maybe_unused]]
const auto* m_a = a.memory_start();
43 [[maybe_unused]]
const auto* m_b = ones.memory_start();
45 if constexpr (is_single_precision<A>) {
46 return cblas_sdot(etl::size(a), m_a, 1, m_b, 1);
47 }
else if constexpr (is_double_precision<A>) {
48 return cblas_ddot(etl::size(a), m_a, 1, m_b, 1);
50 cpp_unreachable(
"BLAS not enabled/available");
53 cpp_unreachable(
"BLAS not enabled/available");
63 value_t<A>
asum(
const A& a) {
64 if constexpr (is_dma<A>) {
65 a.ensure_cpu_up_to_date();
67 if constexpr (is_single_precision<A>) {
68 return cblas_sasum(etl::size(a), a.memory_start(), 1);
69 }
else if constexpr (is_double_precision<A>) {
70 return cblas_dasum(etl::size(a), a.memory_start(), 1);
72 cpp_unreachable(
"BLAS not enabled/available");
75 cpp_unreachable(
"BLAS not enabled/available");
88 cpp_unreachable(
"BLAS not enabled/available");
97 cpp_unreachable(
"BLAS not enabled/available");
value_t< E > asum(E &&values)
Returns the sum of all the absolute values contained in the given expression.
Definition: expression_builder.hpp:637
Matrix with run-time fixed dimensions.
Definition: dyn.hpp:26
value_t< E > sum(E &&values)
Returns the sum of all the values contained in the given expression.
Definition: expression_builder.hpp:624
typename decay_traits< E >::value_type value_t
Traits to extract the value type out of an ETL type.
Definition: tmp.hpp:81