Xped
Loading...
Searching...
No Matches
VectorInterface_Cyclops_impl.hpp
Go to the documentation of this file.
1#ifndef VECTOR_INTERFACE_CYCLOPS_IMPL_H_
2#define VECTOR_INTERFACE_CYCLOPS_IMPL_H_
3
4#include "ctf.hpp"
5
6namespace Xped {
7
9{
10 // typedefs
11 template <typename Scalar>
12 using VType = CTF::Vector<Scalar>;
13
14 typedef int VIndextype;
15
16 // constructors
17 template <typename Scalar>
18 static VType<Scalar> construct(const VIndextype& elems, CTF::World& world);
19
20 template <typename Scalar>
21 static VType<Scalar> construct_with_zero(const VIndextype& elems, CTF::World& world);
22
23 template <typename Scalar>
24 static void resize(VType<Scalar>& V, const VIndextype& new_elems);
25
26 // initialization
27 template <typename Scalar>
28 static void setZero(VType<Scalar>& V);
29
30 template <typename Scalar>
31 static void setRandom(VType<Scalar>& V);
32
33 template <typename Scalar>
34 static void setConstant(VType<Scalar>& V, const Scalar& val);
35
36 // shape
37 template <typename Scalar>
38 static VIndextype length(const VType<Scalar>& V);
39
40 // template <typename Scalar, typename VT1, typename VT2>
41 // static auto add(VT1&& V1, VT2&& V2)
42 // {
43 // VType<Scalar> res(V1.len);
44 // res["i"] = V1["i"] + V2["i"];
45 // return res;
46 // }
47
48 // template <typename Scalar, typename VT1, typename VT2>
49 // static auto difference(VT1&& V1, VT2&& V2)
50 // {
51 // VType<Scalar> res(V1.len);
52 // res["i"] = V1["i"] - V2["i"];
53 // return res;
54 // }
55
56 template <typename Scalar, typename VT1>
57 static VType<Scalar> scale(VT1&& V, const Scalar& val);
58
59 // block
60 template <typename Scalar>
61 static VType<Scalar> sub(const VType<Scalar>& V, const VIndextype& off, const VIndextype& elems);
62
63 template <typename Scalar>
64 static std::string print(const VType<Scalar>& V);
65
66 template <typename Scalar, typename VT>
67 static void vec_to_stdvec(VT&& V, std::vector<Scalar>& vec);
68};
69
70} // namespace Xped
71
72#ifndef XPED_COMPILED_LIB
74#endif
75
76#endif
Definition: bench.cpp:62
Definition: VectorInterface_Cyclops_impl.hpp:9
static void setZero(VType< Scalar > &V)
Definition: VectorInterface_Cyclops_impl.cpp:34
static void vec_to_stdvec(VT &&V, std::vector< Scalar > &vec)
Definition: VectorInterface_Cyclops_impl.cpp:98
static VType< Scalar > construct(const VIndextype &elems, CTF::World &world)
Definition: VectorInterface_Cyclops_impl.cpp:15
static VType< Scalar > construct_with_zero(const VIndextype &elems, CTF::World &world)
Definition: VectorInterface_Cyclops_impl.cpp:21
static VIndextype length(const VType< Scalar > &V)
Definition: VectorInterface_Cyclops_impl.cpp:53
int VIndextype
Definition: VectorInterface_Cyclops_impl.hpp:14
static void setRandom(VType< Scalar > &V)
Definition: VectorInterface_Cyclops_impl.cpp:40
static std::string print(const VType< Scalar > &V)
Definition: VectorInterface_Cyclops_impl.cpp:92
static void setConstant(VType< Scalar > &V, const Scalar &val)
Definition: VectorInterface_Cyclops_impl.cpp:46
static void resize(VType< Scalar > &V, const VIndextype &new_elems)
Definition: VectorInterface_Cyclops_impl.cpp:27
static VType< Scalar > scale(VT1 &&V, const Scalar &val)
Definition: VectorInterface_Cyclops_impl.cpp:75
CTF::Vector< Scalar > VType
Definition: VectorInterface_Cyclops_impl.hpp:12
static VType< Scalar > sub(const VType< Scalar > &V, const VIndextype &off, const VIndextype &elems)
Definition: VectorInterface_Cyclops_impl.cpp:84