41#include "../../misc/self.hpp"
42#include "../../traits/computationTraits.hpp"
43#include "../activeType.hpp"
44#include "../aggregate/aggregatedActiveType.hpp"
45#include "../computeExpression.hpp"
46#include "../expressionInterface.hpp"
47#include "../expressionMemberOperations.hpp"
48#include "../real/binaryOperators.hpp"
49#include "../real/unaryOperators.hpp"
50#include "allOperators.hpp"
51#include "complexPredef.hpp"
61 template<
typename T_Real,
typename T_Impl>
64 typename std::enable_if<std::is_same<T_Real, std::complex<typename T_Real::value_type>>::value>::type> {
89 return static_cast<Impl const&
>(*this);
101 template<
typename T_InnerActive,
typename T_Impl>
103 ResolveSelf<T_Impl, ActiveComplex<T_InnerActive, T_Impl>>>,
105 ResolveSelf<T_Impl, ActiveComplex<T_InnerActive, T_Impl>>>,
107 ResolveSelf<T_Impl, ActiveComplex<T_InnerActive, T_Impl>>> {
114 using Real = std::complex<InnerReal>;
129 using Base::operator=;
131 using AssignReal::operator+=;
132 using AssignComplex::operator+=;
133 using AssignReal::operator-=;
134 using AssignComplex::operator-=;
135 using AssignReal::operator*=;
136 using AssignComplex::operator*=;
137 using AssignReal::operator/=;
138 using AssignComplex::operator/=;
141 template<
typename ArgR>
154 template<
typename ArgR,
typename ArgI>
163 template<
typename ArgI>
171 template<
typename ArgR>
187 template<
typename ArgR>
207 template<
typename T_InnerReal>
210 std::complex<RealTraits::Real<T_InnerReal>>, 2> {
219 template<
typename T_InnerReal>
222 ActiveComplex<T_InnerReal>, T_InnerReal,
223 typename std::conditional<std::is_floating_point<RealTraits::Real<T_InnerReal>>::value,
224 std::complex<RealTraits::Real<T_InnerReal>>,
225 ActiveComplex<RealTraits::Real<T_InnerReal>>>::type,
236 template<
typename T_InnerReal,
typename T_Tape>
245#if CODI_SpecializeStdComplex
253#if CODI_SpecializeStdComplex
265 template<
typename T_Tape>
266 class complex<
codi::ActiveType<T_Tape>>
267 :
public codi::ActiveComplex<codi::ActiveType<T_Tape>, complex<codi::ActiveType<T_Tape>>> {
273 using Real = complex<typename Tape::Real>;
285 using Base::operator=;
289 Base::store(value, codi::EventHints::Statement::Copy);
296 template<
typename Tape>
317 #define FUNCTION operator+
318 #define OPERATION_LOGIC codi::OperationAdd
319 #include "binaryComplexToComplexStdSpecialization.tpp"
321 #define FUNCTION operator-
322 #define OPERATION_LOGIC codi::OperationSubstract
323 #include "binaryComplexToComplexStdSpecialization.tpp"
325 #define FUNCTION operator*
326 #define OPERATION_LOGIC codi::OperationMultiply
327 #include "binaryComplexToComplexStdSpecialization.tpp"
329 #define FUNCTION operator/
330 #define OPERATION_LOGIC codi::OperationDivide
331 #include "binaryComplexToComplexStdSpecialization.tpp"
336 #define OPERATION_LOGIC codi::OperationPow
337 #include "binaryComplexToComplexStdSpecialization.tpp"
354 template<
typename Tape>
355 CODI_INLINE complex<codi::ActiveType<Tape>>
const& operator+(complex<codi::ActiveType<Tape>>
const& arg) {
359 #define FUNCTION operator-
360 #define OPERATION_LOGIC codi::OperationUnaryMinus
361 #include "unaryComplexToComplexStdSpecialization.tpp"
364 #define OPERATION_LOGIC codi::OperationComplexAbs
365 #include "unaryComplexToRealStdSpecialization.tpp"
367 #define FUNCTION acos
368 #define OPERATION_LOGIC codi::OperationAcos
369 #include "unaryComplexToComplexStdSpecialization.tpp"
371 #define FUNCTION acosh
372 #define OPERATION_LOGIC codi::OperationAcosh
373 #include "unaryComplexToComplexStdSpecialization.tpp"
376 #define OPERATION_LOGIC codi::OperationComplexArg
377 #include "unaryComplexToRealStdSpecialization.tpp"
379 #define FUNCTION asin
380 #define OPERATION_LOGIC codi::OperationAsin
381 #include "unaryComplexToComplexStdSpecialization.tpp"
383 #define FUNCTION asinh
384 #define OPERATION_LOGIC codi::OperationAsinh
385 #include "unaryComplexToComplexStdSpecialization.tpp"
387 #define FUNCTION atan
388 #define OPERATION_LOGIC codi::OperationAtan
389 #include "unaryComplexToComplexStdSpecialization.tpp"
391 #define FUNCTION atanh
392 #define OPERATION_LOGIC codi::OperationAtanh
393 #include "unaryComplexToComplexStdSpecialization.tpp"
395 #define FUNCTION conj
396 #define OPERATION_LOGIC codi::OperationComplexConj
397 #include "unaryComplexToComplexStdSpecialization.tpp"
400 #define OPERATION_LOGIC codi::OperationCos
401 #include "unaryComplexToComplexStdSpecialization.tpp"
403 #define FUNCTION cosh
404 #define OPERATION_LOGIC codi::OperationCosh
405 #include "unaryComplexToComplexStdSpecialization.tpp"
408 #define OPERATION_LOGIC codi::OperationExp
409 #include "unaryComplexToComplexStdSpecialization.tpp"
411 #define FUNCTION imag
412 #define OPERATION_LOGIC codi::OperationComplexImag
413 #include "unaryComplexToRealStdSpecialization.tpp"
416 #define OPERATION_LOGIC codi::OperationLog
417 #include "unaryComplexToComplexStdSpecialization.tpp"
419 #define FUNCTION log10
420 #define OPERATION_LOGIC codi::OperationLog10
421 #include "unaryComplexToComplexStdSpecialization.tpp"
423 #define FUNCTION norm
424 #define OPERATION_LOGIC codi::OperationComplexNorm
425 #include "unaryComplexToRealStdSpecialization.tpp"
427 #define FUNCTION proj
428 #define OPERATION_LOGIC codi::OperationComplexProj
429 #include "unaryComplexToComplexStdSpecialization.tpp"
431 #define FUNCTION real
432 #define OPERATION_LOGIC codi::OperationComplexReal
433 #include "unaryComplexToRealStdSpecialization.tpp"
436 #define OPERATION_LOGIC codi::OperationSin
437 #include "unaryComplexToComplexStdSpecialization.tpp"
439 #define FUNCTION sinh
440 #define OPERATION_LOGIC codi::OperationSinh
441 #include "unaryComplexToComplexStdSpecialization.tpp"
443 #define FUNCTION sqrt
444 #define OPERATION_LOGIC codi::OperationSqrt
445 #include "unaryComplexToComplexStdSpecialization.tpp"
448 #define OPERATION_LOGIC codi::OperationTan
449 #include "unaryComplexToComplexStdSpecialization.tpp"
451 #define FUNCTION tanh
452 #define OPERATION_LOGIC codi::OperationTanh
453 #include "unaryComplexToComplexStdSpecialization.tpp"
T_Tape Tape
See complex.
Definition stdComplex.hpp:271
typename InnerActive::Real InnerReal
See ActiveComplex::InnerReal.
Definition stdComplex.hpp:275
complex< typename Tape::Real > Real
See ActiveComplex::Real.
Definition stdComplex.hpp:273
codi::ActiveType< Tape > InnerActive
See ActiveComplex::InnerActive.
Definition stdComplex.hpp:274
inline ~complex()=default
Destructor.
inlinecomplex & operator=(complex const &value)
< Use Base assign operators.
Definition stdComplex.hpp:288
codi::ActiveComplex< codi::ActiveType< Tape >, complex< codi::ActiveType< T_Tape > > > Base
Base class abbreviation.
Definition stdComplex.hpp:278
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
#define CODI_ANY
Used in default declarations of expression templates.
Definition macros.hpp:100
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:116
typename ActiveResultImpl< Real, Tape, isStatic >::ActiveResult ActiveResult
Definition expressionTraits.hpp:137
Traits for values that can be used as real values, e.g. double, float, codi::RealReverse etc....
Definition stdComplex.hpp:204
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type that was used in the application.
Definition realTraits.hpp:123
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
typename std::conditional< std::is_same< Self, Impl >::value, SelfType, Impl >::type ResolveSelf
Definition self.hpp:55
Definition stdComplex.hpp:107
inlineActiveComplex & operator=(ExpressionInterface< InnerReal, ArgR > const &argR)
Assign operation for the inner type of the complex number.
Definition stdComplex.hpp:188
RealTraits::PassiveReal< InnerReal > PassiveInnerReal
Passive inner value.
Definition stdComplex.hpp:115
AssignmentOperators< InnerReal, false, ResolveSelf< Impl, ActiveComplex > > AssignReal
Definition stdComplex.hpp:118
std::complex< InnerReal > Real
Complex value with the inner real.
Definition stdComplex.hpp:114
inline ~ActiveComplex()=default
Destructor.
typename InnerActive::Real InnerReal
Inner real value.
Definition stdComplex.hpp:113
InnerActive value_type
std::complex interface.
Definition stdComplex.hpp:126
inlineActiveComplex & operator=(PassiveInnerReal const &argR)
Assign operation for the inner passive type.
Definition stdComplex.hpp:196
ResolveSelf< T_Impl, ActiveComplex > Impl
See ActiveComplex.
Definition stdComplex.hpp:111
AggregatedActiveType< Real, InnerActive, Impl > Base
Abbreviation for the base class.
Definition stdComplex.hpp:117
T_InnerActive InnerActive
See ActiveComplex.
Definition stdComplex.hpp:110
AssignmentOperators< std::complex< InnerReal >, false, ResolveSelf< Impl, ActiveComplex > > AssignComplex
Definition stdComplex.hpp:121
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
InnerActiveType values[Elements]
Array representation.
Definition aggregatedActiveType.hpp:75
Represents a concrete aggregated lvalue int the CoDiPack expression tree.
Definition aggregatedActiveType.hpp:164
AggregatedActiveTypeBase< Real, InnerActive, Impl, false > Base
Definition aggregatedActiveType.hpp:170
inlinevoid store(ExpressionInterface< Real, Rhs > const &rhs, EventHints::Statement const &eventType)
Has to be called by an AD variable every time it is assigned.
Definition aggregatedActiveType.hpp:224
Provides assignment operators for LhsExpressionInterface implementations.
Definition assignmentOperators.hpp:120
Represents an operator or function with an arbitrary number of arguments in the expression tree.
Definition computeExpression.hpp:371
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:60
inlineImpl const & cast() const
Cast to the implementation.
Definition expressionInterface.hpp:76
T_Real Real
See ExpressionMemberOperations.
Definition stdComplex.hpp:66
ComputeExpression< InnerType, OperationComplexImag, Impl > ExpressionComplexImag
Expression returned by imag.
Definition stdComplex.hpp:80
T_Impl Impl
See ExpressionMemberOperations.
Definition stdComplex.hpp:67
ExpressionComplexImag imag() const
imag member function for complex.
Definition stdComplex.hpp:83
ComputeExpression< InnerType, OperationComplexReal, Impl > ExpressionComplexReal
Expression returned by real.
Definition stdComplex.hpp:72
ExpressionComplexReal real() const
real member function for complex.
Definition stdComplex.hpp:75
typename Real::value_type InnerType
Inner type of the complex.
Definition stdComplex.hpp:69
Definition expressionMemberOperations.hpp:65
inlineImpl const & cast() const
Cast to implementation.
Definition expressionMemberOperations.hpp:72
T_Impl Impl
See ExpressionMemberOperations.
Definition expressionMemberOperations.hpp:67
T_InnerReal InnerReal
See ActiveResultImpl.
Definition stdComplex.hpp:238
std::complex< InnerActiveResult > ActiveResult
The resulting active type of an expression.
Definition stdComplex.hpp:246
ExpressionTraits::ActiveResult< InnerReal, Tape, false > InnerActiveResult
Active result of the inner type.
Definition stdComplex.hpp:242
T_Tape Tape
See ActiveResultImpl.
Definition stdComplex.hpp:239
Definition expressionTraits.hpp:127
Full tape interface that supports all features of CoDiPack.
Definition fullTapeInterface.hpp:84
static inlinestd::string getMathRep()
Get the math symbol of the operation. E.g. + for operators and pow() for functions.
Definition stdComplex.hpp:229
static inlinestd::string getMathRep()
Get the math symbol of the operation. E.g. + for operators and pow() for functions.
Definition stdComplex.hpp:213
Methods that access inner values of aggregated types that contain CoDiPack active types.
Definition realTraits.hpp:226
Base implementation of AggregatedTypeTraits for aggregated types that can be defined as an array.
Definition realTraits.hpp:301