5#ifndef OASIS_MAGNITUDE_HPP
6#define OASIS_MAGNITUDE_HPP
27template <
typename OperandT>
44 if (
auto realCase = RecursiveCast<Real>(*simpOp); realCase !=
nullptr) {
45 double val = realCase->GetValue();
48 if (
auto imgCase = RecursiveCast<Imaginary>(*simpOp); imgCase !=
nullptr) {
66 if (
auto matrixCase = RecursiveCast<Matrix>(*simpOp); matrixCase !=
nullptr) {
68 for (
size_t i = 0; i < matrixCase->GetRows(); i++) {
69 for (
size_t j = 0; j < matrixCase->GetCols(); j++) {
70 sum += pow(matrixCase->GetMatrix()(i, j), 2);
#define EXPRESSION_CATEGORY(category)
Definition Expression.hpp:192
#define EXPRESSION_TYPE(type)
Definition Expression.hpp:181
The Add expression adds two expressions together.
Definition Add.hpp:42
auto GetLeastSigOp() const -> const LeastSigOpT &
Gets the least significant operand of this expression.
Definition BinaryExpression.hpp:286
auto GetMostSigOp() const -> const MostSigOpT &
Gets the most significant operand of this expression.
Definition BinaryExpression.hpp:276
The exponent expression creates an exponent two expressions.
Definition Exponent.hpp:43
An expression.
Definition Expression.hpp:56
virtual auto Simplify() const -> std::unique_ptr< Expression >
Simplifies this expression.
Definition Expression.cpp:244
Definition Magnitude.hpp:28
Magnitude(const Magnitude &other)
Definition Magnitude.hpp:31
Magnitude(const OperandT &operand)
Definition Magnitude.hpp:36
auto Differentiate(const Expression &var) const -> std::unique_ptr< Expression > override
Tries to differentiate this function.
Definition Magnitude.hpp:79
auto Integrate(const Expression &integrationVar) const -> std::unique_ptr< Expression > override
Attempts to integrate this expression using integration rules.
Definition Magnitude.hpp:90
auto Simplify() const -> std::unique_ptr< Expression > override
Simplifies this expression.
Definition Magnitude.hpp:41
The Multiply expression multiplies two expressions.
Definition Multiply.hpp:40
A real number.
Definition Real.hpp:15
Definition UnaryExpression.hpp:14
auto Generalize() const -> std::unique_ptr< Expression > final
Definition UnaryExpression.hpp:53
auto GetOperand() const -> const OperandT &
Definition UnaryExpression.hpp:62
auto RecursiveCast(const Expression &other) -> std::unique_ptr< T >
Definition RecursiveCast.hpp:14
@ UnExp
Definition Expression.hpp:46