diff --git a/include/chemist/dsl/add.hpp b/include/chemist/dsl/add.hpp deleted file mode 100644 index f640d8e17..000000000 --- a/include/chemist/dsl/add.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include - -namespace chemist::dsl { - -/** @brief Represents the addition of two terms. - * - * @tparam LHSType The type of the object on the left of the plus sign. - * @tparam RHSType The type of the object on the right of the plus sign. - * - * This class is essentially a strong type over top of BinaryOp to signal - * that the binary operation is addition (or at the least represented with a - * plus sign). - */ -template -class Add : public BinaryOp, LHSType, RHSType> { -private: - /// Type of *this - using my_type = Add; - - /// Type *this inherits from - using op_type = BinaryOp; - -public: - /// Reuse the base class's ctor - using op_type::op_type; -}; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/binary_op.hpp b/include/chemist/dsl/binary_op.hpp deleted file mode 100644 index 9fed719f1..000000000 --- a/include/chemist/dsl/binary_op.hpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include -#include -#include - -namespace chemist::dsl { - -/** @brief Code factorization for binary operations. - * - * @tparam DerivedType the operation *this is implementing. - * @tparam LHSType The const-qualified type of the object on the left side of - * the operation. - * @tparam RHSType The const-qualified type of the object on the right side of - * the operation. - * - * The DSL implementation of most of the binary operations are the same and is - * implemented by this class. - */ -template -class BinaryOp : public Term { -private: - /// Works out the types associated with LHSType - using lhs_traits = TermTraits; - - /// Works out the types associated with RHSType - using rhs_traits = TermTraits; - -public: - /// Unqualified type of the object on the left side of the operator - using lhs_type = typename lhs_traits::value_type; - - /// Type acting like `lhs_type&`, but respecting const-ness of @p LHSType - using lhs_reference = typename lhs_traits::reference; - - /// Type acting like `const lhs_type&` - using const_lhs_reference = typename lhs_traits::const_reference; - - /// Unqualified type of the object on the right side of the operator - using rhs_type = typename rhs_traits::value_type; - - /// Type acting like `rhs_type&`, but respecting const-ness of @p RHSType - using rhs_reference = typename rhs_traits::reference; - - /// Type acting like `const rhs_type&`. - using const_rhs_reference = typename rhs_traits::const_reference; - - /** @brief Creates a new binary operation by aliasing @p l and @p r. - * - * Generally speaking binary operations will want to alias the terms on - * the left and right of the operator (as opposed to copying them or taking - * ownership). This ctor takes references to the two objects and stores - * them internally as `TermTraits::holder_type` objects (where T is - * @p LHSType and @p RHSType respectively for @p lhs and @p rhs). Thus - * whether *this ultimately owns the objects referenced by @p lhs and - * @p rhs are controlled by the respective specializations of `TermTraits`. - * - * @param[in] l An alias to the object on the left side of the operator. - * @param[in] r An alias to the object on the right side of the operator. - * - * @throw ??? Throws if converting either @p l or @p r to the holder type - * throws. Same throw guarantee. - */ - BinaryOp(lhs_reference l, rhs_reference r) : m_lhs_(l), m_rhs_(r) {} - - // ------------------------------------------------------------------------- - // -- Getters and setters - // ------------------------------------------------------------------------- - - /** @brief Returns a (possibly) mutable reference to the object on the left - * of the operator. - * - * *this is associated with two objects. The one that was on the left side - * of the operator is termed "lhs" and can be accessed via this method. - * - * @return A (possibly) mutable reference to the object which was on the - * left of the operator. The mutable-ness of the return is - * controlled by TermTraits. - * - * @throw ??? Throws if converting from the held type to lhs_reference - * throws. Same throw guarantee. - */ - lhs_reference lhs() { return m_lhs_; } - - /** @brief Returns a read-only reference to the object on the left of the - * operator. - * - * This method is identical to the non-const version except that the return - * is guaranteed to be read-only. - * - * @return A read-only reference to the object on the left of the - * operator. - * - * @throw ??? Throws if converting from the held type to - * const_lhs_reference throws. Same throw guarantee. - */ - const_lhs_reference lhs() const { return m_lhs_; } - - /** @brief Returns a (possibly) mutable reference to the object on the right - * of the operator. - * - * *this is associated with two objects. The one that was on the right side - * of the operator is termed "rhs" and can be accessed via this method. - * - * @return A (possibly) mutable reference to the object which was on the - * right of the operator. The mutable-ness of the return is - * controlled by TermTraits. - * - * @throw ??? Throws if converting from the held type to rhs_reference - * throws. Same throw guarantee. - */ - rhs_reference rhs() { return m_rhs_; } - - /** @brief Returns a read-only reference to the object on the right of the - * operator. - * - * This method is identical to the non-const version except that the return - * is guaranteed to be read-only. - * - * @return A read-only reference to the object on the right of the - * operator. - * - * @throw ??? Throws if converting from the held type to - * const_rhs_reference throws. Same throw guarantee. - */ - const_rhs_reference rhs() const { return m_rhs_; } - - // ------------------------------------------------------------------------- - // -- Utility methods - // ------------------------------------------------------------------------- - - /** @brief Is *this the same binary op as @p other? - * - * @tparam DerivedType2 The type @p other implements. - * @tparam LHSType2 The type of lhs in @p other. - * @tparam RHSType2 The type of rhs in @p other. - * - * Two BinaryOp objects are the same if they: - * - Implement the same operation, e.g., both are implementing addition, - * - Both have the same value of lhs, and - * - Both have the same value of rhs. - * - * It should be noted that following C++ convention, value comparisons are - * done with const references and thus the const-ness of @tparam LHSType - * and @tparam RHSType vs the respective const-ness of @tparam LHSType2 - * and @tparam RHSType2 is not considered. - * - * @param[in] other The object to compare to. - * - * @return True if *this is value equal and false otherwise. - * - * @throw None No throw guarantee. - */ - template - bool operator==( - const BinaryOp& other) const noexcept; - - /** @brief Is *this different than @p other? - * - * @tparam DerivedType2 The type @p other implements. - * @tparam LHSType2 The type of lhs in @p other. - * @tparam RHSType2 The type of rhs in @p other. - * - * This method defines "different" as not value equal. See the description - * for operator== for the definition of value equal. - * - * @param[in] other The object to compare to *this. - * - * @return False if *this is value equal to @p other and true otherwise. - * - * @throw None No throw guarantee. - */ - template - bool operator!=( - const BinaryOp& other) const noexcept { - return !((*this) == other); - } - -private: - /// The object on the left side of the operator - typename lhs_traits::holder_type m_lhs_; - - /// The object on the right side of the operator - typename rhs_traits::holder_type m_rhs_; -}; - -// ----------------------------------------------------------------------------- -// -- Out of line inline definitions -// ----------------------------------------------------------------------------- - -template -template -bool BinaryOp::operator==( - const BinaryOp& other) const noexcept { - using lhs2_type = typename TermTraits::value_type; - using rhs2_type = typename TermTraits::value_type; - constexpr auto l_same = std::is_same_v; - constexpr auto r_same = std::is_same_v; - if constexpr(l_same && r_same) { - return std::tie(lhs(), rhs()) == std::tie(other.lhs(), other.rhs()); - } else { - return false; - } -} - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/divide.hpp b/include/chemist/dsl/divide.hpp deleted file mode 100644 index a51bb5fc9..000000000 --- a/include/chemist/dsl/divide.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include - -namespace chemist::dsl { - -/** @brief Represents the division of two terms. - * - * @tparam LHSType The type of the object on the left of the division sign. - * @tparam RHSType The type of the object on the right of the division sign. - * - * This class is essentially a strong type over top of BinaryOp to signal - * that the binary operation is division (or at the least represented - * with a divide sign). - */ -template -class Divide : public BinaryOp, LHSType, RHSType> { -private: - /// Type of *this - using my_type = Divide; - - /// Type *this inherits from - using op_type = BinaryOp; - -public: - /// Reuse the base class's ctor - using op_type::op_type; -}; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/dsl.hpp b/include/chemist/dsl/dsl.hpp deleted file mode 100644 index 3de3063c7..000000000 --- a/include/chemist/dsl/dsl.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include -#include -#include -#include \ No newline at end of file diff --git a/include/chemist/dsl/dsl_fwd.hpp b/include/chemist/dsl/dsl_fwd.hpp deleted file mode 100644 index 6b62d60a4..000000000 --- a/include/chemist/dsl/dsl_fwd.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -/** @file dsl_fwd.hpp - * - * This file forward declares the classes needed to power the DSL. The - * forward declarations are primarily useful for declaring interfaces and - * for template meta-programming. - */ - -namespace chemist::dsl { - -template -class Add; - -template -class BinaryOp; - -template -class Divide; - -template -class Multiply; - -template -class Subtract; - -template -class Term; - -template -class TermTraits; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/multiply.hpp b/include/chemist/dsl/multiply.hpp deleted file mode 100644 index c8c6b7d55..000000000 --- a/include/chemist/dsl/multiply.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include - -namespace chemist::dsl { - -/** @brief Represents the multiplication of two terms. - * - * @tparam LHSType The type of the object on the left of the times sign. - * @tparam RHSType The type of the object on the right of the times sign. - * - * This class is essentially a strong type over top of BinaryOp to signal - * that the binary operation is multiplication (or at the least represented - * with a times sign). - */ -template -class Multiply : public BinaryOp, LHSType, RHSType> { -private: - /// Type of *this - using my_type = Multiply; - - /// Type *this inherits from - using op_type = BinaryOp; - -public: - /// Reuse the base class's ctor - using op_type::op_type; -}; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/subtract.hpp b/include/chemist/dsl/subtract.hpp deleted file mode 100644 index f411c7127..000000000 --- a/include/chemist/dsl/subtract.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include - -namespace chemist::dsl { - -/** @brief Represents the subtraction of two terms. - * - * @tparam LHSType The type of the object on the left of the subtraction sign. - * @tparam RHSType The type of the object on the right of the subtraction sign. - * - * This class is essentially a strong type over top of BinaryOp to signal - * that the binary operation is subtraction (or at the least represented - * with a minus sign). - */ -template -class Subtract : public BinaryOp, LHSType, RHSType> { -private: - /// Type of *this - using my_type = Subtract; - - /// Type *this inherits from - using op_type = BinaryOp; - -public: - /// Reuse the base class's ctor - using op_type::op_type; -}; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/term.hpp b/include/chemist/dsl/term.hpp deleted file mode 100644 index d56d9487d..000000000 --- a/include/chemist/dsl/term.hpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include -#include - -namespace chemist::dsl { - -/** @brief Base class for all elements of the DSL. - * - * @tparam DerivedType Type of the object *this is implementing. - * - * Users of the DSL need to implement operator+, operator-, etc. for their - * leaves. The returns of those functions are DSL Term objects. Those objects - * can then further be composed. The Term class implements further - * composition with DSL objects. - */ -template -class Term { -public: - /** @brief Adds *this to @p rhs. - * - * @tparam RHSType The type of @p rhs. - * - * This method will create an object representing left addition by *this - * to @p rhs. - * - * @param[in] rhs The object to *this will be added. - * - * @throw ??? Throws if creation of the new DSL term throws. Same throw - * guarantee. - */ - template - auto operator+(RHSType&& rhs) { - auto& lhs = static_cast(*this); - using no_ref_t = std::remove_reference_t; - return Add(lhs, std::forward(rhs)); - } - - /** @brief Subtracts @p rhs from this. - * - * @tparam RHSType The type of @p rhs. - * - * This method will create an object representing subtracting @p rhs from - * *this. - * - * @param[in] rhs The object to be subtracted from *this. - * - * @throw ??? Throws if creation of the new DSL term throws. Same throw - * guarantee. - */ - template - auto operator-(RHSType&& rhs) { - auto& lhs = static_cast(*this); - using no_ref_t = std::remove_reference_t; - return Subtract(lhs, std::forward(rhs)); - } - - /** @brief Multiplies *this to @p rhs. - * - * @tparam RHSType The type of @p rhs. - * - * This method will create an object representing left multiplication by - * *this to @p rhs. - * - * @param[in] rhs The object *this will be multiply. - * - * @throw ??? Throws if creation of the new DSL term throws. Same throw - * guarantee. - */ - template - auto operator*(RHSType&& rhs) { - auto& lhs = static_cast(*this); - using no_ref_t = std::remove_reference_t; - return Multiply(lhs, std::forward(rhs)); - } - - /** @brief Divides *this by @p rhs. - * - * @tparam RHSType The type of @p rhs. - * - * This method will create an object representing division of - * *this by @p rhs. - * - * @param[in] rhs The object to divide *this by. - * - * @throw ??? Throws if creation of the new DSL term throws. Same throw - * guarantee. - */ - template - auto operator/(RHSType&& rhs) { - auto& lhs = static_cast(*this); - using no_ref_t = std::remove_reference_t; - return Divide(lhs, std::forward(rhs)); - } - - decltype(auto) downcast() { return static_cast(*this); } - - decltype(auto) downcast() const { - return static_cast(*this); - } -}; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/dsl/term_traits.hpp b/include/chemist/dsl/term_traits.hpp deleted file mode 100644 index 209120176..000000000 --- a/include/chemist/dsl/term_traits.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include - -namespace chemist::dsl { - -/** @brief Class used to work out the DSL traits for an object of type @p T. - * - * @tparam T The type we are working out the traits for. Can be mutable or - * const-qualified - * - * The DSL component is designed to work with a myriad of object types. In - * order for this to work we need to know how to take both mutable and - * read-only references to the object. This trait works out the types of those - * references. Users can specialize this class to modify the behavior of the - * DSL for their type - */ -template -class TermTraits { -public: - /// Can @p T be expressed as `const U` where U is a non-const type? - static constexpr bool is_const_v = std::is_const_v; - - /** @brief The type of @p T with all qualifiers removed - * - * The TermTraits class allows the template type parameter to be qualified. - * This member type strips all of the qualifiers off. This member type is - * used throughout this class for: - * - * - Deriving new types (e.g., adding an ampersand creates the reference - * type). - * - Determining if two TermTraits objects describe the same type - */ - using value_type = std::decay_t; - - /** @brief The type of a read-only reference to an object of type @p T. - * - * When a DSL term contains an object of type @p T, requests to access the - * term via a read-only reference will return an object of this type. This - * class defines that type as `const value_type&`. - */ - using const_reference = const value_type&; - - /** @brief The type of a (possibly) mutable reference to an object of - * type @p T. - * - * When a DSL term contains an object of type @p T, requests to access the - * term as a mutable reference will return an object of this type. This - * class defines that type as `const_reference` if @p T is a const- - * qualified type and `value_type&` if @p T is not const-qualified. - */ - using reference = - std::conditional_t; - - /** @brief Is @p T part of the DSL layer? - * - * Terms that are part of the DSL layer are often unnamed temporaries and - * their storage must be handled specially. This member variable is used - * to determine if @p T either derives from dsl::Term, or if it is a - * floating point type (floating point types are often specified inline as - * if they were part of the DSL). - */ - static constexpr bool is_dsl_term_v = - std::is_base_of_v, value_type> || - std::is_floating_point_v; - - /** @brief The type terms will hold @p T as. - * - * The terms of the DSL capture the inputs as the DSL is built up. When a - * term needs to hold an object of type @p T it does so by storing it as - * an object of type `holder_type`. For leaf objects (objects not part of - * the DSL) the default is to hold them as `reference` objects. This means - * that the DSL is NOT responsible for their lifetime. If @p T is an - * object that is part of the DSL then @p T is captured by value (DSL - * terms are expected to be light-weight and temporary). - */ - using holder_type = - std::conditional_t; -}; - -} // namespace chemist::dsl \ No newline at end of file diff --git a/include/chemist/quantum_mechanics/operator/core_hamiltonian.hpp b/include/chemist/quantum_mechanics/operator/core_hamiltonian.hpp index 391e7e0f6..fb1267698 100644 --- a/include/chemist/quantum_mechanics/operator/core_hamiltonian.hpp +++ b/include/chemist/quantum_mechanics/operator/core_hamiltonian.hpp @@ -15,8 +15,8 @@ */ #pragma once -#include #include +#include namespace chemist::qm_operator { @@ -68,7 +68,7 @@ class CoreHamiltonian : public detail_::LinearCombinationImpl { * throw guarantee. */ template - explicit CoreHamiltonian(const dsl::Term& expression) : + explicit CoreHamiltonian(const utilities::dsl::Term& expression) : impl_type(parser_type(expression.downcast()).m_terms) {} /** @brief Initializes *this with a deep copy of @p other. diff --git a/include/chemist/quantum_mechanics/operator/detail_/operator_impl.hpp b/include/chemist/quantum_mechanics/operator/detail_/operator_impl.hpp index 63d2a346f..195bebfa3 100644 --- a/include/chemist/quantum_mechanics/operator/detail_/operator_impl.hpp +++ b/include/chemist/quantum_mechanics/operator/detail_/operator_impl.hpp @@ -16,7 +16,6 @@ #pragma once #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include namespace chemist::qm_operator::detail_ { @@ -188,7 +188,8 @@ class OperatorImpl : public OperatorBase { */ template auto operator+(const RHSType& rhs) const { - return dsl::Add(downcast_(), rhs); + return utilities::dsl::Add( + downcast_(), rhs); } /** @brief Subtracts @p rhs from *this. @@ -204,8 +205,8 @@ class OperatorImpl : public OperatorBase { */ template auto operator-(const RHSType& rhs) const { - return dsl::Subtract(downcast_(), - rhs); + return utilities::dsl::Subtract( + downcast_(), rhs); } /** @brief Right multiplies *this by @p rhs. @@ -221,8 +222,8 @@ class OperatorImpl : public OperatorBase { */ template auto operator*(const RHSType& rhs) const { - return dsl::Multiply(downcast_(), - rhs); + return utilities::dsl::Multiply( + downcast_(), rhs); } protected: @@ -335,7 +336,7 @@ template>> auto operator*(const LHSType& lhs, const OperatorImpl& rhs) { - return dsl::Multiply( + return utilities::dsl::Multiply( lhs, static_cast(rhs)); } diff --git a/include/chemist/quantum_mechanics/operator/detail_/unpack_linear_combination.hpp b/include/chemist/quantum_mechanics/operator/detail_/unpack_linear_combination.hpp index 435d91e3f..6d8c712f0 100644 --- a/include/chemist/quantum_mechanics/operator/detail_/unpack_linear_combination.hpp +++ b/include/chemist/quantum_mechanics/operator/detail_/unpack_linear_combination.hpp @@ -15,9 +15,9 @@ */ #pragma once -#include #include #include +#include #include namespace chemist::qm_operator::detail_ { @@ -118,7 +118,7 @@ struct UnpackLinearCombination { * @throw ??? if unpacking the operation throws. Same through guarantee. */ template - UnpackLinearCombination(const dsl::Add& op) : + UnpackLinearCombination(const utilities::dsl::Add& op) : UnpackLinearCombination(op.lhs()) { unpack_into_mterms(1.0, op.rhs()); } @@ -136,7 +136,8 @@ struct UnpackLinearCombination { * @throw ??? if unpacking the operation throws. Same through guarantee. */ template - UnpackLinearCombination(const dsl::Multiply& op) : + UnpackLinearCombination( + const utilities::dsl::Multiply& op) : UnpackLinearCombination(op.lhs(), op.rhs()) {} /** @brief Handles the subtraction of two terms. @@ -149,7 +150,8 @@ struct UnpackLinearCombination { * @throw ??? if unpacking the operation throws. Same through guarantee. */ template - UnpackLinearCombination(const dsl::Subtract& op) : + UnpackLinearCombination( + const utilities::dsl::Subtract& op) : UnpackLinearCombination(op.lhs()) { unpack_into_mterms(-1.0, op.rhs()); } diff --git a/include/chemist/quantum_mechanics/operator/electronic_hamiltonian.hpp b/include/chemist/quantum_mechanics/operator/electronic_hamiltonian.hpp index 0372f580f..224105266 100644 --- a/include/chemist/quantum_mechanics/operator/electronic_hamiltonian.hpp +++ b/include/chemist/quantum_mechanics/operator/electronic_hamiltonian.hpp @@ -15,9 +15,9 @@ */ #pragma once -#include #include #include +#include namespace chemist::qm_operator { @@ -72,7 +72,7 @@ class ElectronicHamiltonian * Strong throw guarantee. */ template - explicit ElectronicHamiltonian(const dsl::Term& expression) : + explicit ElectronicHamiltonian(const utilities::dsl::Term& expression) : impl_type(parser_type(expression.downcast()).m_terms) {} /** @brief Initializes *this with a deep copy of @p other. diff --git a/include/chemist/quantum_mechanics/operator/fock.hpp b/include/chemist/quantum_mechanics/operator/fock.hpp index dc95a8f31..7d3ce4e22 100644 --- a/include/chemist/quantum_mechanics/operator/fock.hpp +++ b/include/chemist/quantum_mechanics/operator/fock.hpp @@ -15,8 +15,8 @@ */ #pragma once -#include #include +#include namespace chemist::qm_operator { @@ -57,7 +57,7 @@ class Fock : public detail_::LinearCombinationImpl { * throw guarantee. */ template - explicit Fock(const dsl::Term& expression) : + explicit Fock(const utilities::dsl::Term& expression) : impl_type(parser_type(expression.downcast()).m_terms) {} /** @brief Initializes *this with a deep copy of @p other. diff --git a/include/chemist/quantum_mechanics/operator/hamiltonian.hpp b/include/chemist/quantum_mechanics/operator/hamiltonian.hpp index b4f3e5d81..71095d48a 100644 --- a/include/chemist/quantum_mechanics/operator/hamiltonian.hpp +++ b/include/chemist/quantum_mechanics/operator/hamiltonian.hpp @@ -15,9 +15,9 @@ */ #pragma once -#include #include #include +#include namespace chemist::qm_operator { @@ -79,7 +79,7 @@ class Hamiltonian : public detail_::LinearCombinationImpl { * throw guarantee. */ template - explicit Hamiltonian(const dsl::Term& expression) : + explicit Hamiltonian(const utilities::dsl::Term& expression) : impl_type(parser_type(expression.downcast()).m_terms) {} /** @brief Returns the subset of *this which depends on the electrons. diff --git a/tests/cxx/unit_tests/dsl/add.cpp b/tests/cxx/unit_tests/dsl/add.cpp deleted file mode 100644 index 28045894f..000000000 --- a/tests/cxx/unit_tests/dsl/add.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_dsl.hpp" -#include - -/* Testing Strategy. - * - * Add is basically a strong type, we just test it can be constructed with all - * of the possible const-variations. - */ - -TEMPLATE_LIST_TEST_CASE("Add", "", test_chemist::binary_types) { - using lhs_type = std::tuple_element_t<0, TestType>; - using rhs_type = std::tuple_element_t<1, TestType>; - - auto values = test_chemist::binary_values(); - auto [lhs, rhs] = std::get(values); - - chemist::dsl::Add a_xx(lhs, rhs); - chemist::dsl::Add a_cx(lhs, rhs); - chemist::dsl::Add a_xc(lhs, rhs); - chemist::dsl::Add a_cc(lhs, rhs); - - SECTION("CTors") { - REQUIRE(a_xx.lhs() == lhs); - REQUIRE(a_xx.rhs() == rhs); - - REQUIRE(a_cx.lhs() == lhs); - REQUIRE(a_cx.rhs() == rhs); - - REQUIRE(a_xc.lhs() == lhs); - REQUIRE(a_xc.rhs() == rhs); - - REQUIRE(a_cc.lhs() == lhs); - REQUIRE(a_cc.rhs() == rhs); - } -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/binary_op.cpp b/tests/cxx/unit_tests/dsl/binary_op.cpp deleted file mode 100644 index e9466e340..000000000 --- a/tests/cxx/unit_tests/dsl/binary_op.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_dsl.hpp" -#include - -/* Testing Strategy. - * - * The classes which derive from BinaryOp are strong types. We thus only need - * to test the BinaryOp infrastructure for one derived class (we must test - * through the derived class because of the CRTP usage). - */ - -TEMPLATE_LIST_TEST_CASE("BinaryOp", "", test_chemist::binary_types) { - using lhs_type = std::tuple_element_t<0, TestType>; - using rhs_type = std::tuple_element_t<1, TestType>; - - auto values = test_chemist::binary_values(); - auto [lhs, rhs] = std::get(values); - - chemist::dsl::Add a_xx(lhs, rhs); - chemist::dsl::Add a_cx(lhs, rhs); - chemist::dsl::Add a_xc(lhs, rhs); - chemist::dsl::Add a_cc(lhs, rhs); - - SECTION("CTors") { - REQUIRE(a_xx.lhs() == lhs); - REQUIRE(a_xx.rhs() == rhs); - - REQUIRE(a_cx.lhs() == lhs); - REQUIRE(a_cx.rhs() == rhs); - - REQUIRE(a_xc.lhs() == lhs); - REQUIRE(a_xc.rhs() == rhs); - - REQUIRE(a_cc.lhs() == lhs); - REQUIRE(a_cc.rhs() == rhs); - } - - SECTION("lhs()") { - REQUIRE(a_xx.lhs() == lhs); - REQUIRE(a_cx.lhs() == lhs); - REQUIRE(a_xc.lhs() == lhs); - REQUIRE(a_cc.lhs() == lhs); - } - - SECTION("lhs() const") { - REQUIRE(std::as_const(a_xx).lhs() == lhs); - REQUIRE(std::as_const(a_cx).lhs() == lhs); - REQUIRE(std::as_const(a_xc).lhs() == lhs); - REQUIRE(std::as_const(a_cc).lhs() == lhs); - } - - SECTION("rhs()") { - REQUIRE(a_xx.rhs() == rhs); - REQUIRE(a_cx.rhs() == rhs); - REQUIRE(a_xc.rhs() == rhs); - REQUIRE(a_cc.rhs() == rhs); - } - - SECTION("rhs() const") { - REQUIRE(std::as_const(a_xx).rhs() == rhs); - REQUIRE(std::as_const(a_cx).rhs() == rhs); - REQUIRE(std::as_const(a_xc).rhs() == rhs); - REQUIRE(std::as_const(a_cc).rhs() == rhs); - } - - SECTION("operator==") { - SECTION("Same values") { - chemist::dsl::Add add2(lhs, rhs); - REQUIRE(a_xx == add2); - } - - SECTION("Different const-ness") { - REQUIRE(a_xx == a_cx); - REQUIRE(a_xx == a_xc); - REQUIRE(a_xx == a_cc); - REQUIRE(a_cx == a_xc); - REQUIRE(a_cx == a_cc); - REQUIRE(a_xc == a_cc); - } - - SECTION("Different values") { - lhs_type lhs2; - rhs_type rhs2; - chemist::dsl::Add add_l(lhs2, rhs); - chemist::dsl::Add add_r(lhs, rhs2); - REQUIRE_FALSE(a_xx == add_l); - REQUIRE_FALSE(a_xx == add_r); - } - - SECTION("Different type") { - char a = 'a'; - chemist::dsl::Add add_l(a, rhs); - chemist::dsl::Add add_r(lhs, a); - REQUIRE_FALSE(a_xx == add_l); - REQUIRE_FALSE(a_xx == add_r); - } - } - - SECTION("operator!=") { - // Just negates operator== so spot check - lhs_type lhs2; - chemist::dsl::Add add_r(lhs2, rhs); - REQUIRE_FALSE(a_xx != a_cx); - REQUIRE(a_xx != add_r); - } -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/divide.cpp b/tests/cxx/unit_tests/dsl/divide.cpp deleted file mode 100644 index 19d3afac6..000000000 --- a/tests/cxx/unit_tests/dsl/divide.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_dsl.hpp" -#include - -/* Testing Strategy. - * - * Divide is basically a strong type, we just test it can be constructed with - * all of the possible const-variations. - */ - -TEMPLATE_LIST_TEST_CASE("Divide", "", test_chemist::binary_types) { - using lhs_type = std::tuple_element_t<0, TestType>; - using rhs_type = std::tuple_element_t<1, TestType>; - - auto values = test_chemist::binary_values(); - auto [lhs, rhs] = std::get(values); - - chemist::dsl::Divide a_xx(lhs, rhs); - chemist::dsl::Divide a_cx(lhs, rhs); - chemist::dsl::Divide a_xc(lhs, rhs); - chemist::dsl::Divide a_cc(lhs, rhs); - - SECTION("CTors") { - REQUIRE(a_xx.lhs() == lhs); - REQUIRE(a_xx.rhs() == rhs); - - REQUIRE(a_cx.lhs() == lhs); - REQUIRE(a_cx.rhs() == rhs); - - REQUIRE(a_xc.lhs() == lhs); - REQUIRE(a_xc.rhs() == rhs); - - REQUIRE(a_cc.lhs() == lhs); - REQUIRE(a_cc.rhs() == rhs); - } -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/multiply.cpp b/tests/cxx/unit_tests/dsl/multiply.cpp deleted file mode 100644 index 69e20b1db..000000000 --- a/tests/cxx/unit_tests/dsl/multiply.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_dsl.hpp" -#include - -/* Testing Strategy. - * - * Multiply is basically a strong type, we just test it can be constructed with - * all of the possible const-variations. - */ - -TEMPLATE_LIST_TEST_CASE("Multiply", "", test_chemist::binary_types) { - using lhs_type = std::tuple_element_t<0, TestType>; - using rhs_type = std::tuple_element_t<1, TestType>; - - auto values = test_chemist::binary_values(); - auto [lhs, rhs] = std::get(values); - - chemist::dsl::Multiply a_xx(lhs, rhs); - chemist::dsl::Multiply a_cx(lhs, rhs); - chemist::dsl::Multiply a_xc(lhs, rhs); - chemist::dsl::Multiply a_cc(lhs, rhs); - - SECTION("CTors") { - REQUIRE(a_xx.lhs() == lhs); - REQUIRE(a_xx.rhs() == rhs); - - REQUIRE(a_cx.lhs() == lhs); - REQUIRE(a_cx.rhs() == rhs); - - REQUIRE(a_xc.lhs() == lhs); - REQUIRE(a_xc.rhs() == rhs); - - REQUIRE(a_cc.lhs() == lhs); - REQUIRE(a_cc.rhs() == rhs); - } -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/subtract.cpp b/tests/cxx/unit_tests/dsl/subtract.cpp deleted file mode 100644 index 4088cef21..000000000 --- a/tests/cxx/unit_tests/dsl/subtract.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_dsl.hpp" -#include - -/* Testing Strategy. - * - * Subtract is basically a strong type, we just test it can be constructed with - * all of the possible const-variations. - */ - -TEMPLATE_LIST_TEST_CASE("Subtract", "", test_chemist::binary_types) { - using lhs_type = std::tuple_element_t<0, TestType>; - using rhs_type = std::tuple_element_t<1, TestType>; - - auto values = test_chemist::binary_values(); - auto [lhs, rhs] = std::get(values); - - chemist::dsl::Subtract a_xx(lhs, rhs); - chemist::dsl::Subtract a_cx(lhs, rhs); - chemist::dsl::Subtract a_xc(lhs, rhs); - chemist::dsl::Subtract a_cc(lhs, rhs); - - SECTION("CTors") { - REQUIRE(a_xx.lhs() == lhs); - REQUIRE(a_xx.rhs() == rhs); - - REQUIRE(a_cx.lhs() == lhs); - REQUIRE(a_cx.rhs() == rhs); - - REQUIRE(a_xc.lhs() == lhs); - REQUIRE(a_xc.rhs() == rhs); - - REQUIRE(a_cc.lhs() == lhs); - REQUIRE(a_cc.rhs() == rhs); - } -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/term.cpp b/tests/cxx/unit_tests/dsl/term.cpp deleted file mode 100644 index e747ab14c..000000000 --- a/tests/cxx/unit_tests/dsl/term.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_dsl.hpp" -#include - -/* Testing Strategy. - * - * The Term class ensures that it is possible to combine DSL objects without - * having to overload operator+, operator*, etc. for every object type in the - * DSL. Thus to test it, it suffices to have a DSL object that derives from - * Term and then to operate on that object. For this purpose we define an object - * "a" which represents adding 4 and 2. We then add, multiply, etc. to "a" the - * integer 42. - */ - -TEST_CASE("Term") { - int four(4), two(2), forty_two(42); - using lhs_type = chemist::dsl::Add; - lhs_type a(four, two); - - SECTION("operator+") { - chemist::dsl::Add corr(a, forty_two); - REQUIRE((a + forty_two) == corr); - } - - SECTION("operator-") { - chemist::dsl::Subtract corr(a, forty_two); - REQUIRE((a - forty_two) == corr); - } - - SECTION("operator*") { - chemist::dsl::Multiply corr(a, forty_two); - REQUIRE((a * forty_two) == corr); - } - - SECTION("operator/") { - chemist::dsl::Divide corr(a, forty_two); - REQUIRE((a / forty_two) == corr); - } -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/term_traits.cpp b/tests/cxx/unit_tests/dsl/term_traits.cpp deleted file mode 100644 index af038ae9e..000000000 --- a/tests/cxx/unit_tests/dsl/term_traits.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "../catch.hpp" -#include -#include - -using namespace chemist; - -/* Testing strategy. - * - * Our goal here is to verify that we implemented the TMP in the TermTraits - * class correctly. That really depends on whether or not the template type - * parameter T: - * - * - is const qualified, - * - is derived from dsl::Term, - * - is a floating point type - */ - -TEST_CASE("TermTraits") { - using traits = dsl::TermTraits; - STATIC_REQUIRE_FALSE(traits::is_const_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE_FALSE(traits::is_dsl_term_v); - STATIC_REQUIRE(std::is_same_v); -} - -TEST_CASE("TermTraits") { - using traits = dsl::TermTraits; - STATIC_REQUIRE(traits::is_const_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE_FALSE(traits::is_dsl_term_v); - STATIC_REQUIRE(std::is_same_v); -} - -TEST_CASE("TermTraits") { - using traits = dsl::TermTraits; - STATIC_REQUIRE_FALSE(traits::is_const_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(traits::is_dsl_term_v); - STATIC_REQUIRE(std::is_same_v); -} - -TEST_CASE("TermTraits") { - using traits = dsl::TermTraits; - STATIC_REQUIRE(traits::is_const_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(traits::is_dsl_term_v); - STATIC_REQUIRE(std::is_same_v); -} - -TEST_CASE("TermTraits>") { - using op_t = dsl::Add; - using traits = dsl::TermTraits; - STATIC_REQUIRE_FALSE(traits::is_const_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(traits::is_dsl_term_v); - STATIC_REQUIRE(std::is_same_v); -} - -TEST_CASE("TermTraits>") { - using op_t = dsl::Add; - using traits = dsl::TermTraits; - STATIC_REQUIRE(traits::is_const_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(std::is_same_v); - STATIC_REQUIRE(traits::is_dsl_term_v); - STATIC_REQUIRE(std::is_same_v); -} \ No newline at end of file diff --git a/tests/cxx/unit_tests/dsl/test_dsl.hpp b/tests/cxx/unit_tests/dsl/test_dsl.hpp deleted file mode 100644 index 90f6c88e7..000000000 --- a/tests/cxx/unit_tests/dsl/test_dsl.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2024 NWChemEx-Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "../test_helpers.hpp" -#include -#include -#include - -/* Testing strategy. - * - * The DSL component doesn't really care what the types are as long as they - * are comparable via operator==. So we test with built-in types: - * - * - double - * - int - * - * and "user-defined" (actually defined in standard library) types like: - * - * - std::vector - * - std::map. - * - * For the purposes of integration testing, the tests in operator_impl.cpp - * will ensure that operators can be added together. - */ - -namespace test_chemist { - -/// Provides a tuple of values to initialize unary DSL terms with -inline auto unary_values() { - return std::make_tuple(double{3.14}, int{42}, std::vector{1, 2, 3}, - std::map{{3.14, 42}}); -} - -/// Tuple type returned from unary_values -using unary_types = decltype(unary_values()); - -/// Provides a tuple of pairs of values to initialize binary DSL terms with -inline auto binary_values() { - auto [v0, v1, v2, v3] = unary_values(); - return std::make_tuple(std::pair(v0, v0), std::pair(v0, v1), - std::pair(v2, v3), std::pair(v3, v3)); -} - -/// Tuple type returned from binary_values -using binary_types = decltype(binary_values()); - -} // namespace test_chemist diff --git a/tests/cxx/unit_tests/quantum_mechanics/operator/detail_/operator_impl.cpp b/tests/cxx/unit_tests/quantum_mechanics/operator/detail_/operator_impl.cpp index dc3f13bd4..1e267ddd1 100644 --- a/tests/cxx/unit_tests/quantum_mechanics/operator/detail_/operator_impl.cpp +++ b/tests/cxx/unit_tests/quantum_mechanics/operator/detail_/operator_impl.cpp @@ -73,17 +73,17 @@ TEST_CASE("OperatorImpl") { } SECTION("operator+") { - chemist::dsl::Add corr(t, t); + utilities::dsl::Add corr(t, t); REQUIRE((t + t) == corr); } SECTION("operator-") { - chemist::dsl::Subtract corr(t, t); + utilities::dsl::Subtract corr(t, t); REQUIRE((t - t) == corr); } SECTION("operator*") { - chemist::dsl::Multiply corr(t, t); + utilities::dsl::Multiply corr(t, t); REQUIRE((t * t) == corr); }