Eigen-unsupported  5.0.1-dev+284dcc12
 
Loading...
Searching...
No Matches
TensorBase.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_CXX11_TENSOR_TENSOR_BASE_H
11#define EIGEN_CXX11_TENSOR_TENSOR_BASE_H
12
13// clang-format off
14
15// IWYU pragma: private
16#include "./InternalHeaderCheck.h"
17
18namespace Eigen {
19
28#ifndef EIGEN_PARSED_BY_DOXYGEN
29// FIXME Doxygen does not like the inheritance with different template parameters
30// Since there is no doxygen documentation inside, we disable it for now
31template<typename Derived>
32class TensorBase<Derived, ReadOnlyAccessors>
33{
34 public:
35 typedef internal::traits<Derived> DerivedTraits;
36 typedef typename DerivedTraits::Scalar Scalar;
37 typedef typename DerivedTraits::Index Index;
38 typedef std::remove_const_t<Scalar> CoeffReturnType;
39 static constexpr int NumDimensions = DerivedTraits::NumDimensions;
40
41 // Generic nullary operation support.
42 template <typename CustomNullaryOp> EIGEN_DEVICE_FUNC
43 EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<CustomNullaryOp, const Derived>
44 nullaryExpr(const CustomNullaryOp& func) const {
45 return TensorCwiseNullaryOp<CustomNullaryOp, const Derived>(derived(), func);
46 }
47
48 // Coefficient-wise nullary operators
49 EIGEN_DEVICE_FUNC
50 EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived>
51 constant(const Scalar& value) const {
52 return nullaryExpr(internal::scalar_constant_op<Scalar>(value));
53 }
54
55 EIGEN_DEVICE_FUNC
56 EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<internal::UniformRandomGenerator<Scalar>, const Derived>
57 random() const {
58 return nullaryExpr(internal::UniformRandomGenerator<Scalar>());
59 }
60 template <typename RandomGenerator> EIGEN_DEVICE_FUNC
61 EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<RandomGenerator, const Derived>
62 random(const RandomGenerator& gen = RandomGenerator()) const {
63 return nullaryExpr(gen);
64 }
65
66 // Tensor generation
67 template <typename Generator> EIGEN_DEVICE_FUNC
68 EIGEN_STRONG_INLINE const TensorGeneratorOp<Generator, const Derived>
69 generate(const Generator& generator) const {
70 return TensorGeneratorOp<Generator, const Derived>(derived(), generator);
71 }
72
73 // Generic unary operation support.
74 template <typename CustomUnaryOp> EIGEN_DEVICE_FUNC
75 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<CustomUnaryOp, const Derived>
76 unaryExpr(const CustomUnaryOp& func) const {
77 return TensorCwiseUnaryOp<CustomUnaryOp, const Derived>(derived(), func);
78 }
79
80 // Coefficient-wise unary operators
81 EIGEN_DEVICE_FUNC
82 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived>
83 operator-() const {
84 return unaryExpr(internal::scalar_opposite_op<Scalar>());
85 }
86
87 EIGEN_DEVICE_FUNC
88 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
89 sqrt() const {
90 return unaryExpr(internal::scalar_sqrt_op<Scalar>());
91 }
92
93 EIGEN_DEVICE_FUNC
94 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived>
95 sign() const {
96 return unaryExpr(internal::scalar_sign_op<Scalar>());
97 }
98
99 EIGEN_DEVICE_FUNC
100 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_rsqrt_op<Scalar>, const Derived>
101 rsqrt() const {
102 return unaryExpr(internal::scalar_rsqrt_op<Scalar>());
103 }
104
105 EIGEN_DEVICE_FUNC
106 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived>
107 square() const {
108 return unaryExpr(internal::scalar_square_op<Scalar>());
109 }
110
111 EIGEN_DEVICE_FUNC
112 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived>
113 cube() const {
114 return unaryExpr(internal::scalar_cube_op<Scalar>());
115 }
116
117 EIGEN_DEVICE_FUNC
118 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
119 inverse() const {
120 return unaryExpr(internal::scalar_inverse_op<Scalar>());
121 }
122
123 EIGEN_DEVICE_FUNC
124 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived>
125 tanh() const {
126 return unaryExpr(internal::scalar_tanh_op<Scalar>());
127 }
128
129 EIGEN_DEVICE_FUNC
130 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_lgamma_op<Scalar>, const Derived>
131 lgamma() const {
132 return unaryExpr(internal::scalar_lgamma_op<Scalar>());
133 }
134
135 EIGEN_DEVICE_FUNC
136 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived>
137 digamma() const {
138 return unaryExpr(internal::scalar_digamma_op<Scalar>());
139 }
140
141 EIGEN_DEVICE_FUNC
142 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_i0_op<Scalar>, const Derived>
143 bessel_i0() const {
144 return unaryExpr(internal::scalar_bessel_i0_op<Scalar>());
145 }
146
147 EIGEN_DEVICE_FUNC
148 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_i0e_op<Scalar>, const Derived>
149 bessel_i0e() const {
150 return unaryExpr(internal::scalar_bessel_i0e_op<Scalar>());
151 }
152
153 EIGEN_DEVICE_FUNC
154 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_i1_op<Scalar>, const Derived>
155 bessel_i1() const {
156 return unaryExpr(internal::scalar_bessel_i1_op<Scalar>());
157 }
158
159 EIGEN_DEVICE_FUNC
160 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_i1e_op<Scalar>, const Derived>
161 bessel_i1e() const {
162 return unaryExpr(internal::scalar_bessel_i1e_op<Scalar>());
163 }
164
165 EIGEN_DEVICE_FUNC
166 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_j0_op<Scalar>, const Derived>
167 bessel_j0() const {
168 return unaryExpr(internal::scalar_bessel_j0_op<Scalar>());
169 }
170
171 EIGEN_DEVICE_FUNC
172 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_y0_op<Scalar>, const Derived>
173 bessel_y0() const {
174 return unaryExpr(internal::scalar_bessel_y0_op<Scalar>());
175 }
176
177 EIGEN_DEVICE_FUNC
178 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_j1_op<Scalar>, const Derived>
179 bessel_j1() const {
180 return unaryExpr(internal::scalar_bessel_j1_op<Scalar>());
181 }
182
183 EIGEN_DEVICE_FUNC
184 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_y1_op<Scalar>, const Derived>
185 bessel_y1() const {
186 return unaryExpr(internal::scalar_bessel_y1_op<Scalar>());
187 }
188
189 EIGEN_DEVICE_FUNC
190 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_k0_op<Scalar>, const Derived>
191 bessel_k0() const {
192 return unaryExpr(internal::scalar_bessel_k0_op<Scalar>());
193 }
194
195 EIGEN_DEVICE_FUNC
196 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_k0e_op<Scalar>, const Derived>
197 bessel_k0e() const {
198 return unaryExpr(internal::scalar_bessel_k0e_op<Scalar>());
199 }
200
201 EIGEN_DEVICE_FUNC
202 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_k1_op<Scalar>, const Derived>
203 bessel_k1() const {
204 return unaryExpr(internal::scalar_bessel_k1_op<Scalar>());
205 }
206
207 EIGEN_DEVICE_FUNC
208 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_bessel_k1e_op<Scalar>, const Derived>
209 bessel_k1e() const {
210 return unaryExpr(internal::scalar_bessel_k1e_op<Scalar>());
211 }
212
213 // igamma(a = this, x = other)
214 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
215 const TensorCwiseBinaryOp<internal::scalar_igamma_op<Scalar>, const Derived, const OtherDerived>
216 igamma(const OtherDerived& other) const {
217 return binaryExpr(other.derived(), internal::scalar_igamma_op<Scalar>());
218 }
219
220 // igamma_der_a(a = this, x = other)
221 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
222 const TensorCwiseBinaryOp<internal::scalar_igamma_der_a_op<Scalar>, const Derived, const OtherDerived>
223 igamma_der_a(const OtherDerived& other) const {
224 return binaryExpr(other.derived(), internal::scalar_igamma_der_a_op<Scalar>());
225 }
226
227 // gamma_sample_der_alpha(alpha = this, sample = other)
228 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
229 const TensorCwiseBinaryOp<internal::scalar_gamma_sample_der_alpha_op<Scalar>, const Derived, const OtherDerived>
230 gamma_sample_der_alpha(const OtherDerived& other) const {
231 return binaryExpr(other.derived(), internal::scalar_gamma_sample_der_alpha_op<Scalar>());
232 }
233
234 // igammac(a = this, x = other)
235 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
236 const TensorCwiseBinaryOp<internal::scalar_igammac_op<Scalar>, const Derived, const OtherDerived>
237 igammac(const OtherDerived& other) const {
238 return binaryExpr(other.derived(), internal::scalar_igammac_op<Scalar>());
239 }
240
241 // zeta(x = this, q = other)
242 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
243 const TensorCwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const OtherDerived>
244 zeta(const OtherDerived& other) const {
245 return binaryExpr(other.derived(), internal::scalar_zeta_op<Scalar>());
246 }
247
248 // polygamma(n = this, x = other)
249 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
250 const TensorCwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const Derived, const OtherDerived>
251 polygamma(const OtherDerived& other) const {
252 return binaryExpr(other.derived(), internal::scalar_polygamma_op<Scalar>());
253 }
254
255 EIGEN_DEVICE_FUNC
256 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_erf_op<Scalar>, const Derived>
257 erf() const {
258 return unaryExpr(internal::scalar_erf_op<Scalar>());
259 }
260
261 EIGEN_DEVICE_FUNC
262 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_erfc_op<Scalar>, const Derived>
263 erfc() const {
264 return unaryExpr(internal::scalar_erfc_op<Scalar>());
265 }
266
267 EIGEN_DEVICE_FUNC
268 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_ndtri_op<Scalar>, const Derived>
269 ndtri() const {
270 return unaryExpr(internal::scalar_ndtri_op<Scalar>());
271 }
272
273 EIGEN_DEVICE_FUNC
274 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_logistic_op<Scalar>, const Derived>
275 sigmoid() const {
276 return unaryExpr(internal::scalar_logistic_op<Scalar>());
277 }
278
279 EIGEN_DEVICE_FUNC
280 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived>
281 exp() const {
282 return unaryExpr(internal::scalar_exp_op<Scalar>());
283 }
284
285 EIGEN_DEVICE_FUNC
286 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_expm1_op<Scalar>, const Derived>
287 expm1() const {
288 return unaryExpr(internal::scalar_expm1_op<Scalar>());
289 }
290
291 EIGEN_DEVICE_FUNC
292 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived>
293 log() const {
294 return unaryExpr(internal::scalar_log_op<Scalar>());
295 }
296
297 EIGEN_DEVICE_FUNC
298 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived>
299 log1p() const {
300 return unaryExpr(internal::scalar_log1p_op<Scalar>());
301 }
302
303 EIGEN_DEVICE_FUNC
304 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_log2_op<Scalar>, const Derived>
305 log2() const {
306 return unaryExpr(internal::scalar_log2_op<Scalar>());
307 }
308
309 EIGEN_DEVICE_FUNC
310 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
311 abs() const {
312 return unaryExpr(internal::scalar_abs_op<Scalar>());
313 }
314
315 EIGEN_DEVICE_FUNC
316 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived>
317 arg() const {
318 return unaryExpr(internal::scalar_arg_op<Scalar>());
319 }
320
321 EIGEN_DEVICE_FUNC
322 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_clamp_op<Scalar>, const Derived>
323 clip(Scalar min, Scalar max) const {
324 return unaryExpr(internal::scalar_clamp_op<Scalar>(min, max));
325 }
326
327 EIGEN_DEVICE_FUNC
328 EIGEN_STRONG_INLINE const std::conditional_t<NumTraits<CoeffReturnType>::IsComplex,
329 TensorCwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Derived>,
330 Derived>
331 conjugate() const {
332 return choose(Cond<NumTraits<CoeffReturnType>::IsComplex>(), unaryExpr(internal::scalar_conjugate_op<Scalar>()), derived());
333 }
334
335 template<typename ScalarExponent>
336 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const std::enable_if_t<internal::is_arithmetic<typename NumTraits<ScalarExponent>::Real>::value,
337 TensorCwiseUnaryOp<internal::scalar_unary_pow_op<Scalar, ScalarExponent>, const Derived>>
338 pow(ScalarExponent exponent) const
339 {
340 return unaryExpr(internal::scalar_unary_pow_op<Scalar, ScalarExponent>(exponent));
341 }
342
343 EIGEN_DEVICE_FUNC
344 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_real_op<Scalar>, const Derived>
345 real() const {
346 return unaryExpr(internal::scalar_real_op<Scalar>());
347 }
348
349 EIGEN_DEVICE_FUNC
350 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_imag_op<Scalar>, const Derived>
351 imag() const {
352 return unaryExpr(internal::scalar_imag_op<Scalar>());
353 }
354
355 EIGEN_DEVICE_FUNC
356 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::bind2nd_op<internal::scalar_sum_op<Scalar,Scalar> >, const Derived>
357 operator+ (Scalar rhs) const {
358 return unaryExpr(internal::bind2nd_op<internal::scalar_sum_op<Scalar,Scalar> >(rhs));
359 }
360
361 EIGEN_DEVICE_FUNC
362 EIGEN_STRONG_INLINE friend
363 const TensorCwiseUnaryOp<internal::bind1st_op<internal::scalar_sum_op<Scalar> >, const Derived>
364 operator+ (Scalar lhs, const Derived& rhs) {
365 return rhs.unaryExpr(internal::bind1st_op<internal::scalar_sum_op<Scalar> >(lhs));
366 }
367
368 EIGEN_DEVICE_FUNC
369 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::bind2nd_op<internal::scalar_difference_op<Scalar,Scalar> >, const Derived>
370 operator- (Scalar rhs) const {
371 EIGEN_STATIC_ASSERT((NumTraits<Scalar>::IsSigned || internal::is_same<Scalar, const std::complex<float> >::value), YOU_MADE_A_PROGRAMMING_MISTAKE);
372 return unaryExpr(internal::bind2nd_op<internal::scalar_difference_op<Scalar,Scalar> >(rhs));
373 }
374
375 EIGEN_DEVICE_FUNC
376 EIGEN_STRONG_INLINE friend
377 const TensorCwiseUnaryOp<internal::bind1st_op<internal::scalar_difference_op<Scalar> >, const Derived>
378 operator- (Scalar lhs, const Derived& rhs) {
379 return rhs.unaryExpr(internal::bind1st_op<internal::scalar_difference_op<Scalar> >(lhs));
380 }
381
382 EIGEN_DEVICE_FUNC
383 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::bind2nd_op<internal::scalar_product_op<Scalar,Scalar> >, const Derived>
384 operator* (Scalar rhs) const {
385 return unaryExpr(internal::bind2nd_op<internal::scalar_product_op<Scalar,Scalar> >(rhs));
386 }
387
388 EIGEN_DEVICE_FUNC
389 EIGEN_STRONG_INLINE friend
390 const TensorCwiseUnaryOp<internal::bind1st_op<internal::scalar_product_op<Scalar> >, const Derived>
391 operator* (Scalar lhs, const Derived& rhs) {
392 return rhs.unaryExpr(internal::bind1st_op<internal::scalar_product_op<Scalar> >(lhs));
393 }
394
395 EIGEN_DEVICE_FUNC
396 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::bind2nd_op<internal::scalar_quotient_op<Scalar,Scalar> >, const Derived>
397 operator/ (Scalar rhs) const {
398 return unaryExpr(internal::bind2nd_op<internal::scalar_quotient_op<Scalar,Scalar> >(rhs));
399 }
400
401 EIGEN_DEVICE_FUNC
402 EIGEN_STRONG_INLINE friend
403 const TensorCwiseUnaryOp<internal::bind1st_op<internal::scalar_quotient_op<Scalar> >, const Derived>
404 operator/ (Scalar lhs, const Derived& rhs) {
405 return rhs.unaryExpr(internal::bind1st_op<internal::scalar_quotient_op<Scalar> >(lhs));
406 }
407
408 EIGEN_DEVICE_FUNC
409 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_mod_op<Scalar>, const Derived>
410 operator% (Scalar rhs) const {
411 EIGEN_STATIC_ASSERT(NumTraits<Scalar>::IsInteger, YOU_MADE_A_PROGRAMMING_MISTAKE_TRY_MOD);
412 return unaryExpr(internal::scalar_mod_op<Scalar>(rhs));
413 }
414
415 template <int NanPropagation=PropagateFast>
416 EIGEN_DEVICE_FUNC
417 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NanPropagation>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
418 cwiseMax(Scalar threshold) const {
419 return cwiseMax<NanPropagation>(constant(threshold));
420 }
421
422 template <int NanPropagation=PropagateFast>
423 EIGEN_DEVICE_FUNC
424 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NanPropagation>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
425 cwiseMin(Scalar threshold) const {
426 return cwiseMin<NanPropagation>(constant(threshold));
427 }
428
429 template<typename NewType>
430 EIGEN_DEVICE_FUNC
431 EIGEN_STRONG_INLINE const std::conditional_t<internal::is_same<NewType, CoeffReturnType>::value,
432 Derived,
433 TensorConversionOp<NewType, const Derived> >
434 cast() const {
435 return choose(Cond<internal::is_same<NewType, CoeffReturnType>::value>(), derived(), TensorConversionOp<NewType, const Derived>(derived()));
436 }
437
438 EIGEN_DEVICE_FUNC
439 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived>
440 round() const {
441 return unaryExpr(internal::scalar_round_op<Scalar>());
442 }
443
444 EIGEN_DEVICE_FUNC
445 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_rint_op<Scalar>, const Derived>
446 rint() const {
447 return unaryExpr(internal::scalar_rint_op<Scalar>());
448 }
449
450 EIGEN_DEVICE_FUNC
451 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived>
452 ceil() const {
453 return unaryExpr(internal::scalar_ceil_op<Scalar>());
454 }
455
456 EIGEN_DEVICE_FUNC
457 EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived>
458 floor() const {
459 return unaryExpr(internal::scalar_floor_op<Scalar>());
460 }
461
462 // Generic binary operation support.
463 template <typename CustomBinaryOp, typename OtherDerived> EIGEN_DEVICE_FUNC
464 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>
465 binaryExpr(const OtherDerived& other, const CustomBinaryOp& func) const {
466 return TensorCwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>(derived(), other, func);
467 }
468
469 // Coefficient-wise binary operators.
470 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
471 const TensorCwiseBinaryOp<internal::scalar_sum_op<Scalar>, const Derived, const OtherDerived>
472 operator+(const OtherDerived& other) const {
473 return binaryExpr(other.derived(), internal::scalar_sum_op<Scalar>());
474 }
475
476 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
477 const TensorCwiseBinaryOp<internal::scalar_difference_op<Scalar>, const Derived, const OtherDerived>
478 operator-(const OtherDerived& other) const {
479 return binaryExpr(other.derived(), internal::scalar_difference_op<Scalar>());
480 }
481
482 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
483 const TensorCwiseBinaryOp<internal::scalar_product_op<Scalar>, const Derived, const OtherDerived>
484 operator*(const OtherDerived& other) const {
485 return binaryExpr(other.derived(), internal::scalar_product_op<Scalar>());
486 }
487
488 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
489 const TensorCwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
490 operator/(const OtherDerived& other) const {
491 return binaryExpr(other.derived(), internal::scalar_quotient_op<Scalar>());
492 }
493
494 template<int NaNPropagation=PropagateFast, typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
495 const TensorCwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar, NaNPropagation>, const Derived, const OtherDerived>
496 cwiseMax(const OtherDerived& other) const {
497 return binaryExpr(other.derived(), internal::scalar_max_op<Scalar,Scalar, NaNPropagation>());
498 }
499
500 template<int NaNPropagation=PropagateFast, typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
501 const TensorCwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar, NaNPropagation>, const Derived, const OtherDerived>
502 cwiseMin(const OtherDerived& other) const {
503 return binaryExpr(other.derived(), internal::scalar_min_op<Scalar,Scalar, NaNPropagation>());
504 }
505
506 // logical operators
507 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
508 const TensorCwiseBinaryOp<internal::scalar_boolean_and_op<Scalar>, const Derived, const OtherDerived>
509 operator&&(const OtherDerived& other) const {
510 return binaryExpr(other.derived(), internal::scalar_boolean_and_op<Scalar>());
511 }
512
513 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
514 const TensorCwiseBinaryOp<internal::scalar_boolean_or_op<Scalar>, const Derived, const OtherDerived>
515 operator||(const OtherDerived& other) const {
516 return binaryExpr(other.derived(), internal::scalar_boolean_or_op<Scalar>());
517 }
518
519 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
520 const TensorCwiseBinaryOp<internal::scalar_bitwise_and_op<Scalar>, const Derived, const OtherDerived>
521 operator&(const OtherDerived& other) const {
522 return binaryExpr(other.derived(), internal::scalar_bitwise_and_op<Scalar>());
523 }
524
525 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
526 const TensorCwiseBinaryOp<internal::scalar_bitwise_or_op<Scalar>, const Derived, const OtherDerived>
527 operator|(const OtherDerived& other) const {
528 return binaryExpr(other.derived(), internal::scalar_bitwise_or_op<Scalar>());
529 }
530
531 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
532 const TensorCwiseBinaryOp<internal::scalar_bitwise_xor_op<Scalar>, const Derived, const OtherDerived>
533 operator^(const OtherDerived& other) const {
534 return binaryExpr(other.derived(), internal::scalar_bitwise_xor_op<Scalar>());
535 }
536
537 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
538 const TensorCwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived>
539 operator!() const {
540 return unaryExpr(internal::scalar_boolean_not_op<Scalar>());
541 }
542
543 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
544 const TensorCwiseUnaryOp<internal::scalar_bitwise_not_op<Scalar>, const Derived>
545 operator~() const {
546 return unaryExpr(internal::scalar_bitwise_not_op<Scalar>());
547 }
548
549 // Comparisons and tests.
550 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
551 const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_LT>, const Derived, const OtherDerived>
552 operator<(const TensorBase<OtherDerived, ReadOnlyAccessors>& other) const {
553 return binaryExpr(other.derived(), internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_LT>());
554 }
555 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
556 const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_LE>, const Derived, const OtherDerived>
557 operator<=(const TensorBase<OtherDerived, ReadOnlyAccessors>& other) const {
558 return binaryExpr(other.derived(), internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_LE>());
559 }
560 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
561 const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_GT>, const Derived, const OtherDerived>
562 operator>(const TensorBase<OtherDerived, ReadOnlyAccessors>& other) const {
563 return binaryExpr(other.derived(), internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_GT>());
564 }
565 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
566 const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_GE>, const Derived, const OtherDerived>
567 operator>=(const TensorBase<OtherDerived, ReadOnlyAccessors>& other) const {
568 return binaryExpr(other.derived(), internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_GE>());
569 }
570
571 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
572 const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_EQ>, const Derived, const OtherDerived>
573 operator==(const TensorBase<OtherDerived, ReadOnlyAccessors>& other) const {
574 return binaryExpr(other.derived(), internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_EQ>());
575 }
576
577 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
578 const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_NEQ>, const Derived, const OtherDerived>
579 operator!=(const TensorBase<OtherDerived, ReadOnlyAccessors>& other) const {
580 return binaryExpr(other.derived(), internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_NEQ>());
581 }
582
583 // comparisons and tests for Scalars
584 EIGEN_DEVICE_FUNC
585 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_LT>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
586 operator<(Scalar threshold) const {
587 return operator<(constant(threshold));
588 }
589 EIGEN_DEVICE_FUNC
590 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_LE>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
591 operator<=(Scalar threshold) const {
592 return operator<=(constant(threshold));
593 }
594 EIGEN_DEVICE_FUNC
595 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_GT>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
596 operator>(Scalar threshold) const {
597 return operator>(constant(threshold));
598 }
599 EIGEN_DEVICE_FUNC
600 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_GE>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
601 operator>=(Scalar threshold) const {
602 return operator>=(constant(threshold));
603 }
604 EIGEN_DEVICE_FUNC
605 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_EQ>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
606 operator==(Scalar threshold) const {
607 return operator==(constant(threshold));
608 }
609 EIGEN_DEVICE_FUNC
610 EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_NEQ>, const Derived, const TensorCwiseNullaryOp<internal::scalar_constant_op<Scalar>, const Derived> >
611 operator!=(Scalar threshold) const {
612 return operator!=(constant(threshold));
613 }
614
615 // Predicates.
616 EIGEN_DEVICE_FUNC
617 EIGEN_STRONG_INLINE const TensorConversionOp<bool, const TensorCwiseUnaryOp<internal::scalar_isnan_op<Scalar, true>, const Derived>>
618 (isnan)() const {
619 return unaryExpr(internal::scalar_isnan_op<Scalar, true>()).template cast<bool>();
620 }
621 EIGEN_DEVICE_FUNC
622 EIGEN_STRONG_INLINE const TensorConversionOp<bool, const TensorCwiseUnaryOp<internal::scalar_isinf_op<Scalar, true>, const Derived>>
623 (isinf)() const {
624 return unaryExpr(internal::scalar_isinf_op<Scalar, true>()).template cast<bool>();
625 }
626 EIGEN_DEVICE_FUNC
627 EIGEN_STRONG_INLINE const TensorConversionOp<bool, const TensorCwiseUnaryOp<internal::scalar_isfinite_op<Scalar, true>, const Derived>>
628 (isfinite)() const {
629 return unaryExpr(internal::scalar_isfinite_op<Scalar, true>()).template cast<bool>();
630 }
631
632 // Coefficient-wise ternary operators.
633 template<typename ThenDerived, typename ElseDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
634 const TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>
635 select(const ThenDerived& thenTensor, const ElseDerived& elseTensor) const {
636 return TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>(derived(), thenTensor.derived(), elseTensor.derived());
637 }
638
639 // Contractions.
640 typedef Eigen::IndexPair<Index> DimensionPair;
641
642 template<typename OtherDerived, typename Dimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
643 const TensorContractionOp<const Dimensions, const Derived, const OtherDerived, const NoOpOutputKernel>
644 contract(const OtherDerived& other, const Dimensions& dims) const {
645 return TensorContractionOp<const Dimensions, const Derived, const OtherDerived, const NoOpOutputKernel>(derived(), other.derived(), dims);
646 }
647
648 template<typename OtherDerived, typename Dimensions, typename OutputKernel> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
649 const TensorContractionOp<const Dimensions, const Derived, const OtherDerived, const OutputKernel>
650 contract(const OtherDerived& other, const Dimensions& dims, const OutputKernel& output_kernel) const {
651 return TensorContractionOp<const Dimensions, const Derived, const OtherDerived, const OutputKernel>(derived(), other.derived(), dims, output_kernel);
652 }
653
654 // Convolutions.
655 template<typename KernelDerived, typename Dimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
656 const TensorConvolutionOp<const Dimensions, const Derived, const KernelDerived>
657 convolve(const KernelDerived& kernel, const Dimensions& dims) const {
658 return TensorConvolutionOp<const Dimensions, const Derived, const KernelDerived>(derived(), kernel.derived(), dims);
659 }
660
661 // Fourier transforms
662 template <int FFTDataType, int FFTDirection, typename FFT> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
663 const TensorFFTOp<const FFT, const Derived, FFTDataType, FFTDirection>
664 fft(const FFT& dims) const {
665 return TensorFFTOp<const FFT, const Derived, FFTDataType, FFTDirection>(derived(), dims);
666 }
667
668 // Scan.
669 typedef TensorScanOp<internal::SumReducer<CoeffReturnType>, const Derived> TensorScanSumOp;
670 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
671 const TensorScanSumOp
672 cumsum(const Index& axis, bool exclusive = false) const {
673 return TensorScanSumOp(derived(), axis, exclusive);
674 }
675
676 typedef TensorScanOp<internal::ProdReducer<CoeffReturnType>, const Derived> TensorScanProdOp;
677 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
678 const TensorScanProdOp
679 cumprod(const Index& axis, bool exclusive = false) const {
680 return TensorScanProdOp(derived(), axis, exclusive);
681 }
682
683 template <typename Reducer>
684 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
685 const TensorScanOp<Reducer, const Derived>
686 scan(const Index& axis, const Reducer& reducer, bool exclusive = false) const {
687 return TensorScanOp<Reducer, const Derived>(derived(), axis, exclusive, reducer);
688 }
689
690 // Reductions.
691 template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
692 const TensorReductionOp<internal::SumReducer<CoeffReturnType>, const Dims, const Derived>
693 sum(const Dims& dims) const {
694 return TensorReductionOp<internal::SumReducer<CoeffReturnType>, const Dims, const Derived>(derived(), dims, internal::SumReducer<CoeffReturnType>());
695 }
696
697 const TensorReductionOp<internal::SumReducer<CoeffReturnType>, const DimensionList<Index, NumDimensions>, const Derived>
698 sum() const {
699 DimensionList<Index, NumDimensions> in_dims;
700 return TensorReductionOp<internal::SumReducer<CoeffReturnType>, const DimensionList<Index, NumDimensions>, const Derived>(derived(), in_dims, internal::SumReducer<CoeffReturnType>());
701 }
702
703 template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
704 const TensorReductionOp<internal::MeanReducer<CoeffReturnType>, const Dims, const Derived>
705 mean(const Dims& dims) const {
706 return TensorReductionOp<internal::MeanReducer<CoeffReturnType>, const Dims, const Derived>(derived(), dims, internal::MeanReducer<CoeffReturnType>());
707 }
708
709 const TensorReductionOp<internal::MeanReducer<CoeffReturnType>, const DimensionList<Index, NumDimensions>, const Derived>
710 mean() const {
711 DimensionList<Index, NumDimensions> in_dims;
712 return TensorReductionOp<internal::MeanReducer<CoeffReturnType>, const DimensionList<Index, NumDimensions>, const Derived>(derived(), in_dims, internal::MeanReducer<CoeffReturnType>());
713 }
714
715 template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
716 const TensorReductionOp<internal::ProdReducer<CoeffReturnType>, const Dims, const Derived>
717 prod(const Dims& dims) const {
718 return TensorReductionOp<internal::ProdReducer<CoeffReturnType>, const Dims, const Derived>(derived(), dims, internal::ProdReducer<CoeffReturnType>());
719 }
720
721 const TensorReductionOp<internal::ProdReducer<CoeffReturnType>, const DimensionList<Index, NumDimensions>, const Derived>
722 prod() const {
723 DimensionList<Index, NumDimensions> in_dims;
724 return TensorReductionOp<internal::ProdReducer<CoeffReturnType>, const DimensionList<Index, NumDimensions>, const Derived>(derived(), in_dims, internal::ProdReducer<CoeffReturnType>());
725 }
726
727 template <typename Dims,int NanPropagation=PropagateFast> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
728 const TensorReductionOp<internal::MaxReducer<CoeffReturnType,NanPropagation>, const Dims, const Derived>
729 maximum(const Dims& dims) const {
730 return TensorReductionOp<internal::MaxReducer<CoeffReturnType,NanPropagation>, const Dims, const Derived>(derived(), dims, internal::MaxReducer<CoeffReturnType,NanPropagation>());
731 }
732
733 template <int NanPropagation=PropagateFast>
734 const TensorReductionOp<internal::MaxReducer<CoeffReturnType,NanPropagation>, const DimensionList<Index, NumDimensions>, const Derived>
735 maximum() const {
736 DimensionList<Index, NumDimensions> in_dims;
737 return TensorReductionOp<internal::MaxReducer<CoeffReturnType,NanPropagation>, const DimensionList<Index, NumDimensions>, const Derived>(derived(), in_dims, internal::MaxReducer<CoeffReturnType,NanPropagation>());
738 }
739
740 template <typename Dims,int NanPropagation=PropagateFast> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
741 const TensorReductionOp<internal::MinReducer<CoeffReturnType,NanPropagation>, const Dims, const Derived>
742 minimum(const Dims& dims) const {
743 return TensorReductionOp<internal::MinReducer<CoeffReturnType,NanPropagation>, const Dims, const Derived>(derived(), dims, internal::MinReducer<CoeffReturnType,NanPropagation>());
744 }
745
746 template <int NanPropagation=PropagateFast>
747 const TensorReductionOp<internal::MinReducer<CoeffReturnType,NanPropagation>, const DimensionList<Index, NumDimensions>, const Derived>
748 minimum() const {
749 DimensionList<Index, NumDimensions> in_dims;
750 return TensorReductionOp<internal::MinReducer<CoeffReturnType,NanPropagation>, const DimensionList<Index, NumDimensions>, const Derived>(derived(), in_dims, internal::MinReducer<CoeffReturnType,NanPropagation>());
751 }
752
753 template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
754 const TensorReductionOp<internal::AndReducer, const Dims, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > >
755 all(const Dims& dims) const {
756 return cast<bool>().reduce(dims, internal::AndReducer());
757 }
758
759 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
760 const TensorReductionOp<internal::AndReducer, const DimensionList<Index, NumDimensions>, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > >
761 all() const {
762 DimensionList<Index, NumDimensions> in_dims;
763 return cast<bool>().reduce(in_dims, internal::AndReducer());
764 }
765
766 template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
767 const TensorReductionOp<internal::OrReducer, const Dims, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > >
768 any(const Dims& dims) const {
769 return cast<bool>().reduce(dims, internal::OrReducer());
770 }
771
772 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
773 const TensorReductionOp<internal::OrReducer, const DimensionList<Index, NumDimensions>, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > >
774 any() const {
775 DimensionList<Index, NumDimensions> in_dims;
776 return cast<bool>().reduce(in_dims, internal::OrReducer());
777 }
778
779 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
780 const TensorPairReducerOp<
781 internal::ArgMaxPairReducer<Pair<Index, CoeffReturnType> >,
782 const array<Index, NumDimensions>, const Derived>
783 argmax() const {
784 array<Index, NumDimensions> in_dims;
785 for (Index d = 0; d < NumDimensions; ++d) in_dims[d] = d;
786 return TensorPairReducerOp<
787 internal::ArgMaxPairReducer<Pair<Index, CoeffReturnType> >,
788 const array<Index, NumDimensions>,
789 const Derived>(derived(), internal::ArgMaxPairReducer<Pair<Index, CoeffReturnType> >(), -1, in_dims);
790 }
791
792 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
793 const TensorPairReducerOp<
794 internal::ArgMinPairReducer<Pair<Index, CoeffReturnType> >,
795 const array<Index, NumDimensions>, const Derived>
796 argmin() const {
797 array<Index, NumDimensions> in_dims;
798 for (Index d = 0; d < NumDimensions; ++d) in_dims[d] = d;
799 return TensorPairReducerOp<
800 internal::ArgMinPairReducer<Pair<Index, CoeffReturnType> >,
801 const array<Index, NumDimensions>,
802 const Derived>(derived(), internal::ArgMinPairReducer<Pair<Index, CoeffReturnType> >(), -1, in_dims);
803 }
804
805 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
806 const TensorPairReducerOp<
807 internal::ArgMaxPairReducer<Pair<Index, CoeffReturnType> >,
808 const array<Index, 1>, const Derived>
809 argmax(const Index return_dim) const {
810 array<Index, 1> in_dims;
811 in_dims[0] = return_dim;
812 return TensorPairReducerOp<
813 internal::ArgMaxPairReducer<Pair<Index, CoeffReturnType> >,
814 const array<Index, 1>,
815 const Derived>(derived(), internal::ArgMaxPairReducer<Pair<Index, CoeffReturnType> >(), return_dim, in_dims);
816 }
817
818 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
819 const TensorPairReducerOp<
820 internal::ArgMinPairReducer<Pair<Index, CoeffReturnType> >,
821 const array<Index, 1>, const Derived>
822 argmin(const Index return_dim) const {
823 array<Index, 1> in_dims;
824 in_dims[0] = return_dim;
825 return TensorPairReducerOp<
826 internal::ArgMinPairReducer<Pair<Index, CoeffReturnType> >,
827 const array<Index, 1>,
828 const Derived>(derived(), internal::ArgMinPairReducer<Pair<Index, CoeffReturnType> >(), return_dim, in_dims);
829 }
830
831 template <typename Reducer, typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
832 const TensorReductionOp<Reducer, const Dims, const Derived>
833 reduce(const Dims& dims, const Reducer& reducer) const {
834 return TensorReductionOp<Reducer, const Dims, const Derived>(derived(), dims, reducer);
835 }
836
837 template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
838 const TensorTraceOp<const Dims, const Derived>
839 trace(const Dims& dims) const {
840 return TensorTraceOp<const Dims, const Derived>(derived(), dims);
841 }
842
843 const TensorTraceOp<const DimensionList<Index, NumDimensions>, const Derived>
844 trace() const {
845 DimensionList<Index, NumDimensions> in_dims;
846 return TensorTraceOp<const DimensionList<Index, NumDimensions>, const Derived>(derived(), in_dims);
847 }
848
849 template <typename Broadcast> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
850 const TensorBroadcastingOp<const Broadcast, const Derived>
851 broadcast(const Broadcast& bcast) const {
852 return TensorBroadcastingOp<const Broadcast, const Derived>(derived(), bcast);
853 }
854
855 template <typename Axis, typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
856 const TensorConcatenationOp<Axis, const Derived, const OtherDerived>
857 concatenate(const OtherDerived& other, Axis axis) const {
858 return TensorConcatenationOp<Axis, const Derived, const OtherDerived>(derived(), other.derived(), axis);
859 }
860
861 template <typename PatchDims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
862 const TensorPatchOp<const PatchDims, const Derived>
863 extract_patches(const PatchDims& patch_dims) const {
864 return TensorPatchOp<const PatchDims, const Derived>(derived(), patch_dims);
865 }
866
867 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
868 const TensorImagePatchOp<Dynamic, Dynamic, const Derived>
869 extract_image_patches(const Index patch_rows = 1, const Index patch_cols = 1,
870 const Index row_stride = 1, const Index col_stride = 1,
871 const Index in_row_stride = 1, const Index in_col_stride = 1,
872 const PaddingType padding_type = PADDING_SAME, const Scalar padding_value = Scalar(0)) const {
873 return TensorImagePatchOp<Dynamic, Dynamic, const Derived>(derived(), patch_rows, patch_cols, row_stride, col_stride,
874 in_row_stride, in_col_stride, 1, 1, padding_type, padding_value);
875 }
876
877 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
878 const TensorImagePatchOp<Dynamic, Dynamic, const Derived>
879 extract_image_patches(const Index patch_rows, const Index patch_cols,
880 const Index row_stride, const Index col_stride,
881 const Index in_row_stride, const Index in_col_stride,
882 const Index row_inflate_stride, const Index col_inflate_stride,
883 const Index padding_top, const Index padding_bottom,
884 const Index padding_left,const Index padding_right,
885 const Scalar padding_value) const {
886 return TensorImagePatchOp<Dynamic, Dynamic, const Derived>(derived(), patch_rows, patch_cols, row_stride, col_stride,
887 in_row_stride, in_col_stride, row_inflate_stride, col_inflate_stride,
888 padding_top, padding_bottom, padding_left, padding_right, padding_value);
889 }
890
891 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
892 const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Derived>
893 extract_volume_patches(const Index patch_planes, const Index patch_rows, const Index patch_cols,
894 const Index plane_stride = 1, const Index row_stride = 1, const Index col_stride = 1,
895 const PaddingType padding_type = PADDING_SAME, const Scalar padding_value = Scalar(0)) const {
896 return TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Derived>(derived(), patch_planes, patch_rows, patch_cols, plane_stride, row_stride, col_stride, 1, 1, 1, 1, 1, 1, padding_type, padding_value);
897 }
898
899
900 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
901 const TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Derived>
902 extract_volume_patches(const Index patch_planes, const Index patch_rows, const Index patch_cols,
903 const Index plane_stride, const Index row_stride, const Index col_stride,
904 const Index plane_inflate_stride, const Index row_inflate_stride, const Index col_inflate_stride,
905 const Index padding_top_z, const Index padding_bottom_z,
906 const Index padding_top, const Index padding_bottom,
907 const Index padding_left, const Index padding_right, const Scalar padding_value = Scalar(0)) const {
908 return TensorVolumePatchOp<Dynamic, Dynamic, Dynamic, const Derived>(derived(), patch_planes, patch_rows, patch_cols, plane_stride, row_stride, col_stride, 1, 1, 1, plane_inflate_stride, row_inflate_stride, col_inflate_stride, padding_top_z, padding_bottom_z, padding_top, padding_bottom, padding_left, padding_right, padding_value);
909 }
910
911 // Morphing operators.
912 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
913 const TensorLayoutSwapOp<const Derived>
914 swap_layout() const {
915 return TensorLayoutSwapOp<const Derived>(derived());
916 }
917 template <typename NewDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
918 const TensorReshapingOp<const NewDimensions, const Derived>
919 reshape(const NewDimensions& newDimensions) const {
920 return TensorReshapingOp<const NewDimensions, const Derived>(derived(), newDimensions);
921 }
922 template <typename StartIndices, typename Sizes> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
923 const TensorSlicingOp<const StartIndices, const Sizes, const Derived>
924 slice(const StartIndices& startIndices, const Sizes& sizes) const {
925 return TensorSlicingOp<const StartIndices, const Sizes, const Derived>(derived(), startIndices, sizes);
926 }
927 template <typename StartIndices, typename StopIndices, typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
928 const TensorStridingSlicingOp<const StartIndices, const StopIndices, const Strides, const Derived>
929 stridedSlice(const StartIndices& startIndices, const StopIndices& stopIndices, const Strides& strides) const {
930 return TensorStridingSlicingOp<const StartIndices, const StopIndices, const Strides,
931 const Derived>(derived(), startIndices, stopIndices, strides);
932 }
933 template <Index DimId> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
934 const TensorChippingOp<DimId, const Derived>
935 chip(const Index offset) const {
936 EIGEN_STATIC_ASSERT(DimId < Derived::NumDimensions && DimId >= 0, Chip_Dim_out_of_range)
937 return TensorChippingOp<DimId, const Derived>(derived(), offset, DimId);
938 }
939 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
940 const TensorChippingOp<Dynamic, const Derived>
941 chip(const Index offset, const Index dim) const {
942 return TensorChippingOp<Dynamic, const Derived>(derived(), offset, dim);
943 }
944 template <typename ReverseDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
945 const TensorReverseOp<const ReverseDimensions, const Derived>
946 reverse(const ReverseDimensions& rev) const {
947 return TensorReverseOp<const ReverseDimensions, const Derived>(derived(), rev);
948 }
949 template <typename Rolls> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
950 const TensorRollOp<const Rolls, const Derived>
951 roll(const Rolls& rolls) const {
952 return TensorRollOp<const Rolls, const Derived>(derived(), rolls);
953 }
954 template <typename PaddingDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
955 const TensorPaddingOp<const PaddingDimensions, const Derived>
956 pad(const PaddingDimensions& padding) const {
957 return TensorPaddingOp<const PaddingDimensions, const Derived>(derived(), padding, internal::scalar_cast_op<int, Scalar>()(0));
958 }
959 template <typename PaddingDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
960 const TensorPaddingOp<const PaddingDimensions, const Derived>
961 pad(const PaddingDimensions& padding, const Scalar padding_value) const {
962 return TensorPaddingOp<const PaddingDimensions, const Derived>(derived(), padding, padding_value);
963 }
964 template <typename Shuffle> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
965 const TensorShufflingOp<const Shuffle, const Derived>
966 shuffle(const Shuffle& shfl) const {
967 return TensorShufflingOp<const Shuffle, const Derived>(derived(), shfl);
968 }
969 template <typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
970 const TensorStridingOp<const Strides, const Derived>
971 stride(const Strides& strides) const {
972 return TensorStridingOp<const Strides, const Derived>(derived(), strides);
973 }
974 template <typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
975 const TensorInflationOp<const Strides, const Derived>
976 inflate(const Strides& strides) const {
977 return TensorInflationOp<const Strides, const Derived>(derived(), strides);
978 }
979
980 // Returns a tensor containing index/value pairs
981 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
982 const TensorIndexPairOp<const Derived>
983 index_pairs() const {
984 return TensorIndexPairOp<const Derived>(derived());
985 }
986
987 // Support for custom unary and binary operations
988 template <typename CustomUnaryFunc>
989 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
990 const TensorCustomUnaryOp<const CustomUnaryFunc, const Derived> customOp(const CustomUnaryFunc& op) const {
991 return TensorCustomUnaryOp<const CustomUnaryFunc, const Derived>(derived(), op);
992 }
993 template <typename OtherDerived, typename CustomBinaryFunc>
994 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
995 const TensorCustomBinaryOp<const CustomBinaryFunc, const Derived, const OtherDerived> customOp(const OtherDerived& other, const CustomBinaryFunc& op) const {
996 return TensorCustomBinaryOp<const CustomBinaryFunc, const Derived, const OtherDerived>(derived(), other, op);
997 }
998
999 // Force the evaluation of the expression.
1000 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1001 const TensorForcedEvalOp<const Derived> eval() const {
1002 return TensorForcedEvalOp<const Derived>(derived());
1003 }
1004
1005 // Returns a formatted tensor ready for printing to a stream
1006 template<typename Format>
1007 inline const TensorWithFormat<Derived,DerivedTraits::Layout,DerivedTraits::NumDimensions, Format> format(const Format& fmt) const {
1008 return TensorWithFormat<Derived,DerivedTraits::Layout,DerivedTraits::NumDimensions, Format>(derived(), fmt);
1009 }
1010
1011 #ifdef EIGEN_READONLY_TENSORBASE_PLUGIN
1012 #include EIGEN_READONLY_TENSORBASE_PLUGIN
1013 #endif
1014
1015 EIGEN_DEVICE_FUNC
1016 EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
1017
1018 protected:
1019 template <typename Scalar, int NumIndices, int Options, typename IndexType> friend class Tensor;
1020 template <typename Scalar, typename Dimensions, int Option, typename IndexTypes> friend class TensorFixedSize;
1021 // the Eigen:: prefix is required to workaround a compilation issue with nvcc 9.0
1022 template <typename OtherDerived, int AccessLevel> friend class Eigen::TensorBase;
1023};
1024
1025template<typename Derived, int AccessLevel = internal::accessors_level<Derived>::value>
1026class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> {
1027 public:
1028 typedef TensorBase<Derived, ReadOnlyAccessors> Base;
1029 typedef internal::traits<Derived> DerivedTraits;
1030 typedef typename DerivedTraits::Scalar Scalar;
1031 typedef typename DerivedTraits::Index Index;
1032 typedef Scalar CoeffReturnType;
1033 static constexpr int NumDimensions = DerivedTraits::NumDimensions;
1034
1035 template <typename Scalar, int NumIndices, int Options, typename IndexType> friend class Tensor;
1036 template <typename Scalar, typename Dimensions, int Option, typename IndexTypes> friend class TensorFixedSize;
1037 // the Eigen:: prefix is required to workaround a compilation issue with nvcc 9.0
1038 template <typename OtherDerived, int OtherAccessLevel> friend class Eigen::TensorBase;
1039
1040 EIGEN_DEVICE_FUNC
1041 EIGEN_STRONG_INLINE Derived& setZero() {
1042 return setConstant(Scalar(0));
1043 }
1044 EIGEN_DEVICE_FUNC
1045 EIGEN_STRONG_INLINE Derived& setConstant(const Scalar& val) {
1046 return derived() = this->constant(val);
1047 }
1048 EIGEN_DEVICE_FUNC
1049 EIGEN_STRONG_INLINE Derived& setRandom() {
1050 return derived() = this->random();
1051 }
1052 template <typename RandomGenerator> EIGEN_DEVICE_FUNC
1053 EIGEN_STRONG_INLINE Derived& setRandom() {
1054 return derived() = this->template random<RandomGenerator>();
1055 }
1056
1057 EIGEN_DEVICE_FUNC
1058 EIGEN_STRONG_INLINE Derived& setValues(
1059 const typename internal::Initializer<Derived, NumDimensions>::InitList& vals) {
1060 TensorEvaluator<Derived, DefaultDevice> eval(derived(), DefaultDevice());
1061 internal::initialize_tensor<Derived, NumDimensions>(eval, vals);
1062 return derived();
1063 }
1064
1065 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1066 Derived& operator+=(const OtherDerived& other) {
1067 return derived() = derived() + other.derived();
1068 }
1069 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1070 Derived& operator-=(const OtherDerived& other) {
1071 return derived() = derived() - other.derived();
1072 }
1073 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1074 Derived& operator*=(const OtherDerived& other) {
1075 return derived() = derived() * other.derived();
1076 }
1077 template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1078 Derived& operator/=(const OtherDerived& other) {
1079 return derived() = derived() / other.derived();
1080 }
1081
1082 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1083 const TensorLayoutSwapOp<const Derived>
1084 swap_layout() const {
1085 return TensorLayoutSwapOp<const Derived>(derived());
1086 }
1087 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1088 TensorLayoutSwapOp<Derived>
1089 swap_layout() {
1090 return TensorLayoutSwapOp<Derived>(derived());
1091 }
1092
1093 template <typename Axis, typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1094 const TensorConcatenationOp<const Axis, const Derived, const OtherDerived>
1095 concatenate(const OtherDerived& other, const Axis& axis) const {
1096 return TensorConcatenationOp<const Axis, const Derived, const OtherDerived>(derived(), other, axis);
1097 }
1098 template <typename Axis, typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1099 TensorConcatenationOp<const Axis, Derived, OtherDerived>
1100 concatenate(const OtherDerived& other, const Axis& axis) {
1101 return TensorConcatenationOp<const Axis, Derived, OtherDerived>(derived(), other, axis);
1102 }
1103
1104 template <typename NewDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1105 const TensorReshapingOp<const NewDimensions, const Derived>
1106 reshape(const NewDimensions& newDimensions) const {
1107 return TensorReshapingOp<const NewDimensions, const Derived>(derived(), newDimensions);
1108 }
1109 template <typename NewDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1110 TensorReshapingOp<const NewDimensions, Derived>
1111 reshape(const NewDimensions& newDimensions) {
1112 return TensorReshapingOp<const NewDimensions, Derived>(derived(), newDimensions);
1113 }
1114
1115 template <typename StartIndices, typename Sizes> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1116 const TensorSlicingOp<const StartIndices, const Sizes, const Derived>
1117 slice(const StartIndices& startIndices, const Sizes& sizes) const {
1118 return TensorSlicingOp<const StartIndices, const Sizes, const Derived>(derived(), startIndices, sizes);
1119 }
1120 template <typename StartIndices, typename Sizes> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1121 TensorSlicingOp<const StartIndices, const Sizes, Derived>
1122 slice(const StartIndices& startIndices, const Sizes& sizes) {
1123 return TensorSlicingOp<const StartIndices, const Sizes, Derived>(derived(), startIndices, sizes);
1124 }
1125
1126 template <typename StartIndices, typename StopIndices, typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1127 const TensorStridingSlicingOp<const StartIndices, const StopIndices, const Strides, const Derived>
1128 stridedSlice(const StartIndices& startIndices, const StopIndices& stopIndices, const Strides& strides) const {
1129 return TensorStridingSlicingOp<const StartIndices, const StopIndices, const Strides,
1130 const Derived>(derived(), startIndices, stopIndices, strides);
1131 }
1132 template <typename StartIndices, typename StopIndices, typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1133 TensorStridingSlicingOp<const StartIndices, const StopIndices, const Strides, Derived>
1134 stridedSlice(const StartIndices& startIndices, const StopIndices& stopIndices, const Strides& strides) {
1135 return TensorStridingSlicingOp<const StartIndices, const StopIndices, const Strides,
1136 Derived>(derived(), startIndices, stopIndices, strides);
1137 }
1138
1139 template <DenseIndex DimId> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1140 const TensorChippingOp<DimId, const Derived>
1141 chip(const Index offset) const {
1142 EIGEN_STATIC_ASSERT(DimId < Derived::NumDimensions && DimId >= 0, Chip_Dim_out_of_range)
1143 return TensorChippingOp<DimId, const Derived>(derived(), offset, DimId);
1144 }
1145 template <Index DimId> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1146 TensorChippingOp<DimId, Derived>
1147 chip(const Index offset) {
1148 EIGEN_STATIC_ASSERT(DimId < Derived::NumDimensions && DimId >= 0, Chip_Dim_out_of_range)
1149 return TensorChippingOp<DimId, Derived>(derived(), offset, DimId);
1150 }
1151
1152 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1153 const TensorChippingOp<Dynamic, const Derived>
1154 chip(const Index offset, const Index dim) const {
1155 return TensorChippingOp<Dynamic, const Derived>(derived(), offset, dim);
1156 }
1157 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1158 TensorChippingOp<Dynamic, Derived>
1159 chip(const Index offset, const Index dim) {
1160 return TensorChippingOp<Dynamic, Derived>(derived(), offset, dim);
1161 }
1162
1163 template <typename ReverseDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1164 const TensorReverseOp<const ReverseDimensions, const Derived>
1165 reverse(const ReverseDimensions& rev) const {
1166 return TensorReverseOp<const ReverseDimensions, const Derived>(derived(), rev);
1167 }
1168 template <typename ReverseDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1169 TensorReverseOp<const ReverseDimensions, Derived>
1170 reverse(const ReverseDimensions& rev) {
1171 return TensorReverseOp<const ReverseDimensions, Derived>(derived(), rev);
1172 }
1173
1174 template <typename Rolls> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1175 const TensorRollOp<const Rolls, const Derived>
1176 roll(const Rolls& roll) const {
1177 return TensorRollOp<const Rolls, const Derived>(derived(), roll);
1178 }
1179 template <typename Rolls> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1180 TensorRollOp<const Rolls, Derived>
1181 roll(const Rolls& roll) {
1182 return TensorRollOp<const Rolls, Derived>(derived(), roll);
1183 }
1184
1185 template <typename Shuffle> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1186 const TensorShufflingOp<const Shuffle, const Derived>
1187 shuffle(const Shuffle& shfl) const {
1188 return TensorShufflingOp<const Shuffle, const Derived>(derived(), shfl);
1189 }
1190 template <typename Shuffle> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1191 TensorShufflingOp<const Shuffle, Derived>
1192 shuffle(const Shuffle& shfl) {
1193 return TensorShufflingOp<const Shuffle, Derived>(derived(), shfl);
1194 }
1195
1196 template <typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1197 const TensorStridingOp<const Strides, const Derived>
1198 stride(const Strides& strides) const {
1199 return TensorStridingOp<const Strides, const Derived>(derived(), strides);
1200 }
1201 template <typename Strides> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1202 TensorStridingOp<const Strides, Derived>
1203 stride(const Strides& strides) {
1204 return TensorStridingOp<const Strides, Derived>(derived(), strides);
1205 }
1206
1207 // Select the device on which to evaluate the expression.
1208 template <typename DeviceType>
1209 TensorDevice<Derived, DeviceType> device(const DeviceType& dev) {
1210 return TensorDevice<Derived, DeviceType>(dev, derived());
1211 }
1212
1213 // Select the async device on which to evaluate the expression.
1214 template <typename DeviceType, typename DoneCallback>
1215 TensorAsyncDevice<Derived, DeviceType, DoneCallback> device(const DeviceType& dev, DoneCallback done) {
1216 return TensorAsyncDevice<Derived, DeviceType, DoneCallback>(dev, derived(), std::move(done));
1217 }
1218
1219 EIGEN_DEVICE_FUNC
1220 EIGEN_STRONG_INLINE Derived& derived() { return *static_cast<Derived*>(this); }
1221 EIGEN_DEVICE_FUNC
1222 EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
1223
1224 #ifdef EIGEN_TENSORBASE_PLUGIN
1225 #include EIGEN_TENSORBASE_PLUGIN
1226 #endif
1227
1228 protected:
1229 EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(TensorBase)
1230 EIGEN_DEFAULT_COPY_CONSTRUCTOR(TensorBase)
1231
1232 template<typename OtherDerived> EIGEN_DEVICE_FUNC
1233 EIGEN_STRONG_INLINE Derived& operator=(const OtherDerived& other)
1234 {
1235 typedef TensorAssignOp<Derived, const OtherDerived> Assign;
1236 Assign assign(derived(), other.derived());
1237 internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice());
1238 return derived();
1239 }
1240};
1241#endif // EIGEN_PARSED_BY_DOXYGEN
1242} // end namespace Eigen
1243
1244#endif // EIGEN_CXX11_TENSOR_TENSOR_BASE_H
The tensor base class.
Definition TensorForwardDeclarations.h:68
ReadOnlyAccessors
Namespace containing all symbols from the Eigen library.
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_y1_op< typename Derived::Scalar >, const Derived > bessel_y1(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:269
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k0e_op< typename Derived::Scalar >, const Derived > bessel_k0e(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:142
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k0_op< typename Derived::Scalar >, const Derived > bessel_k0(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:120
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sqrt_op< typename Derived::Scalar >, const Derived > sqrt(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_real_op< typename Derived::Scalar >, const Derived > real(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_rint_op< typename Derived::Scalar >, const Derived > rint(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_igammac_op< typename Derived::Scalar >, const Derived, const ExponentDerived > igammac(const Eigen::ArrayBase< Derived > &a, const Eigen::ArrayBase< ExponentDerived > &x)
Definition SpecialFunctionsArrayAPI.h:93
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_inverse_op< typename Derived::Scalar >, const Derived > inverse(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_igamma_der_a_op< typename Derived::Scalar >, const Derived, const ExponentDerived > igamma_der_a(const Eigen::ArrayBase< Derived > &a, const Eigen::ArrayBase< ExponentDerived > &x)
Definition SpecialFunctionsArrayAPI.h:52
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_expm1_op< typename Derived::Scalar >, const Derived > expm1(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_exp_op< typename Derived::Scalar >, const Derived > exp(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_rsqrt_op< typename Derived::Scalar >, const Derived > rsqrt(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_cube_op< typename Derived::Scalar >, const Derived > cube(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_log2_op< typename Derived::Scalar >, const Derived > log2(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_square_op< typename Derived::Scalar >, const Derived > square(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs_op< typename Derived::Scalar >, const Derived > abs(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sign_op< typename Derived::Scalar >, const Derived > sign(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k1_op< typename Derived::Scalar >, const Derived > bessel_k1(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:163
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i1_op< typename Derived::Scalar >, const Derived > bessel_i1(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:77
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i0e_op< typename Derived::Scalar >, const Derived > bessel_i0e(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:56
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_lgamma_op< typename Derived::Scalar >, const Derived > lgamma(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i1e_op< typename Derived::Scalar >, const Derived > bessel_i1e(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:99
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_j1_op< typename Derived::Scalar >, const Derived > bessel_j1(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:248
const Product< Inverse< PermutationType >, SparseDerived, AliasFreeProduct > operator*(const InverseImpl< PermutationType, PermutationStorage > &tperm, const SparseMatrixBase< SparseDerived > &matrix)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_y0_op< typename Derived::Scalar >, const Derived > bessel_y0(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:227
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i0_op< typename Derived::Scalar >, const Derived > bessel_i0(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:34
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_round_op< typename Derived::Scalar >, const Derived > round(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_isinf_op< typename Derived::Scalar >, const Derived > isinf(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_log1p_op< typename Derived::Scalar >, const Derived > log1p(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_erf_op< typename Derived::Scalar >, const Derived > erf(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_imag_op< typename Derived::Scalar >, const Derived > imag(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_log_op< typename Derived::Scalar >, const Derived > log(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_isfinite_op< typename Derived::Scalar >, const Derived > isfinite(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k1e_op< typename Derived::Scalar >, const Derived > bessel_k1e(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:185
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_gamma_sample_der_alpha_op< typename AlphaDerived::Scalar >, const AlphaDerived, const SampleDerived > gamma_sample_der_alpha(const Eigen::ArrayBase< AlphaDerived > &alpha, const Eigen::ArrayBase< SampleDerived > &sample)
Definition SpecialFunctionsArrayAPI.h:75
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_erfc_op< typename Derived::Scalar >, const Derived > erfc(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_ndtri_op< typename Derived::Scalar >, const Derived > ndtri(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_tanh_op< typename Derived::Scalar >, const Derived > tanh(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_arg_op< typename Derived::Scalar >, const Derived > arg(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_isnan_op< typename Derived::Scalar >, const Derived > isnan(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_digamma_op< typename Derived::Scalar >, const Derived > digamma(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_floor_op< typename Derived::Scalar >, const Derived > floor(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_polygamma_op< typename DerivedX::Scalar >, const DerivedN, const DerivedX > polygamma(const Eigen::ArrayBase< DerivedN > &n, const Eigen::ArrayBase< DerivedX > &x)
Definition SpecialFunctionsArrayAPI.h:113
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_j0_op< typename Derived::Scalar >, const Derived > bessel_j0(const Eigen::ArrayBase< Derived > &x)
Definition BesselFunctionsArrayAPI.h:206
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_igamma_op< typename Derived::Scalar >, const Derived, const ExponentDerived > igamma(const Eigen::ArrayBase< Derived > &a, const Eigen::ArrayBase< ExponentDerived > &x)
Definition SpecialFunctionsArrayAPI.h:31
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition SpecialFunctionsArrayAPI.h:152
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_ceil_op< typename Derived::Scalar >, const Derived > ceil(const Eigen::ArrayBase< Derived > &x)