Jet  v1.3.3
vector_expression.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_VECTOR_EXPRESSION_H_
8 #define INCLUDE_JET_VECTOR_EXPRESSION_H_
9 
10 #include <jet/functors.h>
11 
12 namespace jet {
13 
14 // MARK: VectorExpression
15 
24 template <typename T, typename E>
26  public:
28  size_t size() const;
29 
31  const E& operator()() const;
32 };
33 
34 // MARK: VectorUnaryOp
35 
46 template <typename T, typename E, typename Op>
47 class VectorUnaryOp : public VectorExpression<T, VectorUnaryOp<T, E, Op>> {
48  public:
50  VectorUnaryOp(const E& u);
51 
53  size_t size() const;
54 
56  T operator[](size_t i) const;
57 
58  private:
59  const E& _u;
60  Op _op;
61 };
62 
63 // MARK: VectorUnaryOp Aliases
64 
66 template <typename T, typename E, typename U>
68 
69 // MARK: VectorBinaryOp
70 
82 template <typename T, typename E1, typename E2, typename Op>
84  : public VectorExpression<T, VectorBinaryOp<T, E1, E2, Op>> {
85  public:
88  VectorBinaryOp(const E1& u, const E2& v);
89 
91  size_t size() const;
92 
94  T operator[](size_t i) const;
95 
96  private:
97  const E1& _u;
98  const E2& _v;
99  Op _op;
100 };
101 
112 template <typename T, typename E, typename Op>
114  : public VectorExpression<T, VectorScalarBinaryOp<T, E, Op>> {
115  public:
117  VectorScalarBinaryOp(const E& u, const T& v);
118 
120  size_t size() const;
121 
123  T operator[](size_t i) const;
124 
125  private:
126  const E& _u;
127  T _v;
128  Op _op;
129 };
130 
131 // MARK: VectorBinaryOp Aliases
132 
134 template <typename T, typename E1, typename E2>
136 
138 template <typename T, typename E>
140 
142 template <typename T, typename E1, typename E2>
144 
146 template <typename T, typename E>
148 
150 template <typename T, typename E>
152 
154 template <typename T, typename E1, typename E2>
156 
158 template <typename T, typename E>
160 
162 template <typename T, typename E1, typename E2>
164 
166 template <typename T, typename E>
168 
170 template <typename T, typename E>
172 
173 // MARK: Global Functions
174 
176 template <typename T, typename E>
178 
180 template <typename T, typename E>
182 
184 template <typename T, typename E1, typename E2>
186  const VectorExpression<T, E2>& b);
187 
189 template <typename T, typename E>
191 
193 template <typename T, typename E>
195 
197 template <typename T, typename E1, typename E2>
199  const VectorExpression<T, E2>& b);
200 
202 template <typename T, typename E>
204 
206 template <typename T, typename E>
208 
210 template <typename T, typename E1, typename E2>
212  const VectorExpression<T, E2>& b);
213 
215 template <typename T, typename E>
217 
219 template <typename T, typename E>
221 
223 template <typename T, typename E1, typename E2>
225  const VectorExpression<T, E2>& b);
226 
227 } // namespace jet
228 
229 #include "detail/vector_expression-inl.h"
230 
231 #endif // INCLUDE_JET_VECTOR_EXPRESSION_H_
jet::VectorExpression
Base class for vector expression.
Definition: vector_expression.h:25
functors.h
jet::VectorUnaryOp
Vector expression for unary operation.
Definition: vector_expression.h:47
jet::VectorBinaryOp::VectorBinaryOp
VectorBinaryOp(const E1 &u, const E2 &v)
jet::VectorScalarBinaryOp
Vector expression for matrix-scalar binary operation.
Definition: vector_expression.h:114
jet::VectorScalarBinaryOp::VectorScalarBinaryOp
VectorScalarBinaryOp(const E &u, const T &v)
Constructs a binary expression for given vector and scalar.
jet::VectorUnaryOp::operator[]
T operator[](size_t i) const
Returns vector element at i.
jet::VectorBinaryOp
Vector expression for binary operation.
Definition: vector_expression.h:84
jet
Definition: advection_solver2.h:18
jet::VectorUnaryOp::VectorUnaryOp
VectorUnaryOp(const E &u)
Constructs unary operation expression for given input expression.
jet::operator+
Matrix2x2< T > operator+(const Matrix2x2< T > &a, const Matrix2x2< T > &b)
Returns a + b (element-size).
jet::VectorScalarBinaryOp::size
size_t size() const
Size of the matrix.
jet::VectorExpression::size
size_t size() const
Size of the vector.
jet::VectorUnaryOp::size
size_t size() const
Size of the matrix.
jet::VectorBinaryOp::operator[]
T operator[](size_t i) const
Returns vector element at i.
jet::VectorExpression::operator()
const E & operator()() const
Returns actual implementation (the subclass).
jet::VectorScalarBinaryOp::operator[]
T operator[](size_t i) const
Returns vector element at i.
jet::operator/
Matrix2x2< T > operator/(const Matrix2x2< T > &a, T b)
Returns a' / b, where every element of matrix a' is a.
jet::VectorBinaryOp::size
size_t size() const
Size of the matrix.
jet::operator-
Matrix2x2< T > operator-(const Matrix2x2< T > &a)
Returns a matrix with opposite sign.
jet::operator*
Matrix2x2< T > operator*(const Matrix2x2< T > &a, T b)
Returns a * b', where every element of matrix b' is b.