mqt-core 3.3.2__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mqt/core/__init__.py +89 -0
- mqt/core/__main__.py +55 -0
- mqt/core/_commands.py +52 -0
- mqt/core/_compat/__init__.py +11 -0
- mqt/core/_compat/typing.py +29 -0
- mqt/core/_version.py +34 -0
- mqt/core/_version.pyi +12 -0
- mqt/core/bin/mqt-core-algorithms.dll +0 -0
- mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
- mqt/core/bin/mqt-core-dd.dll +0 -0
- mqt/core/bin/mqt-core-ds.dll +0 -0
- mqt/core/bin/mqt-core-fomac.dll +0 -0
- mqt/core/bin/mqt-core-ir.dll +0 -0
- mqt/core/bin/mqt-core-na-fomac.dll +0 -0
- mqt/core/bin/mqt-core-na.dll +0 -0
- mqt/core/bin/mqt-core-qasm.dll +0 -0
- mqt/core/bin/mqt-core-qdmi-driver.dll +0 -0
- mqt/core/bin/mqt-core-qdmi-na-device.dll +0 -0
- mqt/core/bin/mqt-core-zx.dll +0 -0
- mqt/core/dd.cp312-win_amd64.pyd +0 -0
- mqt/core/dd.pyi +1016 -0
- mqt/core/dd_evaluation.py +368 -0
- mqt/core/fomac.cp312-win_amd64.pyd +0 -0
- mqt/core/fomac.pyi +125 -0
- mqt/core/include/mqt-core/algorithms/BernsteinVazirani.hpp +39 -0
- mqt/core/include/mqt-core/algorithms/GHZState.hpp +18 -0
- mqt/core/include/mqt-core/algorithms/Grover.hpp +33 -0
- mqt/core/include/mqt-core/algorithms/QFT.hpp +21 -0
- mqt/core/include/mqt-core/algorithms/QPE.hpp +30 -0
- mqt/core/include/mqt-core/algorithms/RandomCliffordCircuit.hpp +22 -0
- mqt/core/include/mqt-core/algorithms/StatePreparation.hpp +43 -0
- mqt/core/include/mqt-core/algorithms/WState.hpp +18 -0
- mqt/core/include/mqt-core/algorithms/mqt_core_algorithms_export.h +43 -0
- mqt/core/include/mqt-core/boost/config/abi/borland_prefix.hpp +27 -0
- mqt/core/include/mqt-core/boost/config/abi/borland_suffix.hpp +12 -0
- mqt/core/include/mqt-core/boost/config/abi/msvc_prefix.hpp +22 -0
- mqt/core/include/mqt-core/boost/config/abi/msvc_suffix.hpp +8 -0
- mqt/core/include/mqt-core/boost/config/abi_prefix.hpp +25 -0
- mqt/core/include/mqt-core/boost/config/abi_suffix.hpp +25 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx03.hpp +211 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx11.hpp +212 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx14.hpp +47 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx17.hpp +65 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx20.hpp +59 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx23.hpp +41 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx98.hpp +23 -0
- mqt/core/include/mqt-core/boost/config/auto_link.hpp +525 -0
- mqt/core/include/mqt-core/boost/config/compiler/borland.hpp +342 -0
- mqt/core/include/mqt-core/boost/config/compiler/clang.hpp +370 -0
- mqt/core/include/mqt-core/boost/config/compiler/clang_version.hpp +89 -0
- mqt/core/include/mqt-core/boost/config/compiler/codegear.hpp +389 -0
- mqt/core/include/mqt-core/boost/config/compiler/comeau.hpp +59 -0
- mqt/core/include/mqt-core/boost/config/compiler/common_edg.hpp +185 -0
- mqt/core/include/mqt-core/boost/config/compiler/compaq_cxx.hpp +19 -0
- mqt/core/include/mqt-core/boost/config/compiler/cray.hpp +446 -0
- mqt/core/include/mqt-core/boost/config/compiler/diab.hpp +26 -0
- mqt/core/include/mqt-core/boost/config/compiler/digitalmars.hpp +146 -0
- mqt/core/include/mqt-core/boost/config/compiler/gcc.hpp +386 -0
- mqt/core/include/mqt-core/boost/config/compiler/gcc_xml.hpp +115 -0
- mqt/core/include/mqt-core/boost/config/compiler/greenhills.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/compiler/hp_acc.hpp +153 -0
- mqt/core/include/mqt-core/boost/config/compiler/intel.hpp +577 -0
- mqt/core/include/mqt-core/boost/config/compiler/kai.hpp +33 -0
- mqt/core/include/mqt-core/boost/config/compiler/metrowerks.hpp +201 -0
- mqt/core/include/mqt-core/boost/config/compiler/mpw.hpp +143 -0
- mqt/core/include/mqt-core/boost/config/compiler/nvcc.hpp +64 -0
- mqt/core/include/mqt-core/boost/config/compiler/pathscale.hpp +141 -0
- mqt/core/include/mqt-core/boost/config/compiler/pgi.hpp +23 -0
- mqt/core/include/mqt-core/boost/config/compiler/sgi_mipspro.hpp +29 -0
- mqt/core/include/mqt-core/boost/config/compiler/sunpro_cc.hpp +225 -0
- mqt/core/include/mqt-core/boost/config/compiler/vacpp.hpp +189 -0
- mqt/core/include/mqt-core/boost/config/compiler/visualc.hpp +398 -0
- mqt/core/include/mqt-core/boost/config/compiler/xlcpp.hpp +303 -0
- mqt/core/include/mqt-core/boost/config/compiler/xlcpp_zos.hpp +174 -0
- mqt/core/include/mqt-core/boost/config/detail/cxx_composite.hpp +218 -0
- mqt/core/include/mqt-core/boost/config/detail/posix_features.hpp +95 -0
- mqt/core/include/mqt-core/boost/config/detail/select_compiler_config.hpp +157 -0
- mqt/core/include/mqt-core/boost/config/detail/select_platform_config.hpp +147 -0
- mqt/core/include/mqt-core/boost/config/detail/select_stdlib_config.hpp +121 -0
- mqt/core/include/mqt-core/boost/config/detail/suffix.hpp +1334 -0
- mqt/core/include/mqt-core/boost/config/header_deprecated.hpp +26 -0
- mqt/core/include/mqt-core/boost/config/helper_macros.hpp +37 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/cmath.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/complex.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/functional.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/memory.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/utility.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/platform/aix.hpp +33 -0
- mqt/core/include/mqt-core/boost/config/platform/amigaos.hpp +15 -0
- mqt/core/include/mqt-core/boost/config/platform/beos.hpp +26 -0
- mqt/core/include/mqt-core/boost/config/platform/bsd.hpp +83 -0
- mqt/core/include/mqt-core/boost/config/platform/cloudabi.hpp +18 -0
- mqt/core/include/mqt-core/boost/config/platform/cray.hpp +18 -0
- mqt/core/include/mqt-core/boost/config/platform/cygwin.hpp +71 -0
- mqt/core/include/mqt-core/boost/config/platform/haiku.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/hpux.hpp +87 -0
- mqt/core/include/mqt-core/boost/config/platform/irix.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/linux.hpp +106 -0
- mqt/core/include/mqt-core/boost/config/platform/macos.hpp +87 -0
- mqt/core/include/mqt-core/boost/config/platform/qnxnto.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/solaris.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/symbian.hpp +97 -0
- mqt/core/include/mqt-core/boost/config/platform/vms.hpp +25 -0
- mqt/core/include/mqt-core/boost/config/platform/vxworks.hpp +422 -0
- mqt/core/include/mqt-core/boost/config/platform/wasm.hpp +23 -0
- mqt/core/include/mqt-core/boost/config/platform/win32.hpp +90 -0
- mqt/core/include/mqt-core/boost/config/platform/zos.hpp +32 -0
- mqt/core/include/mqt-core/boost/config/pragma_message.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/requires_threads.hpp +92 -0
- mqt/core/include/mqt-core/boost/config/stdlib/dinkumware.hpp +324 -0
- mqt/core/include/mqt-core/boost/config/stdlib/libcomo.hpp +93 -0
- mqt/core/include/mqt-core/boost/config/stdlib/libcpp.hpp +180 -0
- mqt/core/include/mqt-core/boost/config/stdlib/libstdcpp3.hpp +482 -0
- mqt/core/include/mqt-core/boost/config/stdlib/modena.hpp +79 -0
- mqt/core/include/mqt-core/boost/config/stdlib/msl.hpp +98 -0
- mqt/core/include/mqt-core/boost/config/stdlib/roguewave.hpp +208 -0
- mqt/core/include/mqt-core/boost/config/stdlib/sgi.hpp +168 -0
- mqt/core/include/mqt-core/boost/config/stdlib/stlport.hpp +258 -0
- mqt/core/include/mqt-core/boost/config/stdlib/vacpp.hpp +74 -0
- mqt/core/include/mqt-core/boost/config/stdlib/xlcpp_zos.hpp +61 -0
- mqt/core/include/mqt-core/boost/config/user.hpp +133 -0
- mqt/core/include/mqt-core/boost/config/warning_disable.hpp +47 -0
- mqt/core/include/mqt-core/boost/config/workaround.hpp +305 -0
- mqt/core/include/mqt-core/boost/config.hpp +67 -0
- mqt/core/include/mqt-core/boost/cstdint.hpp +556 -0
- mqt/core/include/mqt-core/boost/cxx11_char_types.hpp +70 -0
- mqt/core/include/mqt-core/boost/detail/workaround.hpp +10 -0
- mqt/core/include/mqt-core/boost/limits.hpp +146 -0
- mqt/core/include/mqt-core/boost/multiprecision/complex128.hpp +24 -0
- mqt/core/include/mqt-core/boost/multiprecision/complex_adaptor.hpp +1046 -0
- mqt/core/include/mqt-core/boost/multiprecision/concepts/mp_number_archetypes.hpp +257 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/io.hpp +698 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/transcendental.hpp +157 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float.hpp +2297 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_complex.hpp +12 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_dec_float.hpp +3690 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add.hpp +368 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add_unsigned.hpp +387 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/bitwise.hpp +889 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/checked.hpp +178 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/comparison.hpp +374 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/cpp_int_config.hpp +161 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/divide.hpp +703 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/import_export.hpp +248 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/intel_intrinsics.hpp +138 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/limits.hpp +282 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/literals.hpp +295 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/misc.hpp +1457 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/multiply.hpp +848 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/serialize.hpp +211 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/value_pack.hpp +42 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int.hpp +2360 -0
- mqt/core/include/mqt-core/boost/multiprecision/debug_adaptor.hpp +760 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/assert.hpp +29 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/atomic.hpp +62 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/bitscan.hpp +317 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/check_cpp11_config.hpp +64 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/constexpr.hpp +88 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/default_ops.hpp +4052 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/digits.hpp +49 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/dynamic_array.hpp +44 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/empty_value.hpp +87 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/endian.hpp +35 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/et_ops.hpp +1831 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/float128_functions.hpp +95 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/float_string_cvt.hpp +333 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/fpclassify.hpp +101 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/constants.hpp +288 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/pow.hpp +905 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trig.hpp +1058 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trunc.hpp +82 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/generic_interconvert.hpp +687 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/hash.hpp +56 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/integer_ops.hpp +474 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/itos.hpp +39 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/min_max.hpp +106 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/no_et_ops.hpp +661 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/no_exceptions_support.hpp +55 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/number_base.hpp +1656 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/number_compare.hpp +848 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/precision.hpp +313 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/rebind.hpp +19 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/standalone_config.hpp +148 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/static_array.hpp +42 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/string_helpers.hpp +48 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/tables.hpp +80 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/ublas_interop.hpp +75 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/uniform_int_distribution.hpp +212 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/utype_helper.hpp +374 -0
- mqt/core/include/mqt-core/boost/multiprecision/eigen.hpp +248 -0
- mqt/core/include/mqt-core/boost/multiprecision/float128.hpp +920 -0
- mqt/core/include/mqt-core/boost/multiprecision/fwd.hpp +268 -0
- mqt/core/include/mqt-core/boost/multiprecision/gmp.hpp +4060 -0
- mqt/core/include/mqt-core/boost/multiprecision/integer.hpp +363 -0
- mqt/core/include/mqt-core/boost/multiprecision/logged_adaptor.hpp +834 -0
- mqt/core/include/mqt-core/boost/multiprecision/miller_rabin.hpp +221 -0
- mqt/core/include/mqt-core/boost/multiprecision/mpc.hpp +1721 -0
- mqt/core/include/mqt-core/boost/multiprecision/mpfi.hpp +2559 -0
- mqt/core/include/mqt-core/boost/multiprecision/mpfr.hpp +3644 -0
- mqt/core/include/mqt-core/boost/multiprecision/number.hpp +2500 -0
- mqt/core/include/mqt-core/boost/multiprecision/random.hpp +23 -0
- mqt/core/include/mqt-core/boost/multiprecision/rational_adaptor.hpp +1289 -0
- mqt/core/include/mqt-core/boost/multiprecision/tommath.hpp +1034 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/explicit_conversion.hpp +67 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/extract_exponent_type.hpp +28 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_backend.hpp +91 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_byte_container.hpp +51 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_complex.hpp +22 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_convertible_arithmetic.hpp +51 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_restricted_conversion.hpp +47 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_variable_precision.hpp +25 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/max_digits10.hpp +79 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/std_integer_traits.hpp +90 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/transcendental_reduction_type.hpp +21 -0
- mqt/core/include/mqt-core/boost/version.hpp +32 -0
- mqt/core/include/mqt-core/circuit_optimizer/CircuitOptimizer.hpp +119 -0
- mqt/core/include/mqt-core/circuit_optimizer/mqt_core_circuit_optimizer_export.h +43 -0
- mqt/core/include/mqt-core/datastructures/DirectedAcyclicGraph.hpp +117 -0
- mqt/core/include/mqt-core/datastructures/DirectedGraph.hpp +158 -0
- mqt/core/include/mqt-core/datastructures/DisjointSet.hpp +50 -0
- mqt/core/include/mqt-core/datastructures/Layer.hpp +172 -0
- mqt/core/include/mqt-core/datastructures/SymmetricMatrix.hpp +57 -0
- mqt/core/include/mqt-core/datastructures/UndirectedGraph.hpp +227 -0
- mqt/core/include/mqt-core/datastructures/mqt_core_ds_export.h +43 -0
- mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
- mqt/core/include/mqt-core/dd/CachedEdge.hpp +174 -0
- mqt/core/include/mqt-core/dd/Complex.hpp +165 -0
- mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +150 -0
- mqt/core/include/mqt-core/dd/ComplexValue.hpp +184 -0
- mqt/core/include/mqt-core/dd/ComputeTable.hpp +183 -0
- mqt/core/include/mqt-core/dd/DDDefinitions.hpp +139 -0
- mqt/core/include/mqt-core/dd/DDpackageConfig.hpp +104 -0
- mqt/core/include/mqt-core/dd/DensityNoiseTable.hpp +114 -0
- mqt/core/include/mqt-core/dd/Edge.hpp +416 -0
- mqt/core/include/mqt-core/dd/Export.hpp +438 -0
- mqt/core/include/mqt-core/dd/FunctionalityConstruction.hpp +75 -0
- mqt/core/include/mqt-core/dd/GateMatrixDefinitions.hpp +43 -0
- mqt/core/include/mqt-core/dd/LinkedListBase.hpp +45 -0
- mqt/core/include/mqt-core/dd/MemoryManager.hpp +193 -0
- mqt/core/include/mqt-core/dd/Node.hpp +223 -0
- mqt/core/include/mqt-core/dd/NoiseFunctionality.hpp +144 -0
- mqt/core/include/mqt-core/dd/Operations.hpp +306 -0
- mqt/core/include/mqt-core/dd/Package.hpp +2036 -0
- mqt/core/include/mqt-core/dd/Package_fwd.hpp +22 -0
- mqt/core/include/mqt-core/dd/RealNumber.hpp +255 -0
- mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +217 -0
- mqt/core/include/mqt-core/dd/Simulation.hpp +98 -0
- mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
- mqt/core/include/mqt-core/dd/StochasticNoiseOperationTable.hpp +88 -0
- mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +121 -0
- mqt/core/include/mqt-core/dd/UniqueTable.hpp +243 -0
- mqt/core/include/mqt-core/dd/mqt_core_dd_export.h +43 -0
- mqt/core/include/mqt-core/dd/statistics/MemoryManagerStatistics.hpp +84 -0
- mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +55 -0
- mqt/core/include/mqt-core/dd/statistics/Statistics.hpp +48 -0
- mqt/core/include/mqt-core/dd/statistics/TableStatistics.hpp +79 -0
- mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +31 -0
- mqt/core/include/mqt-core/fomac/FoMaC.hpp +568 -0
- mqt/core/include/mqt-core/ir/Definitions.hpp +108 -0
- mqt/core/include/mqt-core/ir/Permutation.hpp +213 -0
- mqt/core/include/mqt-core/ir/QuantumComputation.hpp +596 -0
- mqt/core/include/mqt-core/ir/Register.hpp +125 -0
- mqt/core/include/mqt-core/ir/mqt_core_ir_export.h +43 -0
- mqt/core/include/mqt-core/ir/operations/AodOperation.hpp +92 -0
- mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +212 -0
- mqt/core/include/mqt-core/ir/operations/Control.hpp +142 -0
- mqt/core/include/mqt-core/ir/operations/Expression.hpp +847 -0
- mqt/core/include/mqt-core/ir/operations/IfElseOperation.hpp +169 -0
- mqt/core/include/mqt-core/ir/operations/NonUnitaryOperation.hpp +118 -0
- mqt/core/include/mqt-core/ir/operations/OpType.hpp +120 -0
- mqt/core/include/mqt-core/ir/operations/OpType.inc +76 -0
- mqt/core/include/mqt-core/ir/operations/Operation.hpp +247 -0
- mqt/core/include/mqt-core/ir/operations/StandardOperation.hpp +140 -0
- mqt/core/include/mqt-core/ir/operations/SymbolicOperation.hpp +144 -0
- mqt/core/include/mqt-core/mqt_na_qdmi/device.h +602 -0
- mqt/core/include/mqt-core/mqt_na_qdmi/types.h +78 -0
- mqt/core/include/mqt-core/na/NAComputation.hpp +185 -0
- mqt/core/include/mqt-core/na/device/Device.hpp +410 -0
- mqt/core/include/mqt-core/na/device/DeviceMemberInitializers.hpp +724 -0
- mqt/core/include/mqt-core/na/device/Generator.hpp +447 -0
- mqt/core/include/mqt-core/na/entities/Atom.hpp +62 -0
- mqt/core/include/mqt-core/na/entities/Location.hpp +154 -0
- mqt/core/include/mqt-core/na/entities/Zone.hpp +95 -0
- mqt/core/include/mqt-core/na/fomac/Device.hpp +169 -0
- mqt/core/include/mqt-core/na/mqt_core_na_export.h +43 -0
- mqt/core/include/mqt-core/na/operations/GlobalCZOp.hpp +38 -0
- mqt/core/include/mqt-core/na/operations/GlobalOp.hpp +58 -0
- mqt/core/include/mqt-core/na/operations/GlobalRYOp.hpp +42 -0
- mqt/core/include/mqt-core/na/operations/LoadOp.hpp +89 -0
- mqt/core/include/mqt-core/na/operations/LocalOp.hpp +56 -0
- mqt/core/include/mqt-core/na/operations/LocalRZOp.hpp +42 -0
- mqt/core/include/mqt-core/na/operations/LocalUOp.hpp +49 -0
- mqt/core/include/mqt-core/na/operations/MoveOp.hpp +66 -0
- mqt/core/include/mqt-core/na/operations/Op.hpp +62 -0
- mqt/core/include/mqt-core/na/operations/ShuttlingOp.hpp +51 -0
- mqt/core/include/mqt-core/na/operations/StoreOp.hpp +87 -0
- mqt/core/include/mqt-core/qasm3/Exception.hpp +85 -0
- mqt/core/include/mqt-core/qasm3/Gate.hpp +65 -0
- mqt/core/include/mqt-core/qasm3/Importer.hpp +192 -0
- mqt/core/include/mqt-core/qasm3/InstVisitor.hpp +145 -0
- mqt/core/include/mqt-core/qasm3/NestedEnvironment.hpp +41 -0
- mqt/core/include/mqt-core/qasm3/Parser.hpp +170 -0
- mqt/core/include/mqt-core/qasm3/Scanner.hpp +73 -0
- mqt/core/include/mqt-core/qasm3/Statement.hpp +486 -0
- mqt/core/include/mqt-core/qasm3/Statement_fwd.hpp +39 -0
- mqt/core/include/mqt-core/qasm3/StdGates.hpp +232 -0
- mqt/core/include/mqt-core/qasm3/Token.hpp +198 -0
- mqt/core/include/mqt-core/qasm3/Types.hpp +238 -0
- mqt/core/include/mqt-core/qasm3/Types_fwd.hpp +22 -0
- mqt/core/include/mqt-core/qasm3/mqt_core_qasm_export.h +43 -0
- mqt/core/include/mqt-core/qasm3/passes/CompilerPass.hpp +22 -0
- mqt/core/include/mqt-core/qasm3/passes/ConstEvalPass.hpp +102 -0
- mqt/core/include/mqt-core/qasm3/passes/TypeCheckPass.hpp +124 -0
- mqt/core/include/mqt-core/qdmi/Driver.hpp +431 -0
- mqt/core/include/mqt-core/zx/FunctionalityConstruction.hpp +125 -0
- mqt/core/include/mqt-core/zx/Rational.hpp +318 -0
- mqt/core/include/mqt-core/zx/Rules.hpp +132 -0
- mqt/core/include/mqt-core/zx/Simplify.hpp +182 -0
- mqt/core/include/mqt-core/zx/Utils.hpp +212 -0
- mqt/core/include/mqt-core/zx/ZXDefinitions.hpp +93 -0
- mqt/core/include/mqt-core/zx/ZXDiagram.hpp +480 -0
- mqt/core/include/mqt-core/zx/mqt_core_zx_export.h +43 -0
- mqt/core/include/nlohmann/adl_serializer.hpp +55 -0
- mqt/core/include/nlohmann/byte_container_with_subtype.hpp +103 -0
- mqt/core/include/nlohmann/detail/abi_macros.hpp +111 -0
- mqt/core/include/nlohmann/detail/conversions/from_json.hpp +577 -0
- mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
- mqt/core/include/nlohmann/detail/conversions/to_json.hpp +479 -0
- mqt/core/include/nlohmann/detail/exceptions.hpp +291 -0
- mqt/core/include/nlohmann/detail/hash.hpp +129 -0
- mqt/core/include/nlohmann/detail/input/binary_reader.hpp +3068 -0
- mqt/core/include/nlohmann/detail/input/input_adapters.hpp +549 -0
- mqt/core/include/nlohmann/detail/input/json_sax.hpp +986 -0
- mqt/core/include/nlohmann/detail/input/lexer.hpp +1643 -0
- mqt/core/include/nlohmann/detail/input/parser.hpp +519 -0
- mqt/core/include/nlohmann/detail/input/position_t.hpp +37 -0
- mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
- mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +760 -0
- mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +235 -0
- mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
- mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
- mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
- mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
- mqt/core/include/nlohmann/detail/json_pointer.hpp +988 -0
- mqt/core/include/nlohmann/detail/json_ref.hpp +78 -0
- mqt/core/include/nlohmann/detail/macro_scope.hpp +595 -0
- mqt/core/include/nlohmann/detail/macro_unscope.hpp +46 -0
- mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
- mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
- mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
- mqt/core/include/nlohmann/detail/meta/detected.hpp +70 -0
- mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
- mqt/core/include/nlohmann/detail/meta/is_sax.hpp +159 -0
- mqt/core/include/nlohmann/detail/meta/std_fs.hpp +29 -0
- mqt/core/include/nlohmann/detail/meta/type_traits.hpp +795 -0
- mqt/core/include/nlohmann/detail/meta/void_t.hpp +24 -0
- mqt/core/include/nlohmann/detail/output/binary_writer.hpp +1850 -0
- mqt/core/include/nlohmann/detail/output/output_adapters.hpp +147 -0
- mqt/core/include/nlohmann/detail/output/serializer.hpp +988 -0
- mqt/core/include/nlohmann/detail/string_concat.hpp +146 -0
- mqt/core/include/nlohmann/detail/string_escape.hpp +72 -0
- mqt/core/include/nlohmann/detail/string_utils.hpp +37 -0
- mqt/core/include/nlohmann/detail/value_t.hpp +118 -0
- mqt/core/include/nlohmann/json.hpp +5306 -0
- mqt/core/include/nlohmann/json_fwd.hpp +75 -0
- mqt/core/include/nlohmann/ordered_map.hpp +359 -0
- mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
- mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
- mqt/core/include/qdmi/qdmi/client.h +990 -0
- mqt/core/include/qdmi/qdmi/constants.h +1139 -0
- mqt/core/include/qdmi/qdmi/device.h +602 -0
- mqt/core/include/qdmi/qdmi/types.h +78 -0
- mqt/core/include/spdlog/async.h +99 -0
- mqt/core/include/spdlog/async_logger-inl.h +84 -0
- mqt/core/include/spdlog/async_logger.h +74 -0
- mqt/core/include/spdlog/cfg/argv.h +40 -0
- mqt/core/include/spdlog/cfg/env.h +36 -0
- mqt/core/include/spdlog/cfg/helpers-inl.h +107 -0
- mqt/core/include/spdlog/cfg/helpers.h +29 -0
- mqt/core/include/spdlog/common-inl.h +68 -0
- mqt/core/include/spdlog/common.h +406 -0
- mqt/core/include/spdlog/details/backtracer-inl.h +63 -0
- mqt/core/include/spdlog/details/backtracer.h +45 -0
- mqt/core/include/spdlog/details/circular_q.h +115 -0
- mqt/core/include/spdlog/details/console_globals.h +28 -0
- mqt/core/include/spdlog/details/file_helper-inl.h +153 -0
- mqt/core/include/spdlog/details/file_helper.h +61 -0
- mqt/core/include/spdlog/details/fmt_helper.h +141 -0
- mqt/core/include/spdlog/details/log_msg-inl.h +44 -0
- mqt/core/include/spdlog/details/log_msg.h +40 -0
- mqt/core/include/spdlog/details/log_msg_buffer-inl.h +54 -0
- mqt/core/include/spdlog/details/log_msg_buffer.h +32 -0
- mqt/core/include/spdlog/details/mpmc_blocking_q.h +177 -0
- mqt/core/include/spdlog/details/null_mutex.h +35 -0
- mqt/core/include/spdlog/details/os-inl.h +606 -0
- mqt/core/include/spdlog/details/os.h +127 -0
- mqt/core/include/spdlog/details/periodic_worker-inl.h +26 -0
- mqt/core/include/spdlog/details/periodic_worker.h +58 -0
- mqt/core/include/spdlog/details/registry-inl.h +270 -0
- mqt/core/include/spdlog/details/registry.h +131 -0
- mqt/core/include/spdlog/details/synchronous_factory.h +22 -0
- mqt/core/include/spdlog/details/tcp_client-windows.h +135 -0
- mqt/core/include/spdlog/details/tcp_client.h +127 -0
- mqt/core/include/spdlog/details/thread_pool-inl.h +126 -0
- mqt/core/include/spdlog/details/thread_pool.h +117 -0
- mqt/core/include/spdlog/details/udp_client-windows.h +98 -0
- mqt/core/include/spdlog/details/udp_client.h +81 -0
- mqt/core/include/spdlog/details/windows_include.h +11 -0
- mqt/core/include/spdlog/fmt/bin_to_hex.h +224 -0
- mqt/core/include/spdlog/fmt/bundled/args.h +220 -0
- mqt/core/include/spdlog/fmt/bundled/base.h +2989 -0
- mqt/core/include/spdlog/fmt/bundled/chrono.h +2330 -0
- mqt/core/include/spdlog/fmt/bundled/color.h +637 -0
- mqt/core/include/spdlog/fmt/bundled/compile.h +539 -0
- mqt/core/include/spdlog/fmt/bundled/core.h +5 -0
- mqt/core/include/spdlog/fmt/bundled/fmt.license.rst +27 -0
- mqt/core/include/spdlog/fmt/bundled/format-inl.h +1948 -0
- mqt/core/include/spdlog/fmt/bundled/format.h +4244 -0
- mqt/core/include/spdlog/fmt/bundled/os.h +427 -0
- mqt/core/include/spdlog/fmt/bundled/ostream.h +167 -0
- mqt/core/include/spdlog/fmt/bundled/printf.h +633 -0
- mqt/core/include/spdlog/fmt/bundled/ranges.h +850 -0
- mqt/core/include/spdlog/fmt/bundled/std.h +728 -0
- mqt/core/include/spdlog/fmt/bundled/xchar.h +369 -0
- mqt/core/include/spdlog/fmt/chrono.h +23 -0
- mqt/core/include/spdlog/fmt/compile.h +23 -0
- mqt/core/include/spdlog/fmt/fmt.h +30 -0
- mqt/core/include/spdlog/fmt/ostr.h +23 -0
- mqt/core/include/spdlog/fmt/ranges.h +23 -0
- mqt/core/include/spdlog/fmt/std.h +24 -0
- mqt/core/include/spdlog/fmt/xchar.h +23 -0
- mqt/core/include/spdlog/formatter.h +17 -0
- mqt/core/include/spdlog/fwd.h +18 -0
- mqt/core/include/spdlog/logger-inl.h +198 -0
- mqt/core/include/spdlog/logger.h +379 -0
- mqt/core/include/spdlog/mdc.h +52 -0
- mqt/core/include/spdlog/pattern_formatter-inl.h +1340 -0
- mqt/core/include/spdlog/pattern_formatter.h +118 -0
- mqt/core/include/spdlog/sinks/android_sink.h +137 -0
- mqt/core/include/spdlog/sinks/ansicolor_sink-inl.h +142 -0
- mqt/core/include/spdlog/sinks/ansicolor_sink.h +116 -0
- mqt/core/include/spdlog/sinks/base_sink-inl.h +59 -0
- mqt/core/include/spdlog/sinks/base_sink.h +51 -0
- mqt/core/include/spdlog/sinks/basic_file_sink-inl.h +48 -0
- mqt/core/include/spdlog/sinks/basic_file_sink.h +66 -0
- mqt/core/include/spdlog/sinks/callback_sink.h +56 -0
- mqt/core/include/spdlog/sinks/daily_file_sink.h +254 -0
- mqt/core/include/spdlog/sinks/dist_sink.h +81 -0
- mqt/core/include/spdlog/sinks/dup_filter_sink.h +91 -0
- mqt/core/include/spdlog/sinks/hourly_file_sink.h +193 -0
- mqt/core/include/spdlog/sinks/kafka_sink.h +119 -0
- mqt/core/include/spdlog/sinks/mongo_sink.h +108 -0
- mqt/core/include/spdlog/sinks/msvc_sink.h +68 -0
- mqt/core/include/spdlog/sinks/null_sink.h +41 -0
- mqt/core/include/spdlog/sinks/ostream_sink.h +43 -0
- mqt/core/include/spdlog/sinks/qt_sinks.h +304 -0
- mqt/core/include/spdlog/sinks/ringbuffer_sink.h +67 -0
- mqt/core/include/spdlog/sinks/rotating_file_sink-inl.h +179 -0
- mqt/core/include/spdlog/sinks/rotating_file_sink.h +93 -0
- mqt/core/include/spdlog/sinks/sink-inl.h +22 -0
- mqt/core/include/spdlog/sinks/sink.h +34 -0
- mqt/core/include/spdlog/sinks/stdout_color_sinks-inl.h +38 -0
- mqt/core/include/spdlog/sinks/stdout_color_sinks.h +49 -0
- mqt/core/include/spdlog/sinks/stdout_sinks-inl.h +127 -0
- mqt/core/include/spdlog/sinks/stdout_sinks.h +84 -0
- mqt/core/include/spdlog/sinks/syslog_sink.h +104 -0
- mqt/core/include/spdlog/sinks/systemd_sink.h +121 -0
- mqt/core/include/spdlog/sinks/tcp_sink.h +75 -0
- mqt/core/include/spdlog/sinks/udp_sink.h +69 -0
- mqt/core/include/spdlog/sinks/win_eventlog_sink.h +260 -0
- mqt/core/include/spdlog/sinks/wincolor_sink-inl.h +172 -0
- mqt/core/include/spdlog/sinks/wincolor_sink.h +82 -0
- mqt/core/include/spdlog/spdlog-inl.h +96 -0
- mqt/core/include/spdlog/spdlog.h +357 -0
- mqt/core/include/spdlog/stopwatch.h +66 -0
- mqt/core/include/spdlog/tweakme.h +148 -0
- mqt/core/include/spdlog/version.h +11 -0
- mqt/core/ir/__init__.pyi +2078 -0
- mqt/core/ir/operations.pyi +1011 -0
- mqt/core/ir/registers.pyi +91 -0
- mqt/core/ir/symbolic.pyi +177 -0
- mqt/core/ir.cp312-win_amd64.pyd +0 -0
- mqt/core/lib/mqt-core-algorithms.lib +0 -0
- mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
- mqt/core/lib/mqt-core-dd.lib +0 -0
- mqt/core/lib/mqt-core-ds.lib +0 -0
- mqt/core/lib/mqt-core-fomac.lib +0 -0
- mqt/core/lib/mqt-core-ir.lib +0 -0
- mqt/core/lib/mqt-core-na-fomac.lib +0 -0
- mqt/core/lib/mqt-core-na.lib +0 -0
- mqt/core/lib/mqt-core-qasm.lib +0 -0
- mqt/core/lib/mqt-core-qdmi-driver.lib +0 -0
- mqt/core/lib/mqt-core-qdmi-na-device-gen.lib +0 -0
- mqt/core/lib/mqt-core-qdmi-na-device.lib +0 -0
- mqt/core/lib/mqt-core-zx.lib +0 -0
- mqt/core/lib/pkgconfig/spdlog.pc +13 -0
- mqt/core/lib/spdlog.lib +0 -0
- mqt/core/na/__init__.py +12 -0
- mqt/core/na/fomac.cp312-win_amd64.pyd +0 -0
- mqt/core/na/fomac.pyi +117 -0
- mqt/core/nlohmann_json.natvis +278 -0
- mqt/core/plugins/__init__.py +9 -0
- mqt/core/plugins/qiskit/__init__.py +19 -0
- mqt/core/plugins/qiskit/mqt_to_qiskit.py +420 -0
- mqt/core/plugins/qiskit/qiskit_to_mqt.py +562 -0
- mqt/core/py.typed +2 -0
- mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +55 -0
- mqt/core/share/cmake/mqt-core/Cache.cmake +33 -0
- mqt/core/share/cmake/mqt-core/FindGMP.cmake +103 -0
- mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +46 -0
- mqt/core/share/cmake/mqt-core/PreventInSourceBuilds.cmake +25 -0
- mqt/core/share/cmake/mqt-core/StandardProjectSettings.cmake +87 -0
- mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +85 -0
- mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +52 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +141 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +445 -0
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +15 -0
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +20 -0
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +110 -0
- mqt/core/share/cmake/qdmi/Cache.cmake +44 -0
- mqt/core/share/cmake/qdmi/PrefixHandling.cmake +78 -0
- mqt/core/share/cmake/qdmi/prefix_defs.txt +26 -0
- mqt/core/share/cmake/qdmi/qdmi-config-version.cmake +85 -0
- mqt/core/share/cmake/qdmi/qdmi-config.cmake +42 -0
- mqt/core/share/cmake/qdmi/qdmi-targets.cmake +129 -0
- mqt/core/share/cmake/spdlog/spdlogConfig.cmake +44 -0
- mqt/core/share/cmake/spdlog/spdlogConfigTargets-release.cmake +19 -0
- mqt/core/share/cmake/spdlog/spdlogConfigTargets.cmake +121 -0
- mqt/core/share/cmake/spdlog/spdlogConfigVersion.cmake +65 -0
- mqt/core/share/pkgconfig/nlohmann_json.pc +7 -0
- mqt_core-3.3.2.dist-info/DELVEWHEEL +2 -0
- mqt_core-3.3.2.dist-info/METADATA +210 -0
- mqt_core-3.3.2.dist-info/RECORD +537 -0
- mqt_core-3.3.2.dist-info/WHEEL +5 -0
- mqt_core-3.3.2.dist-info/entry_points.txt +4 -0
- mqt_core-3.3.2.dist-info/licenses/LICENSE.md +22 -0
- mqt_core.libs/msvcp140.dll +0 -0
|
@@ -0,0 +1,1046 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright 2018 John Maddock. Distributed under the Boost
|
|
3
|
+
// Software License, Version 1.0. (See accompanying file
|
|
4
|
+
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
5
|
+
|
|
6
|
+
#ifndef BOOST_MP_COMPLEX_ADAPTOR_HPP
|
|
7
|
+
#define BOOST_MP_COMPLEX_ADAPTOR_HPP
|
|
8
|
+
|
|
9
|
+
#include <boost/multiprecision/number.hpp>
|
|
10
|
+
#include <cstdint>
|
|
11
|
+
#include <boost/multiprecision/detail/digits.hpp>
|
|
12
|
+
#include <boost/multiprecision/detail/hash.hpp>
|
|
13
|
+
#include <boost/multiprecision/detail/no_exceptions_support.hpp>
|
|
14
|
+
#include <cmath>
|
|
15
|
+
#include <algorithm>
|
|
16
|
+
#include <complex>
|
|
17
|
+
|
|
18
|
+
namespace boost {
|
|
19
|
+
namespace multiprecision {
|
|
20
|
+
namespace backends {
|
|
21
|
+
|
|
22
|
+
template <class Backend>
|
|
23
|
+
struct complex_adaptor
|
|
24
|
+
{
|
|
25
|
+
protected:
|
|
26
|
+
Backend m_real, m_imag;
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
Backend& real_data()
|
|
30
|
+
{
|
|
31
|
+
return m_real;
|
|
32
|
+
}
|
|
33
|
+
const Backend& real_data() const
|
|
34
|
+
{
|
|
35
|
+
return m_real;
|
|
36
|
+
}
|
|
37
|
+
Backend& imag_data()
|
|
38
|
+
{
|
|
39
|
+
return m_imag;
|
|
40
|
+
}
|
|
41
|
+
const Backend& imag_data() const
|
|
42
|
+
{
|
|
43
|
+
return m_imag;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
using signed_types = typename Backend::signed_types ;
|
|
47
|
+
using unsigned_types = typename Backend::unsigned_types;
|
|
48
|
+
using float_types = typename Backend::float_types ;
|
|
49
|
+
using exponent_type = typename Backend::exponent_type ;
|
|
50
|
+
|
|
51
|
+
complex_adaptor() {}
|
|
52
|
+
complex_adaptor(const complex_adaptor& o) : m_real(o.real_data()), m_imag(o.imag_data()) {}
|
|
53
|
+
// Rvalue construct:
|
|
54
|
+
complex_adaptor(complex_adaptor&& o) : m_real(std::move(o.real_data())), m_imag(std::move(o.imag_data()))
|
|
55
|
+
{}
|
|
56
|
+
complex_adaptor(const Backend& val)
|
|
57
|
+
: m_real(val)
|
|
58
|
+
{}
|
|
59
|
+
|
|
60
|
+
template <class T>
|
|
61
|
+
complex_adaptor(const T& val, const typename std::enable_if<std::is_convertible<T, Backend>::value>::type* = nullptr)
|
|
62
|
+
: m_real(val)
|
|
63
|
+
{}
|
|
64
|
+
|
|
65
|
+
complex_adaptor(const std::complex<float>& val)
|
|
66
|
+
{
|
|
67
|
+
m_real = (long double)val.real();
|
|
68
|
+
m_imag = (long double)val.imag();
|
|
69
|
+
}
|
|
70
|
+
complex_adaptor(const std::complex<double>& val)
|
|
71
|
+
{
|
|
72
|
+
m_real = (long double)val.real();
|
|
73
|
+
m_imag = (long double)val.imag();
|
|
74
|
+
}
|
|
75
|
+
complex_adaptor(const std::complex<long double>& val)
|
|
76
|
+
{
|
|
77
|
+
m_real = val.real();
|
|
78
|
+
m_imag = val.imag();
|
|
79
|
+
}
|
|
80
|
+
template <class T, class U>
|
|
81
|
+
complex_adaptor(const T& a, const U& b, typename std::enable_if<std::is_constructible<Backend, T const&>::value&& std::is_constructible<Backend, U const&>::value>::type const* = nullptr)
|
|
82
|
+
: m_real(a), m_imag(b) {}
|
|
83
|
+
template <class T, class U>
|
|
84
|
+
complex_adaptor(T&& a, const U& b, typename std::enable_if<std::is_constructible<Backend, T>::value&& std::is_constructible<Backend, U>::value>::type const* = nullptr)
|
|
85
|
+
: m_real(static_cast<T&&>(a)), m_imag(b) {}
|
|
86
|
+
template <class T, class U>
|
|
87
|
+
complex_adaptor(T&& a, U&& b, typename std::enable_if<std::is_constructible<Backend, T>::value&& std::is_constructible<Backend, U>::value>::type const* = nullptr)
|
|
88
|
+
: m_real(static_cast<T&&>(a)), m_imag(static_cast<U&&>(b)) {}
|
|
89
|
+
template <class T, class U>
|
|
90
|
+
complex_adaptor(const T& a, U&& b, typename std::enable_if<std::is_constructible<Backend, T>::value&& std::is_constructible<Backend, U>::value>::type const* = nullptr)
|
|
91
|
+
: m_real(a), m_imag(static_cast<U&&>(b)) {}
|
|
92
|
+
|
|
93
|
+
complex_adaptor& operator=(const complex_adaptor& o)
|
|
94
|
+
{
|
|
95
|
+
m_real = o.real_data();
|
|
96
|
+
m_imag = o.imag_data();
|
|
97
|
+
return *this;
|
|
98
|
+
}
|
|
99
|
+
// rvalue assign:
|
|
100
|
+
complex_adaptor& operator=(complex_adaptor&& o) noexcept
|
|
101
|
+
{
|
|
102
|
+
m_real = std::move(o.real_data());
|
|
103
|
+
m_imag = std::move(o.imag_data());
|
|
104
|
+
return *this;
|
|
105
|
+
}
|
|
106
|
+
template <class V>
|
|
107
|
+
typename std::enable_if<std::is_assignable<Backend, V>::value, complex_adaptor&>::type operator=(const V& v)
|
|
108
|
+
{
|
|
109
|
+
using ui_type = typename std::tuple_element<0, unsigned_types>::type;
|
|
110
|
+
m_real = v;
|
|
111
|
+
m_imag = ui_type(0u);
|
|
112
|
+
return *this;
|
|
113
|
+
}
|
|
114
|
+
template <class T>
|
|
115
|
+
complex_adaptor& operator=(const std::complex<T>& val)
|
|
116
|
+
{
|
|
117
|
+
m_real = (long double)val.real();
|
|
118
|
+
m_imag = (long double)val.imag();
|
|
119
|
+
return *this;
|
|
120
|
+
}
|
|
121
|
+
complex_adaptor& operator=(const char* s)
|
|
122
|
+
{
|
|
123
|
+
using ui_type = typename std::tuple_element<0, unsigned_types>::type;
|
|
124
|
+
ui_type zero = 0u;
|
|
125
|
+
|
|
126
|
+
using default_ops::eval_fpclassify;
|
|
127
|
+
|
|
128
|
+
if (s && (*s == '('))
|
|
129
|
+
{
|
|
130
|
+
std::string part;
|
|
131
|
+
const char* p = ++s;
|
|
132
|
+
while (*p && (*p != ',') && (*p != ')'))
|
|
133
|
+
++p;
|
|
134
|
+
part.assign(s, p);
|
|
135
|
+
if (part.size())
|
|
136
|
+
real_data() = part.c_str();
|
|
137
|
+
else
|
|
138
|
+
real_data() = zero;
|
|
139
|
+
s = p;
|
|
140
|
+
if (*p && (*p != ')'))
|
|
141
|
+
{
|
|
142
|
+
++p;
|
|
143
|
+
while (*p && (*p != ')'))
|
|
144
|
+
++p;
|
|
145
|
+
part.assign(s + 1, p);
|
|
146
|
+
}
|
|
147
|
+
else
|
|
148
|
+
part.erase();
|
|
149
|
+
if (part.size())
|
|
150
|
+
imag_data() = part.c_str();
|
|
151
|
+
else
|
|
152
|
+
imag_data() = zero;
|
|
153
|
+
|
|
154
|
+
if (eval_fpclassify(imag_data()) == static_cast<int>(FP_NAN))
|
|
155
|
+
{
|
|
156
|
+
real_data() = imag_data();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else
|
|
160
|
+
{
|
|
161
|
+
real_data() = s;
|
|
162
|
+
imag_data() = zero;
|
|
163
|
+
}
|
|
164
|
+
return *this;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
int compare(const complex_adaptor& o) const
|
|
168
|
+
{
|
|
169
|
+
// They are either equal or not:
|
|
170
|
+
return (m_real.compare(o.real_data()) == 0) && (m_imag.compare(o.imag_data()) == 0) ? 0 : 1;
|
|
171
|
+
}
|
|
172
|
+
template <class T>
|
|
173
|
+
int compare(const T& val) const
|
|
174
|
+
{
|
|
175
|
+
using default_ops::eval_is_zero;
|
|
176
|
+
return (m_real.compare(val) == 0) && eval_is_zero(m_imag) ? 0 : 1;
|
|
177
|
+
}
|
|
178
|
+
void swap(complex_adaptor& o)
|
|
179
|
+
{
|
|
180
|
+
real_data().swap(o.real_data());
|
|
181
|
+
imag_data().swap(o.imag_data());
|
|
182
|
+
}
|
|
183
|
+
std::string str(std::streamsize dig, std::ios_base::fmtflags f) const
|
|
184
|
+
{
|
|
185
|
+
using default_ops::eval_is_zero;
|
|
186
|
+
if (eval_is_zero(imag_data()))
|
|
187
|
+
return m_real.str(dig, f);
|
|
188
|
+
return "(" + m_real.str(dig, f) + "," + m_imag.str(dig, f) + ")";
|
|
189
|
+
}
|
|
190
|
+
void negate()
|
|
191
|
+
{
|
|
192
|
+
m_real.negate();
|
|
193
|
+
m_imag.negate();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
//
|
|
197
|
+
// Default precision:
|
|
198
|
+
//
|
|
199
|
+
static BOOST_MP_CXX14_CONSTEXPR unsigned default_precision() noexcept
|
|
200
|
+
{
|
|
201
|
+
return Backend::default_precision();
|
|
202
|
+
}
|
|
203
|
+
static BOOST_MP_CXX14_CONSTEXPR void default_precision(unsigned digits10)
|
|
204
|
+
{
|
|
205
|
+
Backend::default_precision(digits10);
|
|
206
|
+
Backend::thread_default_precision(digits10);
|
|
207
|
+
}
|
|
208
|
+
static BOOST_MP_CXX14_CONSTEXPR unsigned thread_default_precision() noexcept
|
|
209
|
+
{
|
|
210
|
+
return Backend::thread_default_precision();
|
|
211
|
+
}
|
|
212
|
+
static BOOST_MP_CXX14_CONSTEXPR void thread_default_precision(unsigned digits10)
|
|
213
|
+
{
|
|
214
|
+
Backend::thread_default_precision(digits10);
|
|
215
|
+
}
|
|
216
|
+
BOOST_MP_CXX14_CONSTEXPR unsigned precision() const noexcept
|
|
217
|
+
{
|
|
218
|
+
return m_real.precision();
|
|
219
|
+
}
|
|
220
|
+
BOOST_MP_CXX14_CONSTEXPR void precision(unsigned digits10)
|
|
221
|
+
{
|
|
222
|
+
m_real.precision(digits10);
|
|
223
|
+
m_imag.precision(digits10);
|
|
224
|
+
}
|
|
225
|
+
//
|
|
226
|
+
// Variable precision options:
|
|
227
|
+
//
|
|
228
|
+
static constexpr variable_precision_options default_variable_precision_options()noexcept
|
|
229
|
+
{
|
|
230
|
+
return Backend::default_variable_precision_options();
|
|
231
|
+
}
|
|
232
|
+
static constexpr variable_precision_options thread_default_variable_precision_options()noexcept
|
|
233
|
+
{
|
|
234
|
+
return Backend::thread_default_variable_precision_options();
|
|
235
|
+
}
|
|
236
|
+
static BOOST_MP_CXX14_CONSTEXPR void default_variable_precision_options(variable_precision_options opts)
|
|
237
|
+
{
|
|
238
|
+
Backend::default_variable_precision_options(opts);
|
|
239
|
+
Backend::thread_default_variable_precision_options(opts);
|
|
240
|
+
}
|
|
241
|
+
static BOOST_MP_CXX14_CONSTEXPR void thread_default_variable_precision_options(variable_precision_options opts)
|
|
242
|
+
{
|
|
243
|
+
Backend::thread_default_variable_precision_options(opts);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
template <class Backend, class T>
|
|
248
|
+
inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_eq(const complex_adaptor<Backend>& a, const T& b) noexcept
|
|
249
|
+
{
|
|
250
|
+
return a.compare(b) == 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
template <class Backend>
|
|
254
|
+
inline void eval_add(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& o)
|
|
255
|
+
{
|
|
256
|
+
eval_add(result.real_data(), o.real_data());
|
|
257
|
+
eval_add(result.imag_data(), o.imag_data());
|
|
258
|
+
}
|
|
259
|
+
template <class Backend>
|
|
260
|
+
inline void eval_subtract(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& o)
|
|
261
|
+
{
|
|
262
|
+
eval_subtract(result.real_data(), o.real_data());
|
|
263
|
+
eval_subtract(result.imag_data(), o.imag_data());
|
|
264
|
+
}
|
|
265
|
+
template <class Backend>
|
|
266
|
+
inline void eval_multiply(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& o)
|
|
267
|
+
{
|
|
268
|
+
Backend t1, t2, t3;
|
|
269
|
+
eval_multiply(t1, result.real_data(), o.real_data());
|
|
270
|
+
eval_multiply(t2, result.imag_data(), o.imag_data());
|
|
271
|
+
eval_subtract(t3, t1, t2);
|
|
272
|
+
eval_multiply(t1, result.real_data(), o.imag_data());
|
|
273
|
+
eval_multiply(t2, result.imag_data(), o.real_data());
|
|
274
|
+
eval_add(t1, t2);
|
|
275
|
+
result.real_data() = std::move(t3);
|
|
276
|
+
result.imag_data() = std::move(t1);
|
|
277
|
+
}
|
|
278
|
+
template <class Backend>
|
|
279
|
+
inline void eval_divide(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& z)
|
|
280
|
+
{
|
|
281
|
+
// (a+bi) / (c + di)
|
|
282
|
+
using default_ops::eval_add;
|
|
283
|
+
using default_ops::eval_divide;
|
|
284
|
+
using default_ops::eval_fabs;
|
|
285
|
+
using default_ops::eval_is_zero;
|
|
286
|
+
using default_ops::eval_multiply;
|
|
287
|
+
using default_ops::eval_subtract;
|
|
288
|
+
Backend t1, t2;
|
|
289
|
+
|
|
290
|
+
//
|
|
291
|
+
// Backup sign bits for later, so we can fix up
|
|
292
|
+
// signed zeros at the end:
|
|
293
|
+
//
|
|
294
|
+
int a_sign = eval_signbit(result.real_data());
|
|
295
|
+
int b_sign = eval_signbit(result.imag_data());
|
|
296
|
+
int c_sign = eval_signbit(z.real_data());
|
|
297
|
+
int d_sign = eval_signbit(z.imag_data());
|
|
298
|
+
|
|
299
|
+
if (eval_is_zero(z.imag_data()))
|
|
300
|
+
{
|
|
301
|
+
eval_divide(result.real_data(), z.real_data());
|
|
302
|
+
eval_divide(result.imag_data(), z.real_data());
|
|
303
|
+
}
|
|
304
|
+
else
|
|
305
|
+
{
|
|
306
|
+
eval_fabs(t1, z.real_data());
|
|
307
|
+
eval_fabs(t2, z.imag_data());
|
|
308
|
+
if (t1.compare(t2) < 0)
|
|
309
|
+
{
|
|
310
|
+
eval_divide(t1, z.real_data(), z.imag_data()); // t1 = c/d
|
|
311
|
+
eval_multiply(t2, z.real_data(), t1);
|
|
312
|
+
eval_add(t2, z.imag_data()); // denom = c * (c/d) + d
|
|
313
|
+
Backend t_real(result.real_data());
|
|
314
|
+
// real = (a * (c/d) + b) / (denom)
|
|
315
|
+
eval_multiply(result.real_data(), t1);
|
|
316
|
+
eval_add(result.real_data(), result.imag_data());
|
|
317
|
+
eval_divide(result.real_data(), t2);
|
|
318
|
+
// imag = (b * c/d - a) / denom
|
|
319
|
+
eval_multiply(result.imag_data(), t1);
|
|
320
|
+
eval_subtract(result.imag_data(), t_real);
|
|
321
|
+
eval_divide(result.imag_data(), t2);
|
|
322
|
+
}
|
|
323
|
+
else
|
|
324
|
+
{
|
|
325
|
+
eval_divide(t1, z.imag_data(), z.real_data()); // t1 = d/c
|
|
326
|
+
eval_multiply(t2, z.imag_data(), t1);
|
|
327
|
+
eval_add(t2, z.real_data()); // denom = d * d/c + c
|
|
328
|
+
|
|
329
|
+
Backend r_t(result.real_data());
|
|
330
|
+
Backend i_t(result.imag_data());
|
|
331
|
+
|
|
332
|
+
// real = (b * d/c + a) / denom
|
|
333
|
+
eval_multiply(result.real_data(), result.imag_data(), t1);
|
|
334
|
+
eval_add(result.real_data(), r_t);
|
|
335
|
+
eval_divide(result.real_data(), t2);
|
|
336
|
+
// imag = (-a * d/c + b) / denom
|
|
337
|
+
eval_multiply(result.imag_data(), r_t, t1);
|
|
338
|
+
result.imag_data().negate();
|
|
339
|
+
eval_add(result.imag_data(), i_t);
|
|
340
|
+
eval_divide(result.imag_data(), t2);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
//
|
|
344
|
+
// Finish off by fixing up signed zeros.
|
|
345
|
+
//
|
|
346
|
+
// This sets the signs "as if" we had evaluated the result using:
|
|
347
|
+
//
|
|
348
|
+
// real = (ac + bd) / (c^2 + d^2)
|
|
349
|
+
// imag = (bc - ad) / (c^2 + d^2)
|
|
350
|
+
//
|
|
351
|
+
// ie a zero is negative only if the two parts of the numerator
|
|
352
|
+
// are both negative and zero.
|
|
353
|
+
//
|
|
354
|
+
if (eval_is_zero(result.real_data()))
|
|
355
|
+
{
|
|
356
|
+
int r_sign = eval_signbit(result.real_data());
|
|
357
|
+
int r_required = (a_sign != c_sign) && (b_sign != d_sign);
|
|
358
|
+
if (r_required != r_sign)
|
|
359
|
+
result.real_data().negate();
|
|
360
|
+
}
|
|
361
|
+
if (eval_is_zero(result.imag_data()))
|
|
362
|
+
{
|
|
363
|
+
int i_sign = eval_signbit(result.imag_data());
|
|
364
|
+
int i_required = (b_sign != c_sign) && (a_sign == d_sign);
|
|
365
|
+
if (i_required != i_sign)
|
|
366
|
+
result.imag_data().negate();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
template <class Backend, class T>
|
|
370
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_add(complex_adaptor<Backend>& result, const T& scalar)
|
|
371
|
+
{
|
|
372
|
+
using default_ops::eval_add;
|
|
373
|
+
eval_add(result.real_data(), scalar);
|
|
374
|
+
}
|
|
375
|
+
template <class Backend, class T>
|
|
376
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_subtract(complex_adaptor<Backend>& result, const T& scalar)
|
|
377
|
+
{
|
|
378
|
+
using default_ops::eval_subtract;
|
|
379
|
+
eval_subtract(result.real_data(), scalar);
|
|
380
|
+
}
|
|
381
|
+
template <class Backend, class T>
|
|
382
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_multiply(complex_adaptor<Backend>& result, const T& scalar)
|
|
383
|
+
{
|
|
384
|
+
using default_ops::eval_multiply;
|
|
385
|
+
eval_multiply(result.real_data(), scalar);
|
|
386
|
+
eval_multiply(result.imag_data(), scalar);
|
|
387
|
+
}
|
|
388
|
+
template <class Backend, class T>
|
|
389
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_divide(complex_adaptor<Backend>& result, const T& scalar)
|
|
390
|
+
{
|
|
391
|
+
using default_ops::eval_divide;
|
|
392
|
+
eval_divide(result.real_data(), scalar);
|
|
393
|
+
eval_divide(result.imag_data(), scalar);
|
|
394
|
+
}
|
|
395
|
+
// Optimised 3 arg versions:
|
|
396
|
+
template <class Backend, class T>
|
|
397
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_add(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& a, const T& scalar)
|
|
398
|
+
{
|
|
399
|
+
using default_ops::eval_add;
|
|
400
|
+
eval_add(result.real_data(), a.real_data(), scalar);
|
|
401
|
+
result.imag_data() = a.imag_data();
|
|
402
|
+
}
|
|
403
|
+
template <class Backend, class T>
|
|
404
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_subtract(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& a, const T& scalar)
|
|
405
|
+
{
|
|
406
|
+
using default_ops::eval_subtract;
|
|
407
|
+
eval_subtract(result.real_data(), a.real_data(), scalar);
|
|
408
|
+
result.imag_data() = a.imag_data();
|
|
409
|
+
}
|
|
410
|
+
template <class Backend, class T>
|
|
411
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_multiply(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& a, const T& scalar)
|
|
412
|
+
{
|
|
413
|
+
using default_ops::eval_multiply;
|
|
414
|
+
eval_multiply(result.real_data(), a.real_data(), scalar);
|
|
415
|
+
eval_multiply(result.imag_data(), a.imag_data(), scalar);
|
|
416
|
+
}
|
|
417
|
+
template <class Backend, class T>
|
|
418
|
+
inline typename std::enable_if< !std::is_same<complex_adaptor<Backend>, T>::value>::type eval_divide(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& a, const T& scalar)
|
|
419
|
+
{
|
|
420
|
+
using default_ops::eval_divide;
|
|
421
|
+
eval_divide(result.real_data(), a.real_data(), scalar);
|
|
422
|
+
eval_divide(result.imag_data(), a.imag_data(), scalar);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
template <class Backend>
|
|
426
|
+
inline bool eval_is_zero(const complex_adaptor<Backend>& val) noexcept
|
|
427
|
+
{
|
|
428
|
+
using default_ops::eval_is_zero;
|
|
429
|
+
return eval_is_zero(val.real_data()) && eval_is_zero(val.imag_data());
|
|
430
|
+
}
|
|
431
|
+
template <class Backend>
|
|
432
|
+
inline int eval_get_sign(const complex_adaptor<Backend>&)
|
|
433
|
+
{
|
|
434
|
+
static_assert(sizeof(Backend) == UINT_MAX, "Complex numbers have no sign bit."); // designed to always fail
|
|
435
|
+
return 0;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
template <class Result, class Backend>
|
|
439
|
+
inline typename std::enable_if< !boost::multiprecision::detail::is_complex<Result>::value>::type eval_convert_to(Result* result, const complex_adaptor<Backend>& val)
|
|
440
|
+
{
|
|
441
|
+
using default_ops::eval_convert_to;
|
|
442
|
+
using default_ops::eval_is_zero;
|
|
443
|
+
if (!eval_is_zero(val.imag_data()))
|
|
444
|
+
{
|
|
445
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
446
|
+
}
|
|
447
|
+
eval_convert_to(result, val.real_data());
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
template <class Backend, class T>
|
|
451
|
+
inline void assign_components(complex_adaptor<Backend>& result, const T& a, const T& b)
|
|
452
|
+
{
|
|
453
|
+
result.real_data() = a;
|
|
454
|
+
result.imag_data() = b;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
//
|
|
458
|
+
// Native non-member operations:
|
|
459
|
+
//
|
|
460
|
+
template <class Backend>
|
|
461
|
+
inline void eval_sqrt(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& val)
|
|
462
|
+
{
|
|
463
|
+
// Use the following:
|
|
464
|
+
// sqrt(z) = (s, zi / 2s) for zr >= 0
|
|
465
|
+
// (|zi| / 2s, +-s) for zr < 0
|
|
466
|
+
// where s = sqrt{ [ |zr| + sqrt(zr^2 + zi^2) ] / 2 },
|
|
467
|
+
// and the +- sign is the same as the sign of zi.
|
|
468
|
+
using default_ops::eval_abs;
|
|
469
|
+
using default_ops::eval_add;
|
|
470
|
+
using default_ops::eval_divide;
|
|
471
|
+
using default_ops::eval_get_sign;
|
|
472
|
+
using default_ops::eval_is_zero;
|
|
473
|
+
|
|
474
|
+
if (eval_is_zero(val.imag_data()) && (eval_get_sign(val.real_data()) >= 0))
|
|
475
|
+
{
|
|
476
|
+
constexpr typename std::tuple_element<0, typename Backend::unsigned_types>::type zero = 0u;
|
|
477
|
+
eval_sqrt(result.real_data(), val.real_data());
|
|
478
|
+
result.imag_data() = zero;
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const bool __my_real_part_is_neg(eval_get_sign(val.real_data()) < 0);
|
|
483
|
+
|
|
484
|
+
Backend __my_real_part_fabs(val.real_data());
|
|
485
|
+
if (__my_real_part_is_neg)
|
|
486
|
+
__my_real_part_fabs.negate();
|
|
487
|
+
|
|
488
|
+
Backend t, __my_sqrt_part;
|
|
489
|
+
eval_abs(__my_sqrt_part, val);
|
|
490
|
+
eval_add(__my_sqrt_part, __my_real_part_fabs);
|
|
491
|
+
eval_ldexp(t, __my_sqrt_part, -1);
|
|
492
|
+
eval_sqrt(__my_sqrt_part, t);
|
|
493
|
+
|
|
494
|
+
if (__my_real_part_is_neg == false)
|
|
495
|
+
{
|
|
496
|
+
eval_ldexp(t, __my_sqrt_part, 1);
|
|
497
|
+
eval_divide(result.imag_data(), val.imag_data(), t);
|
|
498
|
+
result.real_data() = __my_sqrt_part;
|
|
499
|
+
}
|
|
500
|
+
else
|
|
501
|
+
{
|
|
502
|
+
const bool __my_imag_part_is_neg(eval_get_sign(val.imag_data()) < 0);
|
|
503
|
+
|
|
504
|
+
Backend __my_imag_part_fabs(val.imag_data());
|
|
505
|
+
if (__my_imag_part_is_neg)
|
|
506
|
+
__my_imag_part_fabs.negate();
|
|
507
|
+
|
|
508
|
+
eval_ldexp(t, __my_sqrt_part, 1);
|
|
509
|
+
eval_divide(result.real_data(), __my_imag_part_fabs, t);
|
|
510
|
+
if (__my_imag_part_is_neg)
|
|
511
|
+
__my_sqrt_part.negate();
|
|
512
|
+
result.imag_data() = __my_sqrt_part;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
template <class Backend>
|
|
517
|
+
inline void eval_abs(Backend& result, const complex_adaptor<Backend>& val)
|
|
518
|
+
{
|
|
519
|
+
Backend t1, t2;
|
|
520
|
+
eval_multiply(t1, val.real_data(), val.real_data());
|
|
521
|
+
eval_multiply(t2, val.imag_data(), val.imag_data());
|
|
522
|
+
eval_add(t1, t2);
|
|
523
|
+
eval_sqrt(result, t1);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
template <class Backend>
|
|
527
|
+
inline void eval_pow(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& b, const complex_adaptor<Backend>& e)
|
|
528
|
+
{
|
|
529
|
+
using default_ops::eval_acos;
|
|
530
|
+
using default_ops::eval_cos;
|
|
531
|
+
using default_ops::eval_exp;
|
|
532
|
+
using default_ops::eval_get_sign;
|
|
533
|
+
using default_ops::eval_is_zero;
|
|
534
|
+
using default_ops::eval_multiply;
|
|
535
|
+
using default_ops::eval_sin;
|
|
536
|
+
|
|
537
|
+
if (eval_is_zero(e))
|
|
538
|
+
{
|
|
539
|
+
typename std::tuple_element<0, typename Backend::unsigned_types>::type one(1);
|
|
540
|
+
result = one;
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
else if (eval_is_zero(b))
|
|
544
|
+
{
|
|
545
|
+
if (eval_is_zero(e.real_data()))
|
|
546
|
+
{
|
|
547
|
+
Backend n = std::numeric_limits<number<Backend> >::quiet_NaN().backend();
|
|
548
|
+
result.real_data() = n;
|
|
549
|
+
result.imag_data() = n;
|
|
550
|
+
}
|
|
551
|
+
else if (eval_get_sign(e.real_data()) < 0)
|
|
552
|
+
{
|
|
553
|
+
Backend n = std::numeric_limits<number<Backend> >::infinity().backend();
|
|
554
|
+
result.real_data() = n;
|
|
555
|
+
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
|
556
|
+
if (eval_is_zero(e.imag_data()))
|
|
557
|
+
result.imag_data() = zero;
|
|
558
|
+
else
|
|
559
|
+
result.imag_data() = n;
|
|
560
|
+
}
|
|
561
|
+
else
|
|
562
|
+
{
|
|
563
|
+
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
|
564
|
+
result = zero;
|
|
565
|
+
}
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
complex_adaptor<Backend> t;
|
|
569
|
+
eval_log(t, b);
|
|
570
|
+
eval_multiply(t, e);
|
|
571
|
+
eval_exp(result, t);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
template <class Backend>
|
|
575
|
+
inline void eval_exp(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
576
|
+
{
|
|
577
|
+
using default_ops::eval_cos;
|
|
578
|
+
using default_ops::eval_exp;
|
|
579
|
+
using default_ops::eval_is_zero;
|
|
580
|
+
using default_ops::eval_multiply;
|
|
581
|
+
using default_ops::eval_sin;
|
|
582
|
+
|
|
583
|
+
if (eval_is_zero(arg.imag_data()))
|
|
584
|
+
{
|
|
585
|
+
eval_exp(result.real_data(), arg.real_data());
|
|
586
|
+
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
|
587
|
+
result.imag_data() = zero;
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
eval_cos(result.real_data(), arg.imag_data());
|
|
591
|
+
eval_sin(result.imag_data(), arg.imag_data());
|
|
592
|
+
Backend e;
|
|
593
|
+
eval_exp(e, arg.real_data());
|
|
594
|
+
if (eval_is_zero(result.real_data()))
|
|
595
|
+
eval_multiply(result.imag_data(), e);
|
|
596
|
+
else if (eval_is_zero(result.imag_data()))
|
|
597
|
+
eval_multiply(result.real_data(), e);
|
|
598
|
+
else
|
|
599
|
+
eval_multiply(result, e);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
template <class Backend>
|
|
603
|
+
inline void eval_log(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
604
|
+
{
|
|
605
|
+
using default_ops::eval_add;
|
|
606
|
+
using default_ops::eval_atan2;
|
|
607
|
+
using default_ops::eval_get_sign;
|
|
608
|
+
using default_ops::eval_is_zero;
|
|
609
|
+
using default_ops::eval_log;
|
|
610
|
+
using default_ops::eval_multiply;
|
|
611
|
+
|
|
612
|
+
if (eval_is_zero(arg.imag_data()) && (eval_get_sign(arg.real_data()) >= 0))
|
|
613
|
+
{
|
|
614
|
+
eval_log(result.real_data(), arg.real_data());
|
|
615
|
+
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
|
616
|
+
result.imag_data() = zero;
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
Backend t1, t2;
|
|
621
|
+
eval_multiply(t1, arg.real_data(), arg.real_data());
|
|
622
|
+
eval_multiply(t2, arg.imag_data(), arg.imag_data());
|
|
623
|
+
eval_add(t1, t2);
|
|
624
|
+
eval_log(t2, t1);
|
|
625
|
+
eval_ldexp(result.real_data(), t2, -1);
|
|
626
|
+
eval_atan2(result.imag_data(), arg.imag_data(), arg.real_data());
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
template <class Backend>
|
|
630
|
+
inline void eval_log10(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
631
|
+
{
|
|
632
|
+
using default_ops::eval_divide;
|
|
633
|
+
using default_ops::eval_log;
|
|
634
|
+
|
|
635
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
636
|
+
|
|
637
|
+
Backend ten;
|
|
638
|
+
ten = ui_type(10);
|
|
639
|
+
Backend l_ten;
|
|
640
|
+
eval_log(l_ten, ten);
|
|
641
|
+
eval_log(result, arg);
|
|
642
|
+
eval_divide(result, l_ten);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
template <class Backend>
|
|
646
|
+
inline void eval_sin(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
647
|
+
{
|
|
648
|
+
using default_ops::eval_cos;
|
|
649
|
+
using default_ops::eval_cosh;
|
|
650
|
+
using default_ops::eval_sin;
|
|
651
|
+
using default_ops::eval_sinh;
|
|
652
|
+
|
|
653
|
+
Backend t1, t2, t3;
|
|
654
|
+
eval_sin(t1, arg.real_data());
|
|
655
|
+
eval_cosh(t2, arg.imag_data());
|
|
656
|
+
eval_multiply(t3, t1, t2);
|
|
657
|
+
|
|
658
|
+
eval_cos(t1, arg.real_data());
|
|
659
|
+
eval_sinh(t2, arg.imag_data());
|
|
660
|
+
eval_multiply(result.imag_data(), t1, t2);
|
|
661
|
+
result.real_data() = t3;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
template <class Backend>
|
|
665
|
+
inline void eval_cos(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
666
|
+
{
|
|
667
|
+
using default_ops::eval_cos;
|
|
668
|
+
using default_ops::eval_cosh;
|
|
669
|
+
using default_ops::eval_sin;
|
|
670
|
+
using default_ops::eval_sinh;
|
|
671
|
+
|
|
672
|
+
Backend t1, t2, t3;
|
|
673
|
+
eval_cos(t1, arg.real_data());
|
|
674
|
+
eval_cosh(t2, arg.imag_data());
|
|
675
|
+
eval_multiply(t3, t1, t2);
|
|
676
|
+
|
|
677
|
+
eval_sin(t1, arg.real_data());
|
|
678
|
+
eval_sinh(t2, arg.imag_data());
|
|
679
|
+
eval_multiply(result.imag_data(), t1, t2);
|
|
680
|
+
result.imag_data().negate();
|
|
681
|
+
result.real_data() = t3;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
template <class T>
|
|
685
|
+
void tanh_imp(const T& r, const T& i, T& r_result, T& i_result)
|
|
686
|
+
{
|
|
687
|
+
using default_ops::eval_tan;
|
|
688
|
+
using default_ops::eval_sinh;
|
|
689
|
+
using default_ops::eval_add;
|
|
690
|
+
using default_ops::eval_fpclassify;
|
|
691
|
+
using default_ops::eval_get_sign;
|
|
692
|
+
|
|
693
|
+
using ui_type = typename std::tuple_element<0, typename T::unsigned_types>::type;
|
|
694
|
+
ui_type one(1);
|
|
695
|
+
//
|
|
696
|
+
// Set:
|
|
697
|
+
// t = tan(i);
|
|
698
|
+
// s = sinh(r);
|
|
699
|
+
// b = s * (1 + t^2);
|
|
700
|
+
// d = 1 + b * s;
|
|
701
|
+
//
|
|
702
|
+
T t, s, b, d;
|
|
703
|
+
eval_tan(t, i);
|
|
704
|
+
eval_sinh(s, r);
|
|
705
|
+
eval_multiply(d, t, t);
|
|
706
|
+
eval_add(d, one);
|
|
707
|
+
eval_multiply(b, d, s);
|
|
708
|
+
eval_multiply(d, b, s);
|
|
709
|
+
eval_add(d, one);
|
|
710
|
+
|
|
711
|
+
if (eval_fpclassify(d) == FP_INFINITE)
|
|
712
|
+
{
|
|
713
|
+
r_result = one;
|
|
714
|
+
if (eval_get_sign(s) < 0)
|
|
715
|
+
r_result.negate();
|
|
716
|
+
//
|
|
717
|
+
// Imaginary part is a signed zero:
|
|
718
|
+
//
|
|
719
|
+
ui_type zero(0);
|
|
720
|
+
i_result = zero;
|
|
721
|
+
if (eval_get_sign(t) < 0)
|
|
722
|
+
i_result.negate();
|
|
723
|
+
}
|
|
724
|
+
//
|
|
725
|
+
// Real part is sqrt(1 + s^2) * b / d;
|
|
726
|
+
// Imaginary part is t / d;
|
|
727
|
+
//
|
|
728
|
+
eval_divide(i_result, t, d);
|
|
729
|
+
//
|
|
730
|
+
// variable t is now spare, as is r_result.
|
|
731
|
+
//
|
|
732
|
+
eval_multiply(t, s, s);
|
|
733
|
+
eval_add(t, one);
|
|
734
|
+
eval_sqrt(r_result, t);
|
|
735
|
+
eval_multiply(t, r_result, b);
|
|
736
|
+
eval_divide(r_result, t, d);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
template <class Backend>
|
|
740
|
+
inline void eval_tanh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
741
|
+
{
|
|
742
|
+
tanh_imp(arg.real_data(), arg.imag_data(), result.real_data(), result.imag_data());
|
|
743
|
+
}
|
|
744
|
+
template <class Backend>
|
|
745
|
+
inline void eval_tan(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
746
|
+
{
|
|
747
|
+
Backend t(arg.imag_data());
|
|
748
|
+
t.negate();
|
|
749
|
+
tanh_imp(t, arg.real_data(), result.imag_data(), result.real_data());
|
|
750
|
+
result.imag_data().negate();
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
template <class Backend>
|
|
754
|
+
inline void eval_asin(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
755
|
+
{
|
|
756
|
+
using default_ops::eval_add;
|
|
757
|
+
using default_ops::eval_multiply;
|
|
758
|
+
|
|
759
|
+
if (eval_is_zero(arg))
|
|
760
|
+
{
|
|
761
|
+
result = arg;
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
complex_adaptor<Backend> t1, t2;
|
|
766
|
+
assign_components(t1, arg.imag_data(), arg.real_data());
|
|
767
|
+
t1.real_data().negate();
|
|
768
|
+
eval_asinh(t2, t1);
|
|
769
|
+
|
|
770
|
+
assign_components(result, t2.imag_data(), t2.real_data());
|
|
771
|
+
result.imag_data().negate();
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
template <class Backend>
|
|
775
|
+
inline void eval_acos(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
776
|
+
{
|
|
777
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
778
|
+
|
|
779
|
+
using default_ops::eval_asin;
|
|
780
|
+
|
|
781
|
+
Backend half_pi, t1;
|
|
782
|
+
t1 = static_cast<ui_type>(1u);
|
|
783
|
+
eval_asin(half_pi, t1);
|
|
784
|
+
eval_asin(result, arg);
|
|
785
|
+
result.negate();
|
|
786
|
+
eval_add(result.real_data(), half_pi);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
template <class Backend>
|
|
790
|
+
inline void eval_atan(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
791
|
+
{
|
|
792
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
793
|
+
ui_type one = (ui_type)1u;
|
|
794
|
+
|
|
795
|
+
using default_ops::eval_add;
|
|
796
|
+
using default_ops::eval_is_zero;
|
|
797
|
+
using default_ops::eval_log;
|
|
798
|
+
using default_ops::eval_subtract;
|
|
799
|
+
|
|
800
|
+
complex_adaptor<Backend> __my_z_times_i, t1, t2, t3;
|
|
801
|
+
assign_components(__my_z_times_i, arg.imag_data(), arg.real_data());
|
|
802
|
+
__my_z_times_i.real_data().negate();
|
|
803
|
+
|
|
804
|
+
eval_add(t1, __my_z_times_i, one);
|
|
805
|
+
eval_log(t2, t1);
|
|
806
|
+
eval_subtract(t1, one, __my_z_times_i);
|
|
807
|
+
eval_log(t3, t1);
|
|
808
|
+
eval_subtract(t1, t3, t2);
|
|
809
|
+
|
|
810
|
+
eval_ldexp(result.real_data(), t1.imag_data(), -1);
|
|
811
|
+
eval_ldexp(result.imag_data(), t1.real_data(), -1);
|
|
812
|
+
if (!eval_is_zero(result.real_data()))
|
|
813
|
+
result.real_data().negate();
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
template <class Backend>
|
|
817
|
+
inline void eval_sinh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
818
|
+
{
|
|
819
|
+
using default_ops::eval_cos;
|
|
820
|
+
using default_ops::eval_cosh;
|
|
821
|
+
using default_ops::eval_sin;
|
|
822
|
+
using default_ops::eval_sinh;
|
|
823
|
+
|
|
824
|
+
Backend t1, t2, t3;
|
|
825
|
+
eval_cos(t1, arg.imag_data());
|
|
826
|
+
eval_sinh(t2, arg.real_data());
|
|
827
|
+
eval_multiply(t3, t1, t2);
|
|
828
|
+
|
|
829
|
+
eval_cosh(t1, arg.real_data());
|
|
830
|
+
eval_sin(t2, arg.imag_data());
|
|
831
|
+
eval_multiply(result.imag_data(), t1, t2);
|
|
832
|
+
result.real_data() = t3;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
template <class Backend>
|
|
836
|
+
inline void eval_cosh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
837
|
+
{
|
|
838
|
+
using default_ops::eval_cos;
|
|
839
|
+
using default_ops::eval_cosh;
|
|
840
|
+
using default_ops::eval_sin;
|
|
841
|
+
using default_ops::eval_sinh;
|
|
842
|
+
|
|
843
|
+
Backend t1, t2, t3;
|
|
844
|
+
eval_cos(t1, arg.imag_data());
|
|
845
|
+
eval_cosh(t2, arg.real_data());
|
|
846
|
+
eval_multiply(t3, t1, t2);
|
|
847
|
+
|
|
848
|
+
eval_sin(t1, arg.imag_data());
|
|
849
|
+
eval_sinh(t2, arg.real_data());
|
|
850
|
+
eval_multiply(result.imag_data(), t1, t2);
|
|
851
|
+
result.real_data() = t3;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
template <class Backend>
|
|
855
|
+
inline void eval_asinh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
856
|
+
{
|
|
857
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
858
|
+
ui_type one = (ui_type)1u;
|
|
859
|
+
|
|
860
|
+
using default_ops::eval_add;
|
|
861
|
+
using default_ops::eval_log;
|
|
862
|
+
using default_ops::eval_multiply;
|
|
863
|
+
|
|
864
|
+
complex_adaptor<Backend> t1, t2;
|
|
865
|
+
eval_multiply(t1, arg, arg);
|
|
866
|
+
eval_add(t1, one);
|
|
867
|
+
eval_sqrt(t2, t1);
|
|
868
|
+
eval_add(t2, arg);
|
|
869
|
+
eval_log(result, t2);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
template <class Backend>
|
|
873
|
+
inline void eval_acosh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
874
|
+
{
|
|
875
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
876
|
+
ui_type one = (ui_type)1u;
|
|
877
|
+
|
|
878
|
+
using default_ops::eval_add;
|
|
879
|
+
using default_ops::eval_divide;
|
|
880
|
+
using default_ops::eval_log;
|
|
881
|
+
using default_ops::eval_multiply;
|
|
882
|
+
using default_ops::eval_subtract;
|
|
883
|
+
|
|
884
|
+
complex_adaptor<Backend> __my_zp(arg);
|
|
885
|
+
eval_add(__my_zp.real_data(), one);
|
|
886
|
+
complex_adaptor<Backend> __my_zm(arg);
|
|
887
|
+
eval_subtract(__my_zm.real_data(), one);
|
|
888
|
+
|
|
889
|
+
complex_adaptor<Backend> t1, t2;
|
|
890
|
+
eval_divide(t1, __my_zm, __my_zp);
|
|
891
|
+
eval_sqrt(t2, t1);
|
|
892
|
+
eval_multiply(t2, __my_zp);
|
|
893
|
+
eval_add(t2, arg);
|
|
894
|
+
eval_log(result, t2);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
template <class Backend>
|
|
898
|
+
inline void eval_atanh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
899
|
+
{
|
|
900
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
901
|
+
ui_type one = (ui_type)1u;
|
|
902
|
+
|
|
903
|
+
using default_ops::eval_add;
|
|
904
|
+
using default_ops::eval_divide;
|
|
905
|
+
using default_ops::eval_log;
|
|
906
|
+
using default_ops::eval_multiply;
|
|
907
|
+
using default_ops::eval_subtract;
|
|
908
|
+
|
|
909
|
+
complex_adaptor<Backend> t1, t2, t3;
|
|
910
|
+
eval_add(t1, arg, one);
|
|
911
|
+
eval_log(t2, t1);
|
|
912
|
+
eval_subtract(t1, one, arg);
|
|
913
|
+
eval_log(t3, t1);
|
|
914
|
+
eval_subtract(t2, t3);
|
|
915
|
+
|
|
916
|
+
eval_ldexp(result.real_data(), t2.real_data(), -1);
|
|
917
|
+
eval_ldexp(result.imag_data(), t2.imag_data(), -1);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
template <class Backend>
|
|
921
|
+
inline void eval_conj(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
922
|
+
{
|
|
923
|
+
result = arg;
|
|
924
|
+
result.imag_data().negate();
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
template <class Backend>
|
|
928
|
+
inline void eval_proj(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
|
929
|
+
{
|
|
930
|
+
using default_ops::eval_get_sign;
|
|
931
|
+
|
|
932
|
+
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
|
|
933
|
+
ui_type zero = (ui_type)0u;
|
|
934
|
+
|
|
935
|
+
int c1 = eval_fpclassify(arg.real_data());
|
|
936
|
+
int c2 = eval_fpclassify(arg.imag_data());
|
|
937
|
+
if (c1 == FP_INFINITE)
|
|
938
|
+
{
|
|
939
|
+
result.real_data() = arg.real_data();
|
|
940
|
+
if (eval_get_sign(result.real_data()) < 0)
|
|
941
|
+
result.real_data().negate();
|
|
942
|
+
result.imag_data() = zero;
|
|
943
|
+
if (eval_get_sign(arg.imag_data()) < 0)
|
|
944
|
+
result.imag_data().negate();
|
|
945
|
+
}
|
|
946
|
+
else if (c2 == FP_INFINITE)
|
|
947
|
+
{
|
|
948
|
+
result.real_data() = arg.imag_data();
|
|
949
|
+
if (eval_get_sign(result.real_data()) < 0)
|
|
950
|
+
result.real_data().negate();
|
|
951
|
+
result.imag_data() = zero;
|
|
952
|
+
if (eval_get_sign(arg.imag_data()) < 0)
|
|
953
|
+
result.imag_data().negate();
|
|
954
|
+
}
|
|
955
|
+
else
|
|
956
|
+
result = arg;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
template <class Backend>
|
|
960
|
+
inline void eval_real(Backend& result, const complex_adaptor<Backend>& arg)
|
|
961
|
+
{
|
|
962
|
+
result = arg.real_data();
|
|
963
|
+
}
|
|
964
|
+
template <class Backend>
|
|
965
|
+
inline void eval_imag(Backend& result, const complex_adaptor<Backend>& arg)
|
|
966
|
+
{
|
|
967
|
+
result = arg.imag_data();
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
template <class Backend, class T>
|
|
971
|
+
inline void eval_set_imag(complex_adaptor<Backend>& result, const T& arg)
|
|
972
|
+
{
|
|
973
|
+
result.imag_data() = arg;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
template <class Backend, class T>
|
|
977
|
+
inline void eval_set_real(complex_adaptor<Backend>& result, const T& arg)
|
|
978
|
+
{
|
|
979
|
+
result.real_data() = arg;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
template <class Backend>
|
|
983
|
+
inline std::size_t hash_value(const complex_adaptor<Backend>& val)
|
|
984
|
+
{
|
|
985
|
+
std::size_t result = hash_value(val.real_data());
|
|
986
|
+
std::size_t result2 = hash_value(val.imag_data());
|
|
987
|
+
boost::multiprecision::detail::hash_combine(result, result2);
|
|
988
|
+
return result;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
} // namespace backends
|
|
992
|
+
|
|
993
|
+
template <class Backend>
|
|
994
|
+
struct number_category<complex_adaptor<Backend> > : public std::integral_constant<int, boost::multiprecision::number_kind_complex>
|
|
995
|
+
{};
|
|
996
|
+
|
|
997
|
+
template <class Backend, expression_template_option ExpressionTemplates>
|
|
998
|
+
struct component_type<number<complex_adaptor<Backend>, ExpressionTemplates> >
|
|
999
|
+
{
|
|
1000
|
+
using type = number<Backend, ExpressionTemplates>;
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
template <class Backend, expression_template_option ExpressionTemplates>
|
|
1004
|
+
struct complex_result_from_scalar<number<Backend, ExpressionTemplates> >
|
|
1005
|
+
{
|
|
1006
|
+
using type = number<complex_adaptor<Backend>, ExpressionTemplates>;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
namespace detail {
|
|
1010
|
+
template <class Backend>
|
|
1011
|
+
struct is_variable_precision<complex_adaptor<Backend> > : public is_variable_precision<Backend>
|
|
1012
|
+
{};
|
|
1013
|
+
#ifdef BOOST_HAS_INT128
|
|
1014
|
+
template <class Backend>
|
|
1015
|
+
struct is_convertible_arithmetic<int128_type, complex_adaptor<Backend> > : is_convertible_arithmetic<int128_type, Backend>
|
|
1016
|
+
{};
|
|
1017
|
+
template <class Backend>
|
|
1018
|
+
struct is_convertible_arithmetic<uint128_type, complex_adaptor<Backend> > : is_convertible_arithmetic<uint128_type, Backend>
|
|
1019
|
+
{};
|
|
1020
|
+
#endif
|
|
1021
|
+
#ifdef BOOST_HAS_FLOAT128
|
|
1022
|
+
template <class Backend>
|
|
1023
|
+
struct is_convertible_arithmetic<float128_type, complex_adaptor<Backend> > : is_convertible_arithmetic<float128_type, Backend>
|
|
1024
|
+
{};
|
|
1025
|
+
#endif
|
|
1026
|
+
} // namespace detail
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
template <class Backend, expression_template_option ExpressionTemplates>
|
|
1031
|
+
struct complex_result_from_scalar<number<backends::debug_adaptor<Backend>, ExpressionTemplates> >
|
|
1032
|
+
{
|
|
1033
|
+
using type = number<backends::debug_adaptor<complex_adaptor<Backend> >, ExpressionTemplates>;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
template <class Backend, expression_template_option ExpressionTemplates>
|
|
1037
|
+
struct complex_result_from_scalar<number<backends::logged_adaptor<Backend>, ExpressionTemplates> >
|
|
1038
|
+
{
|
|
1039
|
+
using type = number<backends::logged_adaptor<complex_adaptor<Backend> >, ExpressionTemplates>;
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
} // namespace boost::multiprecision
|
|
1045
|
+
|
|
1046
|
+
#endif
|