3#include "backend/predicate.h"
9#include "backend/blas1_dispatch_scalar.h"
10#include "backend/blas1_dispatch_shared.h"
14#include "backend/blas1_dispatch_mpi.h"
16#include "backend/blas1_dispatch_vector.h"
17#include "backend/blas1_dispatch_map.h"
38template<
class ContainerType,
class BinarySubroutine,
class Functor,
class ContainerType0,
class ...ContainerTypes>
39inline void evaluate( ContainerType&
y, BinarySubroutine f, Functor g,
const ContainerType0& x0,
const ContainerTypes& ...xs);
86template<
class ContainerType1,
class ContainerType2>
89 std::vector<int64_t> acc = dg::blas1::detail::doDot_superacc(
x,
y);
137template<
class ContainerType,
class OutputType,
class BinaryOp,
class UnaryOp
139inline OutputType
reduce(
const ContainerType& x, OutputType
zero, BinaryOp
140 binary_op, UnaryOp unary_op = UnaryOp())
144 return dg::blas1::detail::doReduce(
163template<
class ContainerTypeIn,
class ContainerTypeOut>
164inline void copy(
const ContainerTypeIn& source, ContainerTypeOut& target){
165 if( std::is_same<ContainerTypeIn, ContainerTypeOut>::value && &source==(
const ContainerTypeIn*)&target)
184template<
class ContainerType>
206template<
class ContainerType>
230template<
class ContainerType,
class ContainerType1>
234 if( alpha == value_type(0) ) {
238 if( std::is_same<ContainerType, ContainerType1>::value && &
x==(
const ContainerType1*)&
y){
264template<
class ContainerType,
class ContainerType1,
class ContainerType2>
268 if( alpha == value_type(0) )
273 else if( beta == value_type(0) )
278 if( std::is_same<ContainerType1, ContainerType2>::value && &
x==(
const ContainerType1*)&
y){
282 else if( std::is_same<ContainerType1, ContainerType>::value && &
x==(
const ContainerType1*)&
z){
286 else if( std::is_same<ContainerType2, ContainerType>::value && &
y==(
const ContainerType2*)&
z){
310template<
class ContainerType,
class ContainerType1,
class ContainerType2>
335template<
class ContainerType,
class ContainerType1,
class ContainerType2>
343 if( std::is_same<ContainerType, ContainerType1>::value && &x1==(
const ContainerType1*)&
y){
348 if( std::is_same<ContainerType, ContainerType2>::value && &x2==(
const ContainerType2*)&
y){
371template<
class ContainerType,
class ContainerType1,
class ContainerType2>
372inline void pointwiseDot(
const ContainerType1& x1,
const ContainerType2& x2, ContainerType& y)
397template<
class ContainerType,
class ContainerType1,
class ContainerType2,
class ContainerType3>
427template<
class ContainerType,
class ContainerType1,
class ContainerType2>
434 if( std::is_same<ContainerType, ContainerType1>::value && &x1==(
const ContainerType1*)&
y){
459template<
class ContainerType,
class ContainerType1,
class ContainerType2>
460inline void pointwiseDivide(
const ContainerType1& x1,
const ContainerType2& x2, ContainerType& y)
488template<
class ContainerType,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerType4>
494 if( alpha==value_type(0)){
498 else if( beta==value_type(0)){
523template<
class ContainerType,
class ContainerType1,
class UnaryOp>
524inline void transform(
const ContainerType1& x, ContainerType& y, UnaryOp op )
555template<
class ContainerType,
class BinarySubroutine,
class Functor,
class ContainerType0,
class ...ContainerTypes>
556inline void evaluate( ContainerType& y, BinarySubroutine f, Functor g,
const ContainerType0& x0,
const ContainerTypes& ...xs)
565template<
class ContainerType1,
class ContainerType2>
566inline std::vector<int64_t> doDot_superacc(
const ContainerType1& x,
const ContainerType2& y)
568 static_assert( all_true<
569 dg::is_vector<ContainerType1>::value,
570 dg::is_vector<ContainerType2>::value>::value,
571 "All container types must have a vector data layout (AnyVector)!");
572 using vector_type = find_if_t<dg::is_not_scalar, ContainerType1, ContainerType1, ContainerType2>;
574 static_assert( all_true<
575 dg::is_scalar_or_same_base_category<ContainerType1, tensor_category>::value,
576 dg::is_scalar_or_same_base_category<ContainerType2, tensor_category>::value
578 "All container types must be either Scalar or have compatible Vector categories (AnyVector or Same base class)!");
579 return doDot_superacc( x, y, tensor_category());
617template<
class Subroutine,
class ContainerType,
class ...ContainerTypes>
618inline void subroutine( Subroutine f, ContainerType&& x, ContainerTypes&&... xs)
620 static_assert( all_true<
621 dg::is_vector<ContainerType>::value,
622 dg::is_vector<ContainerTypes>::value...>::value,
623 "All container types must have a vector data layout (AnyVector)!");
624 using vector_type = find_if_t<dg::is_not_scalar, ContainerType, ContainerType, ContainerTypes...>;
626 static_assert( all_true<
627 dg::is_scalar_or_same_base_category<ContainerType, tensor_category>::value,
628 dg::is_scalar_or_same_base_category<ContainerTypes, tensor_category>::value...
630 "All container types must be either Scalar or have compatible Vector categories (AnyVector or Same base class)!");
632 dg::blas1::detail::doSubroutine(tensor_category(), f, std::forward<ContainerType>(
x), std::forward<ContainerTypes>(xs)...);
664template<
class from_ContainerType,
class ContainerType,
class ...Params>
665inline void assign(
const from_ContainerType& from, ContainerType&
to, Params&& ... ps)
695template<
class ContainerType,
class from_ContainerType,
class ...Params>
696inline ContainerType
construct(
const from_ContainerType& from, Params&& ... ps)
ContainerType construct(const from_ContainerType &from, Params &&... ps)
Generic way to construct an object of ContainerType given a from_ContainerType object and optional ad...
Definition: blas1.h:696
void assign(const from_ContainerType &from, ContainerType &to, Params &&... ps)
Generic way to assign the contents of a from_ContainerType object to a ContainerType object optionall...
Definition: blas1.h:665
static DG_DEVICE double zero(double x)
Definition: functions.h:29
void copy(const ContainerTypeIn &source, ContainerTypeOut &target)
Definition: blas1.h:164
void plus(ContainerType &x, get_value_type< ContainerType > alpha)
Definition: blas1.h:207
void transform(const ContainerType1 &x, ContainerType &y, UnaryOp op)
Definition: blas1.h:524
void axpbypgz(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, const ContainerType2 &y, get_value_type< ContainerType > gamma, ContainerType &z)
Definition: blas1.h:265
void axpby(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:231
OutputType reduce(const ContainerType &x, OutputType zero, BinaryOp binary_op, UnaryOp unary_op=UnaryOp())
Custom (transform) reduction
Definition: blas1.h:139
void subroutine(Subroutine f, ContainerType &&x, ContainerTypes &&... xs)
; Customizable and generic blas1 function
Definition: blas1.h:618
void scal(ContainerType &x, get_value_type< ContainerType > alpha)
Definition: blas1.h:185
void evaluate(ContainerType &y, BinarySubroutine f, Functor g, const ContainerType0 &x0, const ContainerTypes &...xs)
Definition: blas1.h:556
void pointwiseDivide(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:428
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
get_value_type< ContainerType1 > dot(const ContainerType1 &x, const ContainerType2 &y)
Binary reproducible Euclidean dot product between two vectors
Definition: blas1.h:87
to
Switch for the Timeloop integrate function.
Definition: ode.h:17
typename TensorTraits< std::decay_t< Vector > >::tensor_category get_tensor_category
Definition: tensor_traits.h:40
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
static double Round(int64_t *accumulator)
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Definition: subroutines.h:245
Definition: subroutines.h:273
Definition: subroutines.h:259
Definition: subroutines.h:193
Definition: subroutines.h:11
Definition: subroutines.h:108
Definition: subroutines.h:231
Definition: subroutines.h:317
Definition: subroutines.h:289
Definition: subroutines.h:218
Definition: subroutines.h:72
Definition: subroutines.h:22