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,1721 @@
|
|
|
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_MPC_HPP
|
|
7
|
+
#define BOOST_MP_MPC_HPP
|
|
8
|
+
|
|
9
|
+
#include <cstdint>
|
|
10
|
+
#include <boost/multiprecision/detail/standalone_config.hpp>
|
|
11
|
+
#include <boost/multiprecision/detail/fpclassify.hpp>
|
|
12
|
+
#include <boost/multiprecision/number.hpp>
|
|
13
|
+
#include <boost/multiprecision/detail/digits.hpp>
|
|
14
|
+
#include <boost/multiprecision/detail/atomic.hpp>
|
|
15
|
+
#include <boost/multiprecision/traits/is_variable_precision.hpp>
|
|
16
|
+
#include <boost/multiprecision/mpfr.hpp>
|
|
17
|
+
#include <boost/multiprecision/detail/hash.hpp>
|
|
18
|
+
#include <boost/multiprecision/detail/no_exceptions_support.hpp>
|
|
19
|
+
#include <boost/multiprecision/detail/assert.hpp>
|
|
20
|
+
#include <mpc.h>
|
|
21
|
+
#include <cmath>
|
|
22
|
+
#include <algorithm>
|
|
23
|
+
#include <complex>
|
|
24
|
+
|
|
25
|
+
#ifndef BOOST_MULTIPRECISION_MPFI_DEFAULT_PRECISION
|
|
26
|
+
#define BOOST_MULTIPRECISION_MPFI_DEFAULT_PRECISION 20
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
namespace boost {
|
|
30
|
+
namespace multiprecision {
|
|
31
|
+
|
|
32
|
+
template <unsigned digits10>
|
|
33
|
+
struct number_category<backends::mpc_complex_backend<digits10> > : public std::integral_constant<int, number_kind_complex>
|
|
34
|
+
{};
|
|
35
|
+
|
|
36
|
+
namespace backends {
|
|
37
|
+
|
|
38
|
+
namespace detail {
|
|
39
|
+
|
|
40
|
+
inline void mpc_copy_precision(mpc_t dest, const mpc_t src)
|
|
41
|
+
{
|
|
42
|
+
mpfr_prec_t p_dest = mpc_get_prec(dest);
|
|
43
|
+
mpfr_prec_t p_src = mpc_get_prec(src);
|
|
44
|
+
if (p_dest != p_src)
|
|
45
|
+
mpc_set_prec(dest, p_src);
|
|
46
|
+
}
|
|
47
|
+
inline void mpc_copy_precision(mpc_t dest, const mpc_t src1, const mpc_t src2)
|
|
48
|
+
{
|
|
49
|
+
mpfr_prec_t p_dest = mpc_get_prec(dest);
|
|
50
|
+
mpfr_prec_t p_src1 = mpc_get_prec(src1);
|
|
51
|
+
mpfr_prec_t p_src2 = mpc_get_prec(src2);
|
|
52
|
+
if (p_src2 > p_src1)
|
|
53
|
+
p_src1 = p_src2;
|
|
54
|
+
if (p_dest != p_src1)
|
|
55
|
+
mpc_set_prec(dest, p_src1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
template <unsigned digits10>
|
|
59
|
+
struct mpc_complex_imp
|
|
60
|
+
{
|
|
61
|
+
#ifdef BOOST_HAS_LONG_LONG
|
|
62
|
+
using signed_types = std::tuple<long, long long> ;
|
|
63
|
+
using unsigned_types = std::tuple<unsigned long, unsigned long long>;
|
|
64
|
+
#else
|
|
65
|
+
using signed_types = std::tuple<long> ;
|
|
66
|
+
using unsigned_types = std::tuple<unsigned long>;
|
|
67
|
+
#endif
|
|
68
|
+
using float_types = std::tuple<double, long double>;
|
|
69
|
+
using exponent_type = long ;
|
|
70
|
+
|
|
71
|
+
mpc_complex_imp()
|
|
72
|
+
{
|
|
73
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
74
|
+
mpc_set_ui(m_data, 0u, GMP_RNDN);
|
|
75
|
+
}
|
|
76
|
+
mpc_complex_imp(unsigned digits2)
|
|
77
|
+
{
|
|
78
|
+
mpc_init2(m_data, digits2);
|
|
79
|
+
mpc_set_ui(m_data, 0u, GMP_RNDN);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
mpc_complex_imp(const mpc_complex_imp& o)
|
|
83
|
+
{
|
|
84
|
+
mpc_init2(m_data, preserve_source_precision() ? mpc_get_prec(o.data()) : boost::multiprecision::detail::digits10_2_2(get_default_precision()));
|
|
85
|
+
if (o.m_data[0].re[0]._mpfr_d)
|
|
86
|
+
mpc_set(m_data, o.m_data, GMP_RNDN);
|
|
87
|
+
}
|
|
88
|
+
// rvalue copy
|
|
89
|
+
mpc_complex_imp(mpc_complex_imp&& o) noexcept
|
|
90
|
+
{
|
|
91
|
+
mpfr_prec_t binary_default_precision = boost::multiprecision::detail::digits10_2_2(get_default_precision());
|
|
92
|
+
if ((this->get_default_options() != variable_precision_options::preserve_target_precision) || (mpc_get_prec(o.data()) == binary_default_precision))
|
|
93
|
+
{
|
|
94
|
+
m_data[0] = o.m_data[0];
|
|
95
|
+
o.m_data[0].re[0]._mpfr_d = nullptr;
|
|
96
|
+
}
|
|
97
|
+
else
|
|
98
|
+
{
|
|
99
|
+
// NOTE: C allocation interface must not throw:
|
|
100
|
+
mpc_init2(m_data, binary_default_precision);
|
|
101
|
+
if (o.m_data[0].re[0]._mpfr_d)
|
|
102
|
+
mpc_set(m_data, o.m_data, GMP_RNDN);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
mpc_complex_imp& operator=(const mpc_complex_imp& o)
|
|
106
|
+
{
|
|
107
|
+
if ((o.m_data[0].re[0]._mpfr_d) && (this != &o))
|
|
108
|
+
{
|
|
109
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
110
|
+
mpc_init2(m_data, preserve_source_precision() ? mpc_get_prec(o.m_data) : boost::multiprecision::detail::digits10_2_2(get_default_precision()));
|
|
111
|
+
else if (preserve_source_precision() && (mpc_get_prec(o.data()) != mpc_get_prec(data())))
|
|
112
|
+
{
|
|
113
|
+
mpc_set_prec(m_data, mpc_get_prec(o.m_data));
|
|
114
|
+
}
|
|
115
|
+
mpc_set(m_data, o.m_data, GMP_RNDN);
|
|
116
|
+
}
|
|
117
|
+
return *this;
|
|
118
|
+
}
|
|
119
|
+
// rvalue assign
|
|
120
|
+
mpc_complex_imp& operator=(mpc_complex_imp&& o) noexcept
|
|
121
|
+
{
|
|
122
|
+
if ((this->get_default_options() != variable_precision_options::preserve_target_precision) || (mpc_get_prec(o.data()) == mpc_get_prec(data())))
|
|
123
|
+
mpc_swap(m_data, o.m_data);
|
|
124
|
+
else
|
|
125
|
+
*this = static_cast<const mpc_complex_imp&>(o);
|
|
126
|
+
return *this;
|
|
127
|
+
}
|
|
128
|
+
#ifdef BOOST_HAS_LONG_LONG
|
|
129
|
+
#ifdef _MPFR_H_HAVE_INTMAX_T
|
|
130
|
+
mpc_complex_imp& operator=(unsigned long long i)
|
|
131
|
+
{
|
|
132
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
133
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
134
|
+
mpc_set_uj(data(), i, GMP_RNDN);
|
|
135
|
+
return *this;
|
|
136
|
+
}
|
|
137
|
+
mpc_complex_imp& operator=(long long i)
|
|
138
|
+
{
|
|
139
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
140
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
141
|
+
mpc_set_sj(data(), i, GMP_RNDN);
|
|
142
|
+
return *this;
|
|
143
|
+
}
|
|
144
|
+
#else
|
|
145
|
+
mpc_complex_imp& operator=(unsigned long long i)
|
|
146
|
+
{
|
|
147
|
+
mpfr_float_backend<digits10> f(0uL, mpc_get_prec(m_data));
|
|
148
|
+
f = i;
|
|
149
|
+
mpc_set_fr(this->data(), f.data(), GMP_RNDN);
|
|
150
|
+
return *this;
|
|
151
|
+
}
|
|
152
|
+
mpc_complex_imp& operator=(long long i)
|
|
153
|
+
{
|
|
154
|
+
mpfr_float_backend<digits10> f(0uL, mpc_get_prec(m_data));
|
|
155
|
+
f = i;
|
|
156
|
+
mpc_set_fr(this->data(), f.data(), GMP_RNDN);
|
|
157
|
+
return *this;
|
|
158
|
+
}
|
|
159
|
+
#endif
|
|
160
|
+
#endif
|
|
161
|
+
mpc_complex_imp& operator=(unsigned long i)
|
|
162
|
+
{
|
|
163
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
164
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
165
|
+
mpc_set_ui(m_data, i, GMP_RNDN);
|
|
166
|
+
return *this;
|
|
167
|
+
}
|
|
168
|
+
mpc_complex_imp& operator=(long i)
|
|
169
|
+
{
|
|
170
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
171
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
172
|
+
mpc_set_si(m_data, i, GMP_RNDN);
|
|
173
|
+
return *this;
|
|
174
|
+
}
|
|
175
|
+
mpc_complex_imp& operator=(double d)
|
|
176
|
+
{
|
|
177
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
178
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
179
|
+
mpc_set_d(m_data, d, GMP_RNDN);
|
|
180
|
+
return *this;
|
|
181
|
+
}
|
|
182
|
+
mpc_complex_imp& operator=(long double d)
|
|
183
|
+
{
|
|
184
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
185
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
186
|
+
mpc_set_ld(m_data, d, GMP_RNDN);
|
|
187
|
+
return *this;
|
|
188
|
+
}
|
|
189
|
+
mpc_complex_imp& operator=(mpz_t i)
|
|
190
|
+
{
|
|
191
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
192
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
193
|
+
mpc_set_z(m_data, i, GMP_RNDN);
|
|
194
|
+
return *this;
|
|
195
|
+
}
|
|
196
|
+
mpc_complex_imp& operator=(gmp_int i)
|
|
197
|
+
{
|
|
198
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
199
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
200
|
+
mpc_set_z(m_data, i.data(), GMP_RNDN);
|
|
201
|
+
return *this;
|
|
202
|
+
}
|
|
203
|
+
#ifdef BOOST_HAS_INT128
|
|
204
|
+
mpc_complex_imp& operator=(int128_type val)
|
|
205
|
+
{
|
|
206
|
+
gmp_int i;
|
|
207
|
+
i = val;
|
|
208
|
+
return *this = i.data();
|
|
209
|
+
}
|
|
210
|
+
mpc_complex_imp& operator=(uint128_type val)
|
|
211
|
+
{
|
|
212
|
+
gmp_int i;
|
|
213
|
+
i = val;
|
|
214
|
+
return *this = i.data();
|
|
215
|
+
}
|
|
216
|
+
#endif
|
|
217
|
+
#ifdef BOOST_HAS_FLOAT128
|
|
218
|
+
mpc_complex_imp& operator=(float128_type val)
|
|
219
|
+
{
|
|
220
|
+
mpfr_float_backend<digits10> f;
|
|
221
|
+
f = val;
|
|
222
|
+
mpc_set_fr(this->m_data, f.data(), GMP_RNDN);
|
|
223
|
+
return *this;
|
|
224
|
+
}
|
|
225
|
+
#endif
|
|
226
|
+
|
|
227
|
+
mpc_complex_imp& operator=(const char* s)
|
|
228
|
+
{
|
|
229
|
+
using default_ops::eval_fpclassify;
|
|
230
|
+
|
|
231
|
+
if (m_data[0].re[0]._mpfr_d == nullptr)
|
|
232
|
+
mpc_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
|
|
233
|
+
|
|
234
|
+
mpfr_float_backend<digits10> a(0uL, mpc_get_prec(m_data)), b(0uL, mpc_get_prec(m_data));
|
|
235
|
+
|
|
236
|
+
if (s && (*s == '('))
|
|
237
|
+
{
|
|
238
|
+
std::string part;
|
|
239
|
+
const char* p = ++s;
|
|
240
|
+
while (*p && (*p != ',') && (*p != ')'))
|
|
241
|
+
++p;
|
|
242
|
+
part.assign(s, p);
|
|
243
|
+
if (part.size())
|
|
244
|
+
a = part.c_str();
|
|
245
|
+
else
|
|
246
|
+
a = 0uL;
|
|
247
|
+
s = p;
|
|
248
|
+
if (*p && (*p != ')'))
|
|
249
|
+
{
|
|
250
|
+
++p;
|
|
251
|
+
while (*p && (*p != ')'))
|
|
252
|
+
++p;
|
|
253
|
+
part.assign(s + 1, p);
|
|
254
|
+
}
|
|
255
|
+
else
|
|
256
|
+
part.erase();
|
|
257
|
+
if (part.size())
|
|
258
|
+
b = part.c_str();
|
|
259
|
+
else
|
|
260
|
+
b = 0uL;
|
|
261
|
+
}
|
|
262
|
+
else
|
|
263
|
+
{
|
|
264
|
+
a = s;
|
|
265
|
+
b = 0uL;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (eval_fpclassify(a) == static_cast<int>(FP_NAN))
|
|
269
|
+
{
|
|
270
|
+
mpc_set_fr(this->data(), a.data(), GMP_RNDN);
|
|
271
|
+
}
|
|
272
|
+
else if (eval_fpclassify(b) == static_cast<int>(FP_NAN))
|
|
273
|
+
{
|
|
274
|
+
mpc_set_fr(this->data(), b.data(), GMP_RNDN);
|
|
275
|
+
}
|
|
276
|
+
else
|
|
277
|
+
{
|
|
278
|
+
mpc_set_fr_fr(m_data, a.data(), b.data(), GMP_RNDN);
|
|
279
|
+
}
|
|
280
|
+
return *this;
|
|
281
|
+
}
|
|
282
|
+
void swap(mpc_complex_imp& o) noexcept
|
|
283
|
+
{
|
|
284
|
+
mpc_swap(m_data, o.m_data);
|
|
285
|
+
}
|
|
286
|
+
std::string str(std::streamsize digits, std::ios_base::fmtflags f) const
|
|
287
|
+
{
|
|
288
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d);
|
|
289
|
+
|
|
290
|
+
mpfr_float_backend<digits10> a(0uL, mpc_get_prec(m_data)), b(0uL, mpc_get_prec(m_data));
|
|
291
|
+
|
|
292
|
+
mpc_real(a.data(), m_data, GMP_RNDN);
|
|
293
|
+
mpc_imag(b.data(), m_data, GMP_RNDN);
|
|
294
|
+
|
|
295
|
+
if (eval_is_zero(b))
|
|
296
|
+
return a.str(digits, f);
|
|
297
|
+
|
|
298
|
+
return "(" + a.str(digits, f) + "," + b.str(digits, f) + ")";
|
|
299
|
+
}
|
|
300
|
+
~mpc_complex_imp() noexcept
|
|
301
|
+
{
|
|
302
|
+
if (m_data[0].re[0]._mpfr_d)
|
|
303
|
+
mpc_clear(m_data);
|
|
304
|
+
}
|
|
305
|
+
void negate() noexcept
|
|
306
|
+
{
|
|
307
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d);
|
|
308
|
+
mpc_neg(m_data, m_data, GMP_RNDN);
|
|
309
|
+
}
|
|
310
|
+
int compare(const mpc_complex_imp& o) const noexcept
|
|
311
|
+
{
|
|
312
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d && o.m_data[0].re[0]._mpfr_d);
|
|
313
|
+
return mpc_cmp(m_data, o.m_data);
|
|
314
|
+
}
|
|
315
|
+
int compare(const mpc_complex_backend<digits10>& o) const noexcept
|
|
316
|
+
{
|
|
317
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d && o.m_data[0].re[0]._mpfr_d);
|
|
318
|
+
return mpc_cmp(m_data, o.data());
|
|
319
|
+
}
|
|
320
|
+
int compare(long int i) const noexcept
|
|
321
|
+
{
|
|
322
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d);
|
|
323
|
+
return mpc_cmp_si(m_data, i);
|
|
324
|
+
}
|
|
325
|
+
int compare(unsigned long int i) const noexcept
|
|
326
|
+
{
|
|
327
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d);
|
|
328
|
+
constexpr const unsigned long int max_val = (std::numeric_limits<long>::max)();
|
|
329
|
+
if (i > max_val)
|
|
330
|
+
{
|
|
331
|
+
mpc_complex_imp d(mpc_get_prec(m_data));
|
|
332
|
+
d = i;
|
|
333
|
+
return compare(d);
|
|
334
|
+
}
|
|
335
|
+
return mpc_cmp_si(m_data, static_cast<long>(i));
|
|
336
|
+
}
|
|
337
|
+
template <class V>
|
|
338
|
+
int compare(const V& v) const noexcept
|
|
339
|
+
{
|
|
340
|
+
mpc_complex_imp d(mpc_get_prec(m_data));
|
|
341
|
+
d = v;
|
|
342
|
+
return compare(d);
|
|
343
|
+
}
|
|
344
|
+
mpc_t& data() noexcept
|
|
345
|
+
{
|
|
346
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d);
|
|
347
|
+
return m_data;
|
|
348
|
+
}
|
|
349
|
+
const mpc_t& data() const noexcept
|
|
350
|
+
{
|
|
351
|
+
BOOST_MP_ASSERT(m_data[0].re[0]._mpfr_d);
|
|
352
|
+
return m_data;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
protected:
|
|
356
|
+
mpc_t m_data;
|
|
357
|
+
static boost::multiprecision::detail::precision_type& get_global_default_precision() noexcept
|
|
358
|
+
{
|
|
359
|
+
static boost::multiprecision::detail::precision_type val(BOOST_MULTIPRECISION_MPFI_DEFAULT_PRECISION);
|
|
360
|
+
return val;
|
|
361
|
+
}
|
|
362
|
+
static unsigned& get_default_precision() noexcept
|
|
363
|
+
{
|
|
364
|
+
static BOOST_MP_THREAD_LOCAL unsigned val(get_global_default_precision());
|
|
365
|
+
return val;
|
|
366
|
+
}
|
|
367
|
+
#ifndef BOOST_MT_NO_ATOMIC_INT
|
|
368
|
+
static std::atomic<variable_precision_options>& get_global_default_options() noexcept
|
|
369
|
+
#else
|
|
370
|
+
static variable_precision_options& get_global_default_options() noexcept
|
|
371
|
+
#endif
|
|
372
|
+
{
|
|
373
|
+
#ifndef BOOST_MT_NO_ATOMIC_INT
|
|
374
|
+
static std::atomic<variable_precision_options> val{variable_precision_options::preserve_related_precision};
|
|
375
|
+
#else
|
|
376
|
+
static variable_precision_options val{variable_precision_options::preserve_related_precision};
|
|
377
|
+
#endif
|
|
378
|
+
return val;
|
|
379
|
+
}
|
|
380
|
+
static variable_precision_options& get_default_options() noexcept
|
|
381
|
+
{
|
|
382
|
+
static BOOST_MP_THREAD_LOCAL variable_precision_options val(get_global_default_options());
|
|
383
|
+
return val;
|
|
384
|
+
}
|
|
385
|
+
static bool preserve_source_precision() noexcept
|
|
386
|
+
{
|
|
387
|
+
return get_default_options() >= variable_precision_options::preserve_source_precision;
|
|
388
|
+
}
|
|
389
|
+
static bool preserve_component_precision() noexcept
|
|
390
|
+
{
|
|
391
|
+
return get_default_options() >= variable_precision_options::preserve_component_precision;
|
|
392
|
+
}
|
|
393
|
+
static bool preserve_related_precision() noexcept
|
|
394
|
+
{
|
|
395
|
+
return get_default_options() >= variable_precision_options::preserve_related_precision;
|
|
396
|
+
}
|
|
397
|
+
static bool preserve_all_precision() noexcept
|
|
398
|
+
{
|
|
399
|
+
return get_default_options() >= variable_precision_options::preserve_all_precision;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
} // namespace detail
|
|
404
|
+
|
|
405
|
+
template <unsigned digits10>
|
|
406
|
+
struct mpc_complex_backend : public detail::mpc_complex_imp<digits10>
|
|
407
|
+
{
|
|
408
|
+
mpc_complex_backend() : detail::mpc_complex_imp<digits10>() {}
|
|
409
|
+
mpc_complex_backend(const mpc_complex_backend& o) : detail::mpc_complex_imp<digits10>(o) {}
|
|
410
|
+
// rvalue copy
|
|
411
|
+
mpc_complex_backend(mpc_complex_backend&& o) : detail::mpc_complex_imp<digits10>(static_cast<detail::mpc_complex_imp<digits10>&&>(o))
|
|
412
|
+
{}
|
|
413
|
+
template <unsigned D>
|
|
414
|
+
mpc_complex_backend(const mpc_complex_backend<D>& val, typename std::enable_if<D <= digits10>::type* = nullptr)
|
|
415
|
+
: detail::mpc_complex_imp<digits10>()
|
|
416
|
+
{
|
|
417
|
+
mpc_set(this->m_data, val.data(), GMP_RNDN);
|
|
418
|
+
}
|
|
419
|
+
template <unsigned D>
|
|
420
|
+
explicit mpc_complex_backend(const mpc_complex_backend<D>& val, typename std::enable_if<!(D <= digits10)>::type* = nullptr)
|
|
421
|
+
: detail::mpc_complex_imp<digits10>()
|
|
422
|
+
{
|
|
423
|
+
mpc_set(this->m_data, val.data(), GMP_RNDN);
|
|
424
|
+
}
|
|
425
|
+
mpc_complex_backend(const mpc_t val)
|
|
426
|
+
: detail::mpc_complex_imp<digits10>()
|
|
427
|
+
{
|
|
428
|
+
mpc_set(this->m_data, val, GMP_RNDN);
|
|
429
|
+
}
|
|
430
|
+
mpc_complex_backend(const std::complex<float>& val)
|
|
431
|
+
: detail::mpc_complex_imp<digits10>()
|
|
432
|
+
{
|
|
433
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
434
|
+
}
|
|
435
|
+
mpc_complex_backend(const std::complex<double>& val)
|
|
436
|
+
: detail::mpc_complex_imp<digits10>()
|
|
437
|
+
{
|
|
438
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
439
|
+
}
|
|
440
|
+
mpc_complex_backend(const std::complex<long double>& val)
|
|
441
|
+
: detail::mpc_complex_imp<digits10>()
|
|
442
|
+
{
|
|
443
|
+
mpc_set_ld_ld(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
444
|
+
}
|
|
445
|
+
mpc_complex_backend(mpz_srcptr val) : detail::mpc_complex_imp<digits10>()
|
|
446
|
+
{
|
|
447
|
+
mpc_set_z(this->m_data, val, GMP_RNDN);
|
|
448
|
+
}
|
|
449
|
+
mpc_complex_backend& operator=(mpz_srcptr val)
|
|
450
|
+
{
|
|
451
|
+
mpc_set_z(this->m_data, val, GMP_RNDN);
|
|
452
|
+
return *this;
|
|
453
|
+
}
|
|
454
|
+
mpc_complex_backend(gmp_int const& val) : detail::mpc_complex_imp<digits10>()
|
|
455
|
+
{
|
|
456
|
+
mpc_set_z(this->m_data, val.data(), GMP_RNDN);
|
|
457
|
+
}
|
|
458
|
+
mpc_complex_backend& operator=(gmp_int const& val)
|
|
459
|
+
{
|
|
460
|
+
mpc_set_z(this->m_data, val.data(), GMP_RNDN);
|
|
461
|
+
return *this;
|
|
462
|
+
}
|
|
463
|
+
mpc_complex_backend(mpf_srcptr val) : detail::mpc_complex_imp<digits10>()
|
|
464
|
+
{
|
|
465
|
+
mpc_set_f(this->m_data, val, GMP_RNDN);
|
|
466
|
+
}
|
|
467
|
+
mpc_complex_backend& operator=(mpf_srcptr val)
|
|
468
|
+
{
|
|
469
|
+
mpc_set_f(this->m_data, val, GMP_RNDN);
|
|
470
|
+
return *this;
|
|
471
|
+
}
|
|
472
|
+
template <unsigned D10>
|
|
473
|
+
mpc_complex_backend(gmp_float<D10> const& val) : detail::mpc_complex_imp<digits10>()
|
|
474
|
+
{
|
|
475
|
+
mpc_set_f(this->m_data, val.data(), GMP_RNDN);
|
|
476
|
+
}
|
|
477
|
+
template <unsigned D10>
|
|
478
|
+
mpc_complex_backend& operator=(gmp_float<D10> const& val)
|
|
479
|
+
{
|
|
480
|
+
mpc_set_f(this->m_data, val.data(), GMP_RNDN);
|
|
481
|
+
return *this;
|
|
482
|
+
}
|
|
483
|
+
mpc_complex_backend(mpq_srcptr val) : detail::mpc_complex_imp<digits10>()
|
|
484
|
+
{
|
|
485
|
+
mpc_set_q(this->m_data, val, GMP_RNDN);
|
|
486
|
+
}
|
|
487
|
+
mpc_complex_backend& operator=(mpq_srcptr val)
|
|
488
|
+
{
|
|
489
|
+
mpc_set_q(this->m_data, val, GMP_RNDN);
|
|
490
|
+
return *this;
|
|
491
|
+
}
|
|
492
|
+
mpc_complex_backend(gmp_rational const& val) : detail::mpc_complex_imp<digits10>()
|
|
493
|
+
{
|
|
494
|
+
mpc_set_q(this->m_data, val.data(), GMP_RNDN);
|
|
495
|
+
}
|
|
496
|
+
mpc_complex_backend& operator=(gmp_rational const& val)
|
|
497
|
+
{
|
|
498
|
+
mpc_set_q(this->m_data, val.data(), GMP_RNDN);
|
|
499
|
+
return *this;
|
|
500
|
+
}
|
|
501
|
+
mpc_complex_backend(mpfr_srcptr val) : detail::mpc_complex_imp<digits10>()
|
|
502
|
+
{
|
|
503
|
+
mpc_set_fr(this->m_data, val, GMP_RNDN);
|
|
504
|
+
}
|
|
505
|
+
mpc_complex_backend& operator=(mpfr_srcptr val)
|
|
506
|
+
{
|
|
507
|
+
mpc_set_fr(this->m_data, val, GMP_RNDN);
|
|
508
|
+
return *this;
|
|
509
|
+
}
|
|
510
|
+
template <unsigned D10, mpfr_allocation_type AllocationType>
|
|
511
|
+
mpc_complex_backend(mpfr_float_backend<D10, AllocationType> const& val, typename std::enable_if<D10 <= digits10>::type* = nullptr) : detail::mpc_complex_imp<digits10>()
|
|
512
|
+
{
|
|
513
|
+
mpc_set_fr(this->m_data, val.data(), GMP_RNDN);
|
|
514
|
+
}
|
|
515
|
+
template <unsigned D10, mpfr_allocation_type AllocationType>
|
|
516
|
+
explicit mpc_complex_backend(mpfr_float_backend<D10, AllocationType> const& val, typename std::enable_if<!(D10 <= digits10)>::type* = nullptr) : detail::mpc_complex_imp<digits10>()
|
|
517
|
+
{
|
|
518
|
+
mpc_set_fr(this->m_data, val.data(), GMP_RNDN);
|
|
519
|
+
}
|
|
520
|
+
template <unsigned D10, mpfr_allocation_type AllocationType>
|
|
521
|
+
mpc_complex_backend& operator=(mpfr_float_backend<D10, AllocationType> const& val)
|
|
522
|
+
{
|
|
523
|
+
mpc_set_fr(this->m_data, val.data(), GMP_RNDN);
|
|
524
|
+
return *this;
|
|
525
|
+
}
|
|
526
|
+
mpc_complex_backend& operator=(const mpc_complex_backend& o)
|
|
527
|
+
{
|
|
528
|
+
*static_cast<detail::mpc_complex_imp<digits10>*>(this) = static_cast<detail::mpc_complex_imp<digits10> const&>(o);
|
|
529
|
+
return *this;
|
|
530
|
+
}
|
|
531
|
+
// rvalue assign
|
|
532
|
+
mpc_complex_backend& operator=(mpc_complex_backend&& o) noexcept
|
|
533
|
+
{
|
|
534
|
+
*static_cast<detail::mpc_complex_imp<digits10>*>(this) = static_cast<detail::mpc_complex_imp<digits10>&&>(o);
|
|
535
|
+
return *this;
|
|
536
|
+
}
|
|
537
|
+
template <class V>
|
|
538
|
+
typename std::enable_if<std::is_assignable<detail::mpc_complex_imp<digits10>, V>::value, mpc_complex_backend&>::type operator=(const V& v)
|
|
539
|
+
{
|
|
540
|
+
*static_cast<detail::mpc_complex_imp<digits10>*>(this) = v;
|
|
541
|
+
return *this;
|
|
542
|
+
}
|
|
543
|
+
mpc_complex_backend& operator=(const mpc_t val)
|
|
544
|
+
{
|
|
545
|
+
mpc_set(this->m_data, val, GMP_RNDN);
|
|
546
|
+
return *this;
|
|
547
|
+
}
|
|
548
|
+
mpc_complex_backend& operator=(const std::complex<float>& val)
|
|
549
|
+
{
|
|
550
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
551
|
+
return *this;
|
|
552
|
+
}
|
|
553
|
+
mpc_complex_backend& operator=(const std::complex<double>& val)
|
|
554
|
+
{
|
|
555
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
556
|
+
return *this;
|
|
557
|
+
}
|
|
558
|
+
mpc_complex_backend& operator=(const std::complex<long double>& val)
|
|
559
|
+
{
|
|
560
|
+
mpc_set_ld_ld(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
561
|
+
return *this;
|
|
562
|
+
}
|
|
563
|
+
// We don't change our precision here, this is a fixed precision type:
|
|
564
|
+
template <unsigned D>
|
|
565
|
+
mpc_complex_backend& operator=(const mpc_complex_backend<D>& val)
|
|
566
|
+
{
|
|
567
|
+
mpc_set(this->m_data, val.data(), GMP_RNDN);
|
|
568
|
+
return *this;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
template <>
|
|
573
|
+
struct mpc_complex_backend<0> : public detail::mpc_complex_imp<0>
|
|
574
|
+
{
|
|
575
|
+
mpc_complex_backend() : detail::mpc_complex_imp<0>() {}
|
|
576
|
+
mpc_complex_backend(const mpc_t val)
|
|
577
|
+
: detail::mpc_complex_imp<0>(mpc_get_prec(val))
|
|
578
|
+
{
|
|
579
|
+
mpc_set(this->m_data, val, GMP_RNDN);
|
|
580
|
+
}
|
|
581
|
+
mpc_complex_backend(const mpc_complex_backend& o) : detail::mpc_complex_imp<0>(o) {}
|
|
582
|
+
// rvalue copy
|
|
583
|
+
mpc_complex_backend(mpc_complex_backend&& o) noexcept : detail::mpc_complex_imp<0>(static_cast<detail::mpc_complex_imp<0>&&>(o))
|
|
584
|
+
{}
|
|
585
|
+
mpc_complex_backend(const mpc_complex_backend& o, unsigned digits10)
|
|
586
|
+
: detail::mpc_complex_imp<0>(multiprecision::detail::digits10_2_2(digits10))
|
|
587
|
+
{
|
|
588
|
+
mpc_set(this->m_data, o.data(), GMP_RNDN);
|
|
589
|
+
}
|
|
590
|
+
template <unsigned D>
|
|
591
|
+
mpc_complex_backend(const mpc_complex_backend<D>& val)
|
|
592
|
+
: detail::mpc_complex_imp<0>(preserve_related_precision() ? mpc_get_prec(val.data()) : multiprecision::detail::digits10_2_2(get_default_precision()))
|
|
593
|
+
{
|
|
594
|
+
mpc_set(this->m_data, val.data(), GMP_RNDN);
|
|
595
|
+
}
|
|
596
|
+
template <unsigned D>
|
|
597
|
+
mpc_complex_backend(const mpfr_float_backend<D>& val)
|
|
598
|
+
: detail::mpc_complex_imp<0>((D == 0 ? this->preserve_component_precision() : this->preserve_related_precision()) ? mpfr_get_prec(val.data()) : multiprecision::detail::digits10_2_2(this->get_default_precision()))
|
|
599
|
+
{
|
|
600
|
+
mpc_set_fr(this->m_data, val.data(), GMP_RNDN);
|
|
601
|
+
}
|
|
602
|
+
mpc_complex_backend(mpz_srcptr val) : detail::mpc_complex_imp<0>()
|
|
603
|
+
{
|
|
604
|
+
mpc_set_z(this->m_data, val, GMP_RNDN);
|
|
605
|
+
}
|
|
606
|
+
mpc_complex_backend& operator=(mpz_srcptr val)
|
|
607
|
+
{
|
|
608
|
+
mpc_set_z(this->m_data, val, GMP_RNDN);
|
|
609
|
+
return *this;
|
|
610
|
+
}
|
|
611
|
+
mpc_complex_backend(gmp_int const& val) : detail::mpc_complex_imp<0>(preserve_all_precision() ? used_gmp_int_bits(val) : boost::multiprecision::detail::digits10_2_2(thread_default_precision()))
|
|
612
|
+
{
|
|
613
|
+
mpc_set_z(this->m_data, val.data(), GMP_RNDN);
|
|
614
|
+
}
|
|
615
|
+
mpc_complex_backend& operator=(gmp_int const& val)
|
|
616
|
+
{
|
|
617
|
+
if (this->m_data[0].im->_mpfr_d == nullptr)
|
|
618
|
+
{
|
|
619
|
+
unsigned requested_precision = this->thread_default_precision();
|
|
620
|
+
if (thread_default_variable_precision_options() >= variable_precision_options::preserve_all_precision)
|
|
621
|
+
{
|
|
622
|
+
unsigned d2 = used_gmp_int_bits(val);
|
|
623
|
+
unsigned d10 = 1 + multiprecision::detail::digits2_2_10(d2);
|
|
624
|
+
if (d10 > requested_precision)
|
|
625
|
+
requested_precision = d10;
|
|
626
|
+
}
|
|
627
|
+
mpc_init2(this->m_data, multiprecision::detail::digits10_2_2(requested_precision));
|
|
628
|
+
}
|
|
629
|
+
else if (thread_default_variable_precision_options() >= variable_precision_options::preserve_all_precision)
|
|
630
|
+
{
|
|
631
|
+
unsigned requested_precision = this->thread_default_precision();
|
|
632
|
+
unsigned d2 = used_gmp_int_bits(val);
|
|
633
|
+
unsigned d10 = 1 + multiprecision::detail::digits2_2_10(d2);
|
|
634
|
+
if (d10 > requested_precision)
|
|
635
|
+
this->precision(d10);
|
|
636
|
+
}
|
|
637
|
+
mpc_set_z(this->m_data, val.data(), GMP_RNDN);
|
|
638
|
+
return *this;
|
|
639
|
+
}
|
|
640
|
+
mpc_complex_backend(mpf_srcptr val) : detail::mpc_complex_imp<0>((unsigned)mpf_get_prec(val))
|
|
641
|
+
{
|
|
642
|
+
mpc_set_f(this->m_data, val, GMP_RNDN);
|
|
643
|
+
}
|
|
644
|
+
mpc_complex_backend& operator=(mpf_srcptr val)
|
|
645
|
+
{
|
|
646
|
+
if ((mp_bitcnt_t)mpc_get_prec(data()) != mpf_get_prec(val))
|
|
647
|
+
{
|
|
648
|
+
mpc_complex_backend t(val);
|
|
649
|
+
t.swap(*this);
|
|
650
|
+
}
|
|
651
|
+
else
|
|
652
|
+
mpc_set_f(this->m_data, val, GMP_RNDN);
|
|
653
|
+
return *this;
|
|
654
|
+
}
|
|
655
|
+
template <unsigned digits10>
|
|
656
|
+
mpc_complex_backend(gmp_float<digits10> const& val) : detail::mpc_complex_imp<0>(preserve_all_precision() ? (unsigned)mpf_get_prec(val.data()) : multiprecision::detail::digits10_2_2(get_default_precision()))
|
|
657
|
+
{
|
|
658
|
+
mpc_set_f(this->m_data, val.data(), GMP_RNDN);
|
|
659
|
+
}
|
|
660
|
+
template <unsigned digits10>
|
|
661
|
+
mpc_complex_backend& operator=(gmp_float<digits10> const& val)
|
|
662
|
+
{
|
|
663
|
+
if (preserve_all_precision() && (mpc_get_prec(data()) != (mpfr_prec_t)mpf_get_prec(val.data())))
|
|
664
|
+
{
|
|
665
|
+
mpc_complex_backend t(val);
|
|
666
|
+
t.swap(*this);
|
|
667
|
+
}
|
|
668
|
+
else
|
|
669
|
+
mpc_set_f(this->m_data, val.data(), GMP_RNDN);
|
|
670
|
+
return *this;
|
|
671
|
+
}
|
|
672
|
+
mpc_complex_backend(mpq_srcptr val) : detail::mpc_complex_imp<0>()
|
|
673
|
+
{
|
|
674
|
+
mpc_set_q(this->m_data, val, GMP_RNDN);
|
|
675
|
+
}
|
|
676
|
+
mpc_complex_backend& operator=(mpq_srcptr val)
|
|
677
|
+
{
|
|
678
|
+
mpc_set_q(this->m_data, val, GMP_RNDN);
|
|
679
|
+
return *this;
|
|
680
|
+
}
|
|
681
|
+
mpc_complex_backend(gmp_rational const& val) : detail::mpc_complex_imp<0>(preserve_all_precision() ? used_gmp_rational_bits(val) : boost::multiprecision::detail::digits10_2_2(thread_default_precision()))
|
|
682
|
+
{
|
|
683
|
+
mpc_set_q(this->m_data, val.data(), GMP_RNDN);
|
|
684
|
+
}
|
|
685
|
+
mpc_complex_backend& operator=(gmp_rational const& val)
|
|
686
|
+
{
|
|
687
|
+
if (this->m_data[0].im->_mpfr_d == nullptr)
|
|
688
|
+
{
|
|
689
|
+
unsigned requested_precision = this->get_default_precision();
|
|
690
|
+
if (thread_default_variable_precision_options() >= variable_precision_options::preserve_all_precision)
|
|
691
|
+
{
|
|
692
|
+
unsigned d10 = 1 + multiprecision::detail::digits2_2_10(used_gmp_rational_bits(val));
|
|
693
|
+
if (d10 > requested_precision)
|
|
694
|
+
requested_precision = d10;
|
|
695
|
+
}
|
|
696
|
+
mpc_init2(this->m_data, multiprecision::detail::digits10_2_2(requested_precision));
|
|
697
|
+
}
|
|
698
|
+
else if (thread_default_variable_precision_options() >= variable_precision_options::preserve_all_precision)
|
|
699
|
+
{
|
|
700
|
+
unsigned requested_precision = this->get_default_precision();
|
|
701
|
+
unsigned d10 = 1 + multiprecision::detail::digits2_2_10(used_gmp_rational_bits(val));
|
|
702
|
+
if (d10 > requested_precision)
|
|
703
|
+
this->precision(d10);
|
|
704
|
+
}
|
|
705
|
+
mpc_set_q(this->m_data, val.data(), GMP_RNDN);
|
|
706
|
+
return *this;
|
|
707
|
+
}
|
|
708
|
+
mpc_complex_backend(mpfr_srcptr val) : detail::mpc_complex_imp<0>(mpfr_get_prec(val))
|
|
709
|
+
{
|
|
710
|
+
mpc_set_fr(this->m_data, val, GMP_RNDN);
|
|
711
|
+
}
|
|
712
|
+
mpc_complex_backend& operator=(mpfr_srcptr val)
|
|
713
|
+
{
|
|
714
|
+
if (mpc_get_prec(data()) != mpfr_get_prec(val))
|
|
715
|
+
{
|
|
716
|
+
mpc_complex_backend t(val);
|
|
717
|
+
t.swap(*this);
|
|
718
|
+
}
|
|
719
|
+
else
|
|
720
|
+
mpc_set_fr(this->m_data, val, GMP_RNDN);
|
|
721
|
+
return *this;
|
|
722
|
+
}
|
|
723
|
+
mpc_complex_backend(const std::complex<float>& val)
|
|
724
|
+
: detail::mpc_complex_imp<0>()
|
|
725
|
+
{
|
|
726
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
727
|
+
}
|
|
728
|
+
mpc_complex_backend(const std::complex<double>& val)
|
|
729
|
+
: detail::mpc_complex_imp<0>()
|
|
730
|
+
{
|
|
731
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
732
|
+
}
|
|
733
|
+
mpc_complex_backend(const std::complex<long double>& val)
|
|
734
|
+
: detail::mpc_complex_imp<0>()
|
|
735
|
+
{
|
|
736
|
+
mpc_set_ld_ld(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
737
|
+
}
|
|
738
|
+
// Construction with precision:
|
|
739
|
+
template <class T, class U>
|
|
740
|
+
mpc_complex_backend(const T& a, const U& b, unsigned digits10)
|
|
741
|
+
: detail::mpc_complex_imp<0>(multiprecision::detail::digits10_2_2(digits10))
|
|
742
|
+
{
|
|
743
|
+
// We can't use assign_components here because it copies the precision of
|
|
744
|
+
// a and b, not digits10....
|
|
745
|
+
boost::multiprecision::detail::scoped_precision_options<mpfr_float> scoped(*this);
|
|
746
|
+
(void)scoped;
|
|
747
|
+
mpfr_float ca(a), cb(b);
|
|
748
|
+
mpc_set_fr_fr(this->data(), ca.backend().data(), cb.backend().data(), GMP_RNDN);
|
|
749
|
+
}
|
|
750
|
+
template <unsigned N>
|
|
751
|
+
mpc_complex_backend(const mpfr_float_backend<N>& a, const mpfr_float_backend<N>& b, unsigned digits10)
|
|
752
|
+
: detail::mpc_complex_imp<0>(multiprecision::detail::digits10_2_2(digits10))
|
|
753
|
+
{
|
|
754
|
+
mpc_set_fr_fr(this->data(), a.data(), b.data(), GMP_RNDN);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
mpc_complex_backend& operator=(const mpc_complex_backend& o) = default;
|
|
758
|
+
// rvalue assign
|
|
759
|
+
mpc_complex_backend& operator=(mpc_complex_backend&& o) noexcept = default;
|
|
760
|
+
|
|
761
|
+
template <class V>
|
|
762
|
+
mpc_complex_backend& operator=(const V& v)
|
|
763
|
+
{
|
|
764
|
+
constexpr unsigned d10 = std::is_floating_point<V>::value ?
|
|
765
|
+
std::numeric_limits<V>::digits10 :
|
|
766
|
+
std::numeric_limits<V>::digits10 ? 1 + std::numeric_limits<V>::digits10 :
|
|
767
|
+
1 + boost::multiprecision::detail::digits2_2_10(std::numeric_limits<V>::digits);
|
|
768
|
+
|
|
769
|
+
if (thread_default_variable_precision_options() >= variable_precision_options::preserve_all_precision)
|
|
770
|
+
{
|
|
771
|
+
BOOST_IF_CONSTEXPR(std::is_floating_point<V>::value)
|
|
772
|
+
{
|
|
773
|
+
if (std::numeric_limits<V>::digits > mpc_get_prec(this->data()))
|
|
774
|
+
mpc_set_prec(this->data(), std::numeric_limits<V>::digits);
|
|
775
|
+
}
|
|
776
|
+
else
|
|
777
|
+
{
|
|
778
|
+
if (precision() < d10)
|
|
779
|
+
this->precision(d10);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
*static_cast<detail::mpc_complex_imp<0>*>(this) = v;
|
|
784
|
+
return *this;
|
|
785
|
+
}
|
|
786
|
+
mpc_complex_backend& operator=(const mpc_t val)
|
|
787
|
+
{
|
|
788
|
+
mpc_set_prec(this->m_data, mpc_get_prec(val));
|
|
789
|
+
mpc_set(this->m_data, val, GMP_RNDN);
|
|
790
|
+
return *this;
|
|
791
|
+
}
|
|
792
|
+
template <unsigned D>
|
|
793
|
+
mpc_complex_backend& operator=(const mpc_complex_backend<D>& val)
|
|
794
|
+
{
|
|
795
|
+
mpc_set_prec(this->m_data, mpc_get_prec(val.data()));
|
|
796
|
+
mpc_set(this->m_data, val.data(), GMP_RNDN);
|
|
797
|
+
return *this;
|
|
798
|
+
}
|
|
799
|
+
template <unsigned D>
|
|
800
|
+
mpc_complex_backend& operator=(const mpfr_float_backend<D>& val)
|
|
801
|
+
{
|
|
802
|
+
if (D == 0 ? this->preserve_component_precision() : this->preserve_related_precision())
|
|
803
|
+
mpc_set_prec(this->m_data, mpfr_get_prec(val.data()));
|
|
804
|
+
mpc_set_fr(this->m_data, val.data(), GMP_RNDN);
|
|
805
|
+
return *this;
|
|
806
|
+
}
|
|
807
|
+
mpc_complex_backend& operator=(const std::complex<float>& val)
|
|
808
|
+
{
|
|
809
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
810
|
+
return *this;
|
|
811
|
+
}
|
|
812
|
+
mpc_complex_backend& operator=(const std::complex<double>& val)
|
|
813
|
+
{
|
|
814
|
+
mpc_set_d_d(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
815
|
+
return *this;
|
|
816
|
+
}
|
|
817
|
+
mpc_complex_backend& operator=(const std::complex<long double>& val)
|
|
818
|
+
{
|
|
819
|
+
mpc_set_ld_ld(this->m_data, val.real(), val.imag(), GMP_RNDN);
|
|
820
|
+
return *this;
|
|
821
|
+
}
|
|
822
|
+
static unsigned default_precision() noexcept
|
|
823
|
+
{
|
|
824
|
+
return get_global_default_precision();
|
|
825
|
+
}
|
|
826
|
+
static void default_precision(unsigned v) noexcept
|
|
827
|
+
{
|
|
828
|
+
get_global_default_precision() = v;
|
|
829
|
+
}
|
|
830
|
+
static unsigned thread_default_precision() noexcept
|
|
831
|
+
{
|
|
832
|
+
return get_default_precision();
|
|
833
|
+
}
|
|
834
|
+
static void thread_default_precision(unsigned v) noexcept
|
|
835
|
+
{
|
|
836
|
+
get_default_precision() = v;
|
|
837
|
+
}
|
|
838
|
+
unsigned precision() const noexcept
|
|
839
|
+
{
|
|
840
|
+
return multiprecision::detail::digits2_2_10(mpc_get_prec(this->m_data));
|
|
841
|
+
}
|
|
842
|
+
void precision(unsigned digits10) noexcept
|
|
843
|
+
{
|
|
844
|
+
mpfr_prec_round(mpc_realref(this->m_data), multiprecision::detail::digits10_2_2((digits10)), GMP_RNDN);
|
|
845
|
+
mpfr_prec_round(mpc_imagref(this->m_data), multiprecision::detail::digits10_2_2((digits10)), GMP_RNDN);
|
|
846
|
+
}
|
|
847
|
+
//
|
|
848
|
+
// Variable precision options:
|
|
849
|
+
//
|
|
850
|
+
static variable_precision_options default_variable_precision_options() noexcept
|
|
851
|
+
{
|
|
852
|
+
return get_global_default_options();
|
|
853
|
+
}
|
|
854
|
+
static variable_precision_options thread_default_variable_precision_options() noexcept
|
|
855
|
+
{
|
|
856
|
+
return get_default_options();
|
|
857
|
+
}
|
|
858
|
+
static void default_variable_precision_options(variable_precision_options opts)
|
|
859
|
+
{
|
|
860
|
+
get_global_default_options() = opts;
|
|
861
|
+
}
|
|
862
|
+
static void thread_default_variable_precision_options(variable_precision_options opts)
|
|
863
|
+
{
|
|
864
|
+
get_default_options() = opts;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
template <unsigned digits10, class T>
|
|
869
|
+
inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_eq(const mpc_complex_backend<digits10>& a, const T& b) noexcept
|
|
870
|
+
{
|
|
871
|
+
return a.compare(b) == 0;
|
|
872
|
+
}
|
|
873
|
+
template <unsigned digits10, class T>
|
|
874
|
+
inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_lt(const mpc_complex_backend<digits10>& a, const T& b) noexcept
|
|
875
|
+
{
|
|
876
|
+
return a.compare(b) < 0;
|
|
877
|
+
}
|
|
878
|
+
template <unsigned digits10, class T>
|
|
879
|
+
inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_gt(const mpc_complex_backend<digits10>& a, const T& b) noexcept
|
|
880
|
+
{
|
|
881
|
+
return a.compare(b) > 0;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
template <unsigned D1, unsigned D2>
|
|
885
|
+
inline void eval_add(mpc_complex_backend<D1>& result, const mpc_complex_backend<D2>& o)
|
|
886
|
+
{
|
|
887
|
+
mpc_add(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
888
|
+
}
|
|
889
|
+
template <unsigned D1, unsigned D2>
|
|
890
|
+
inline void eval_add(mpc_complex_backend<D1>& result, const mpfr_float_backend<D2>& o)
|
|
891
|
+
{
|
|
892
|
+
mpc_add_fr(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
893
|
+
}
|
|
894
|
+
template <unsigned D1, unsigned D2>
|
|
895
|
+
inline void eval_subtract(mpc_complex_backend<D1>& result, const mpc_complex_backend<D2>& o)
|
|
896
|
+
{
|
|
897
|
+
mpc_sub(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
898
|
+
}
|
|
899
|
+
template <unsigned D1, unsigned D2>
|
|
900
|
+
inline void eval_subtract(mpc_complex_backend<D1>& result, const mpfr_float_backend<D2>& o)
|
|
901
|
+
{
|
|
902
|
+
mpc_sub_fr(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
903
|
+
}
|
|
904
|
+
template <unsigned D1, unsigned D2>
|
|
905
|
+
inline void eval_multiply(mpc_complex_backend<D1>& result, const mpc_complex_backend<D2>& o)
|
|
906
|
+
{
|
|
907
|
+
if ((void*)&result == (void*)&o)
|
|
908
|
+
mpc_sqr(result.data(), o.data(), GMP_RNDN);
|
|
909
|
+
else
|
|
910
|
+
mpc_mul(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
911
|
+
}
|
|
912
|
+
template <unsigned D1, unsigned D2>
|
|
913
|
+
inline void eval_multiply(mpc_complex_backend<D1>& result, const mpfr_float_backend<D2>& o)
|
|
914
|
+
{
|
|
915
|
+
mpc_mul_fr(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
916
|
+
}
|
|
917
|
+
template <unsigned D1, unsigned D2>
|
|
918
|
+
inline void eval_divide(mpc_complex_backend<D1>& result, const mpc_complex_backend<D2>& o)
|
|
919
|
+
{
|
|
920
|
+
mpc_div(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
921
|
+
}
|
|
922
|
+
template <unsigned D1, unsigned D2>
|
|
923
|
+
inline void eval_divide(mpc_complex_backend<D1>& result, const mpfr_float_backend<D2>& o)
|
|
924
|
+
{
|
|
925
|
+
mpc_div_fr(result.data(), result.data(), o.data(), GMP_RNDN);
|
|
926
|
+
}
|
|
927
|
+
template <unsigned digits10>
|
|
928
|
+
inline void eval_add(mpc_complex_backend<digits10>& result, unsigned long i)
|
|
929
|
+
{
|
|
930
|
+
mpc_add_ui(result.data(), result.data(), i, GMP_RNDN);
|
|
931
|
+
}
|
|
932
|
+
template <unsigned digits10>
|
|
933
|
+
inline void eval_subtract(mpc_complex_backend<digits10>& result, unsigned long i)
|
|
934
|
+
{
|
|
935
|
+
mpc_sub_ui(result.data(), result.data(), i, GMP_RNDN);
|
|
936
|
+
}
|
|
937
|
+
template <unsigned digits10>
|
|
938
|
+
inline void eval_multiply(mpc_complex_backend<digits10>& result, unsigned long i)
|
|
939
|
+
{
|
|
940
|
+
mpc_mul_ui(result.data(), result.data(), i, GMP_RNDN);
|
|
941
|
+
}
|
|
942
|
+
template <unsigned digits10>
|
|
943
|
+
inline void eval_divide(mpc_complex_backend<digits10>& result, unsigned long i)
|
|
944
|
+
{
|
|
945
|
+
mpc_div_ui(result.data(), result.data(), i, GMP_RNDN);
|
|
946
|
+
}
|
|
947
|
+
template <unsigned digits10>
|
|
948
|
+
inline void eval_add(mpc_complex_backend<digits10>& result, long i)
|
|
949
|
+
{
|
|
950
|
+
if (i > 0)
|
|
951
|
+
mpc_add_ui(result.data(), result.data(), i, GMP_RNDN);
|
|
952
|
+
else
|
|
953
|
+
mpc_sub_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i), GMP_RNDN);
|
|
954
|
+
}
|
|
955
|
+
template <unsigned digits10>
|
|
956
|
+
inline void eval_subtract(mpc_complex_backend<digits10>& result, long i)
|
|
957
|
+
{
|
|
958
|
+
if (i > 0)
|
|
959
|
+
mpc_sub_ui(result.data(), result.data(), i, GMP_RNDN);
|
|
960
|
+
else
|
|
961
|
+
mpc_add_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i), GMP_RNDN);
|
|
962
|
+
}
|
|
963
|
+
template <unsigned digits10>
|
|
964
|
+
inline void eval_multiply(mpc_complex_backend<digits10>& result, long i)
|
|
965
|
+
{
|
|
966
|
+
mpc_mul_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i), GMP_RNDN);
|
|
967
|
+
if (i < 0)
|
|
968
|
+
mpc_neg(result.data(), result.data(), GMP_RNDN);
|
|
969
|
+
}
|
|
970
|
+
template <unsigned digits10>
|
|
971
|
+
inline void eval_divide(mpc_complex_backend<digits10>& result, long i)
|
|
972
|
+
{
|
|
973
|
+
mpc_div_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i), GMP_RNDN);
|
|
974
|
+
if (i < 0)
|
|
975
|
+
mpc_neg(result.data(), result.data(), GMP_RNDN);
|
|
976
|
+
}
|
|
977
|
+
//
|
|
978
|
+
// Specialised 3 arg versions of the basic operators:
|
|
979
|
+
//
|
|
980
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
981
|
+
inline void eval_add(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
982
|
+
{
|
|
983
|
+
mpc_add(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
984
|
+
}
|
|
985
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
986
|
+
inline void eval_add(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpfr_float_backend<D3>& y)
|
|
987
|
+
{
|
|
988
|
+
mpc_add_fr(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
989
|
+
}
|
|
990
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
991
|
+
inline void eval_add(mpc_complex_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
992
|
+
{
|
|
993
|
+
mpc_add_fr(a.data(), y.data(), x.data(), GMP_RNDN);
|
|
994
|
+
}
|
|
995
|
+
template <unsigned D1, unsigned D2>
|
|
996
|
+
inline void eval_add(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, unsigned long y)
|
|
997
|
+
{
|
|
998
|
+
mpc_add_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
999
|
+
}
|
|
1000
|
+
template <unsigned D1, unsigned D2>
|
|
1001
|
+
inline void eval_add(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, long y)
|
|
1002
|
+
{
|
|
1003
|
+
if (y < 0)
|
|
1004
|
+
mpc_sub_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y), GMP_RNDN);
|
|
1005
|
+
else
|
|
1006
|
+
mpc_add_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1007
|
+
}
|
|
1008
|
+
template <unsigned D1, unsigned D2>
|
|
1009
|
+
inline void eval_add(mpc_complex_backend<D1>& a, unsigned long x, const mpc_complex_backend<D2>& y)
|
|
1010
|
+
{
|
|
1011
|
+
mpc_add_ui(a.data(), y.data(), x, GMP_RNDN);
|
|
1012
|
+
}
|
|
1013
|
+
template <unsigned D1, unsigned D2>
|
|
1014
|
+
inline void eval_add(mpc_complex_backend<D1>& a, long x, const mpc_complex_backend<D2>& y)
|
|
1015
|
+
{
|
|
1016
|
+
if (x < 0)
|
|
1017
|
+
{
|
|
1018
|
+
mpc_ui_sub(a.data(), boost::multiprecision::detail::unsigned_abs(x), y.data(), GMP_RNDN);
|
|
1019
|
+
mpc_neg(a.data(), a.data(), GMP_RNDN);
|
|
1020
|
+
}
|
|
1021
|
+
else
|
|
1022
|
+
mpc_add_ui(a.data(), y.data(), x, GMP_RNDN);
|
|
1023
|
+
}
|
|
1024
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1025
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
1026
|
+
{
|
|
1027
|
+
mpc_sub(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1028
|
+
}
|
|
1029
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1030
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpfr_float_backend<D3>& y)
|
|
1031
|
+
{
|
|
1032
|
+
mpc_sub_fr(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1033
|
+
}
|
|
1034
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1035
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
1036
|
+
{
|
|
1037
|
+
mpc_fr_sub(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1038
|
+
}
|
|
1039
|
+
template <unsigned D1, unsigned D2>
|
|
1040
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, unsigned long y)
|
|
1041
|
+
{
|
|
1042
|
+
mpc_sub_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1043
|
+
}
|
|
1044
|
+
template <unsigned D1, unsigned D2>
|
|
1045
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, long y)
|
|
1046
|
+
{
|
|
1047
|
+
if (y < 0)
|
|
1048
|
+
mpc_add_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y), GMP_RNDN);
|
|
1049
|
+
else
|
|
1050
|
+
mpc_sub_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1051
|
+
}
|
|
1052
|
+
template <unsigned D1, unsigned D2>
|
|
1053
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, unsigned long x, const mpc_complex_backend<D2>& y)
|
|
1054
|
+
{
|
|
1055
|
+
mpc_ui_sub(a.data(), x, y.data(), GMP_RNDN);
|
|
1056
|
+
}
|
|
1057
|
+
template <unsigned D1, unsigned D2>
|
|
1058
|
+
inline void eval_subtract(mpc_complex_backend<D1>& a, long x, const mpc_complex_backend<D2>& y)
|
|
1059
|
+
{
|
|
1060
|
+
if (x < 0)
|
|
1061
|
+
{
|
|
1062
|
+
mpc_add_ui(a.data(), y.data(), boost::multiprecision::detail::unsigned_abs(x), GMP_RNDN);
|
|
1063
|
+
mpc_neg(a.data(), a.data(), GMP_RNDN);
|
|
1064
|
+
}
|
|
1065
|
+
else
|
|
1066
|
+
mpc_ui_sub(a.data(), x, y.data(), GMP_RNDN);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1070
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
1071
|
+
{
|
|
1072
|
+
if ((void*)&x == (void*)&y)
|
|
1073
|
+
mpc_sqr(a.data(), x.data(), GMP_RNDN);
|
|
1074
|
+
else
|
|
1075
|
+
mpc_mul(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1076
|
+
}
|
|
1077
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1078
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpfr_float_backend<D3>& y)
|
|
1079
|
+
{
|
|
1080
|
+
mpc_mul_fr(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1081
|
+
}
|
|
1082
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1083
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
1084
|
+
{
|
|
1085
|
+
mpc_mul_fr(a.data(), y.data(), x.data(), GMP_RNDN);
|
|
1086
|
+
}
|
|
1087
|
+
template <unsigned D1, unsigned D2>
|
|
1088
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, unsigned long y)
|
|
1089
|
+
{
|
|
1090
|
+
mpc_mul_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1091
|
+
}
|
|
1092
|
+
template <unsigned D1, unsigned D2>
|
|
1093
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, long y)
|
|
1094
|
+
{
|
|
1095
|
+
if (y < 0)
|
|
1096
|
+
{
|
|
1097
|
+
mpc_mul_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y), GMP_RNDN);
|
|
1098
|
+
a.negate();
|
|
1099
|
+
}
|
|
1100
|
+
else
|
|
1101
|
+
mpc_mul_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1102
|
+
}
|
|
1103
|
+
template <unsigned D1, unsigned D2>
|
|
1104
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, unsigned long x, const mpc_complex_backend<D2>& y)
|
|
1105
|
+
{
|
|
1106
|
+
mpc_mul_ui(a.data(), y.data(), x, GMP_RNDN);
|
|
1107
|
+
}
|
|
1108
|
+
template <unsigned D1, unsigned D2>
|
|
1109
|
+
inline void eval_multiply(mpc_complex_backend<D1>& a, long x, const mpc_complex_backend<D2>& y)
|
|
1110
|
+
{
|
|
1111
|
+
if (x < 0)
|
|
1112
|
+
{
|
|
1113
|
+
mpc_mul_ui(a.data(), y.data(), boost::multiprecision::detail::unsigned_abs(x), GMP_RNDN);
|
|
1114
|
+
mpc_neg(a.data(), a.data(), GMP_RNDN);
|
|
1115
|
+
}
|
|
1116
|
+
else
|
|
1117
|
+
mpc_mul_ui(a.data(), y.data(), x, GMP_RNDN);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1121
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
1122
|
+
{
|
|
1123
|
+
mpc_div(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1124
|
+
}
|
|
1125
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1126
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, const mpfr_float_backend<D3>& y)
|
|
1127
|
+
{
|
|
1128
|
+
mpc_div_fr(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1129
|
+
}
|
|
1130
|
+
template <unsigned D1, unsigned D2, unsigned D3>
|
|
1131
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpc_complex_backend<D3>& y)
|
|
1132
|
+
{
|
|
1133
|
+
mpc_fr_div(a.data(), x.data(), y.data(), GMP_RNDN);
|
|
1134
|
+
}
|
|
1135
|
+
template <unsigned D1, unsigned D2>
|
|
1136
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, unsigned long y)
|
|
1137
|
+
{
|
|
1138
|
+
mpc_div_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1139
|
+
}
|
|
1140
|
+
template <unsigned D1, unsigned D2>
|
|
1141
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, const mpc_complex_backend<D2>& x, long y)
|
|
1142
|
+
{
|
|
1143
|
+
if (y < 0)
|
|
1144
|
+
{
|
|
1145
|
+
mpc_div_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y), GMP_RNDN);
|
|
1146
|
+
a.negate();
|
|
1147
|
+
}
|
|
1148
|
+
else
|
|
1149
|
+
mpc_div_ui(a.data(), x.data(), y, GMP_RNDN);
|
|
1150
|
+
}
|
|
1151
|
+
template <unsigned D1, unsigned D2>
|
|
1152
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, unsigned long x, const mpc_complex_backend<D2>& y)
|
|
1153
|
+
{
|
|
1154
|
+
mpc_ui_div(a.data(), x, y.data(), GMP_RNDN);
|
|
1155
|
+
}
|
|
1156
|
+
template <unsigned D1, unsigned D2>
|
|
1157
|
+
inline void eval_divide(mpc_complex_backend<D1>& a, long x, const mpc_complex_backend<D2>& y)
|
|
1158
|
+
{
|
|
1159
|
+
if (x < 0)
|
|
1160
|
+
{
|
|
1161
|
+
mpc_ui_div(a.data(), boost::multiprecision::detail::unsigned_abs(x), y.data(), GMP_RNDN);
|
|
1162
|
+
mpc_neg(a.data(), a.data(), GMP_RNDN);
|
|
1163
|
+
}
|
|
1164
|
+
else
|
|
1165
|
+
mpc_ui_div(a.data(), x, y.data(), GMP_RNDN);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
template <unsigned digits10>
|
|
1169
|
+
inline bool eval_is_zero(const mpc_complex_backend<digits10>& val) noexcept
|
|
1170
|
+
{
|
|
1171
|
+
return (0 != mpfr_zero_p(mpc_realref(val.data()))) && (0 != mpfr_zero_p(mpc_imagref(val.data())));
|
|
1172
|
+
}
|
|
1173
|
+
template <unsigned digits10>
|
|
1174
|
+
inline int eval_get_sign(const mpc_complex_backend<digits10>&)
|
|
1175
|
+
{
|
|
1176
|
+
static_assert(digits10 == UINT_MAX, "Complex numbers have no sign bit."); // designed to always fail
|
|
1177
|
+
return 0;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
template <unsigned digits10>
|
|
1181
|
+
inline void eval_convert_to(unsigned long* result, const mpc_complex_backend<digits10>& val)
|
|
1182
|
+
{
|
|
1183
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1184
|
+
{
|
|
1185
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1186
|
+
}
|
|
1187
|
+
mpfr_float_backend<digits10> t;
|
|
1188
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1189
|
+
eval_convert_to(result, t);
|
|
1190
|
+
}
|
|
1191
|
+
template <unsigned digits10>
|
|
1192
|
+
inline void eval_convert_to(long* result, const mpc_complex_backend<digits10>& val)
|
|
1193
|
+
{
|
|
1194
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1195
|
+
{
|
|
1196
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1197
|
+
}
|
|
1198
|
+
mpfr_float_backend<digits10> t;
|
|
1199
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1200
|
+
eval_convert_to(result, t);
|
|
1201
|
+
}
|
|
1202
|
+
#ifdef _MPFR_H_HAVE_INTMAX_T
|
|
1203
|
+
template <unsigned digits10>
|
|
1204
|
+
inline void eval_convert_to(unsigned long long* result, const mpc_complex_backend<digits10>& val)
|
|
1205
|
+
{
|
|
1206
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1207
|
+
{
|
|
1208
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1209
|
+
}
|
|
1210
|
+
mpfr_float_backend<digits10> t;
|
|
1211
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1212
|
+
eval_convert_to(result, t);
|
|
1213
|
+
}
|
|
1214
|
+
template <unsigned digits10>
|
|
1215
|
+
inline void eval_convert_to(long long* result, const mpc_complex_backend<digits10>& val)
|
|
1216
|
+
{
|
|
1217
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1218
|
+
{
|
|
1219
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1220
|
+
}
|
|
1221
|
+
mpfr_float_backend<digits10> t;
|
|
1222
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1223
|
+
eval_convert_to(result, t);
|
|
1224
|
+
}
|
|
1225
|
+
#endif
|
|
1226
|
+
template <unsigned digits10>
|
|
1227
|
+
inline void eval_convert_to(double* result, const mpc_complex_backend<digits10>& val) noexcept
|
|
1228
|
+
{
|
|
1229
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1230
|
+
{
|
|
1231
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1232
|
+
}
|
|
1233
|
+
mpfr_float_backend<digits10> t;
|
|
1234
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1235
|
+
eval_convert_to(result, t);
|
|
1236
|
+
}
|
|
1237
|
+
template <unsigned digits10>
|
|
1238
|
+
inline void eval_convert_to(long double* result, const mpc_complex_backend<digits10>& val) noexcept
|
|
1239
|
+
{
|
|
1240
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1241
|
+
{
|
|
1242
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1243
|
+
}
|
|
1244
|
+
mpfr_float_backend<digits10> t;
|
|
1245
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1246
|
+
eval_convert_to(result, t);
|
|
1247
|
+
}
|
|
1248
|
+
#ifdef BOOST_HAS_INT128
|
|
1249
|
+
template <unsigned digits10>
|
|
1250
|
+
inline void eval_convert_to(uint128_type* result, const mpc_complex_backend<digits10>& val)
|
|
1251
|
+
{
|
|
1252
|
+
using default_ops::eval_convert_to;
|
|
1253
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1254
|
+
{
|
|
1255
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1256
|
+
}
|
|
1257
|
+
mpfr_float_backend<digits10> t;
|
|
1258
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1259
|
+
eval_convert_to(result, t);
|
|
1260
|
+
}
|
|
1261
|
+
template <unsigned digits10>
|
|
1262
|
+
inline void eval_convert_to(int128_type* result, const mpc_complex_backend<digits10>& val)
|
|
1263
|
+
{
|
|
1264
|
+
using default_ops::eval_convert_to;
|
|
1265
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1266
|
+
{
|
|
1267
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1268
|
+
}
|
|
1269
|
+
mpfr_float_backend<digits10> t;
|
|
1270
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1271
|
+
eval_convert_to(result, t);
|
|
1272
|
+
}
|
|
1273
|
+
#endif
|
|
1274
|
+
#ifdef BOOST_HAS_FLOAT128
|
|
1275
|
+
template <unsigned digits10>
|
|
1276
|
+
inline void eval_convert_to(float128_type* result, const mpc_complex_backend<digits10>& val)
|
|
1277
|
+
{
|
|
1278
|
+
using default_ops::eval_convert_to;
|
|
1279
|
+
if (0 == mpfr_zero_p(mpc_imagref(val.data())))
|
|
1280
|
+
{
|
|
1281
|
+
BOOST_MP_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
|
1282
|
+
}
|
|
1283
|
+
mpfr_float_backend<digits10> t;
|
|
1284
|
+
mpc_real(t.data(), val.data(), GMP_RNDN);
|
|
1285
|
+
eval_convert_to(result, t);
|
|
1286
|
+
}
|
|
1287
|
+
#endif
|
|
1288
|
+
|
|
1289
|
+
template <mpfr_allocation_type AllocationType>
|
|
1290
|
+
inline void assign_components_set_precision(mpc_complex_backend<0>& result, const mpfr_float_backend<0, AllocationType>& a, const mpfr_float_backend<0, AllocationType>& b)
|
|
1291
|
+
{
|
|
1292
|
+
if (result.thread_default_variable_precision_options() >= variable_precision_options::preserve_component_precision)
|
|
1293
|
+
{
|
|
1294
|
+
unsigned long prec = (std::max)(mpfr_get_prec(a.data()), mpfr_get_prec(b.data()));
|
|
1295
|
+
mpc_set_prec(result.data(), prec);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
template <unsigned D2, mpfr_allocation_type AllocationType>
|
|
1299
|
+
inline void assign_components_set_precision(mpc_complex_backend<0>& result, const mpfr_float_backend<D2, AllocationType>& a, const mpfr_float_backend<D2, AllocationType>& b)
|
|
1300
|
+
{
|
|
1301
|
+
if (result.thread_default_variable_precision_options() >= variable_precision_options::preserve_related_precision)
|
|
1302
|
+
{
|
|
1303
|
+
unsigned long prec = (std::max)(mpfr_get_prec(a.data()), mpfr_get_prec(b.data()));
|
|
1304
|
+
mpc_set_prec(result.data(), prec);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1308
|
+
inline void assign_components_set_precision(mpc_complex_backend<D1>&, const mpfr_float_backend<D2, AllocationType>&, const mpfr_float_backend<D2, AllocationType>&)
|
|
1309
|
+
{
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1313
|
+
inline void assign_components(mpc_complex_backend<D1>& result, const mpfr_float_backend<D2, AllocationType>& a, const mpfr_float_backend<D2, AllocationType>& b)
|
|
1314
|
+
{
|
|
1315
|
+
//
|
|
1316
|
+
// This is called from class number's constructors, so if we have variable
|
|
1317
|
+
// precision, then copy the precision of the source variables.
|
|
1318
|
+
//
|
|
1319
|
+
assign_components_set_precision(result, a, b);
|
|
1320
|
+
using default_ops::eval_fpclassify;
|
|
1321
|
+
if (eval_fpclassify(a) == static_cast<int>(FP_NAN))
|
|
1322
|
+
{
|
|
1323
|
+
mpc_set_fr(result.data(), a.data(), GMP_RNDN);
|
|
1324
|
+
}
|
|
1325
|
+
else if (eval_fpclassify(b) == static_cast<int>(FP_NAN))
|
|
1326
|
+
{
|
|
1327
|
+
mpc_set_fr(result.data(), b.data(), GMP_RNDN);
|
|
1328
|
+
}
|
|
1329
|
+
else
|
|
1330
|
+
{
|
|
1331
|
+
mpc_set_fr_fr(result.data(), a.data(), b.data(), GMP_RNDN);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1336
|
+
inline void assign_components(mpc_complex_backend<D1>& result, unsigned long a, unsigned long b)
|
|
1337
|
+
{
|
|
1338
|
+
mpc_set_ui_ui(result.data(), a, b, GMP_RNDN);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1342
|
+
inline void assign_components(mpc_complex_backend<D1>& result, long a, long b)
|
|
1343
|
+
{
|
|
1344
|
+
mpc_set_si_si(result.data(), a, b, GMP_RNDN);
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
#if defined(BOOST_HAS_LONG_LONG) && defined(_MPFR_H_HAVE_INTMAX_T)
|
|
1348
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1349
|
+
inline void assign_components(mpc_complex_backend<D1>& result, unsigned long long a, unsigned long long b)
|
|
1350
|
+
{
|
|
1351
|
+
mpc_set_uj_uj(result.data(), a, b, GMP_RNDN);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1355
|
+
inline void assign_components(mpc_complex_backend<D1>& result, long long a, long long b)
|
|
1356
|
+
{
|
|
1357
|
+
mpc_set_sj_sj(result.data(), a, b, GMP_RNDN);
|
|
1358
|
+
}
|
|
1359
|
+
#endif
|
|
1360
|
+
|
|
1361
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1362
|
+
inline void assign_components(mpc_complex_backend<D1>& result, double a, double b)
|
|
1363
|
+
{
|
|
1364
|
+
if (BOOST_MP_ISNAN(a))
|
|
1365
|
+
{
|
|
1366
|
+
mpc_set_d(result.data(), a, GMP_RNDN);
|
|
1367
|
+
}
|
|
1368
|
+
else if (BOOST_MP_ISNAN(b))
|
|
1369
|
+
{
|
|
1370
|
+
mpc_set_d(result.data(), b, GMP_RNDN);
|
|
1371
|
+
}
|
|
1372
|
+
else
|
|
1373
|
+
{
|
|
1374
|
+
mpc_set_d_d(result.data(), a, b, GMP_RNDN);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
|
|
1379
|
+
inline void assign_components(mpc_complex_backend<D1>& result, long double a, long double b)
|
|
1380
|
+
{
|
|
1381
|
+
if (BOOST_MP_ISNAN(a))
|
|
1382
|
+
{
|
|
1383
|
+
mpc_set_d(result.data(), a, GMP_RNDN);
|
|
1384
|
+
}
|
|
1385
|
+
else if (BOOST_MP_ISNAN(b))
|
|
1386
|
+
{
|
|
1387
|
+
mpc_set_d(result.data(), b, GMP_RNDN);
|
|
1388
|
+
}
|
|
1389
|
+
else
|
|
1390
|
+
{
|
|
1391
|
+
mpc_set_ld_ld(result.data(), a, b, GMP_RNDN);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
//
|
|
1396
|
+
// Native non-member operations:
|
|
1397
|
+
//
|
|
1398
|
+
template <unsigned Digits10>
|
|
1399
|
+
inline void eval_sqrt(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& val)
|
|
1400
|
+
{
|
|
1401
|
+
mpc_sqrt(result.data(), val.data(), GMP_RNDN);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
template <unsigned Digits10>
|
|
1405
|
+
inline void eval_pow(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& b, const mpc_complex_backend<Digits10>& e)
|
|
1406
|
+
{
|
|
1407
|
+
mpc_pow(result.data(), b.data(), e.data(), GMP_RNDN);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
template <unsigned Digits10>
|
|
1411
|
+
inline void eval_exp(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1412
|
+
{
|
|
1413
|
+
mpc_exp(result.data(), arg.data(), GMP_RNDN);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
template <unsigned Digits10>
|
|
1417
|
+
inline void eval_log(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1418
|
+
{
|
|
1419
|
+
mpc_log(result.data(), arg.data(), GMP_RNDN);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
template <unsigned Digits10>
|
|
1423
|
+
inline void eval_log10(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1424
|
+
{
|
|
1425
|
+
mpc_log10(result.data(), arg.data(), GMP_RNDN);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
template <unsigned Digits10>
|
|
1429
|
+
inline void eval_sin(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1430
|
+
{
|
|
1431
|
+
mpc_sin(result.data(), arg.data(), GMP_RNDN);
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
template <unsigned Digits10>
|
|
1435
|
+
inline void eval_cos(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1436
|
+
{
|
|
1437
|
+
mpc_cos(result.data(), arg.data(), GMP_RNDN);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
template <unsigned Digits10>
|
|
1441
|
+
inline void eval_tan(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1442
|
+
{
|
|
1443
|
+
mpc_tan(result.data(), arg.data(), GMP_RNDN);
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
template <unsigned Digits10>
|
|
1447
|
+
inline void eval_asin(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1448
|
+
{
|
|
1449
|
+
mpc_asin(result.data(), arg.data(), GMP_RNDN);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
template <unsigned Digits10>
|
|
1453
|
+
inline void eval_acos(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1454
|
+
{
|
|
1455
|
+
mpc_acos(result.data(), arg.data(), GMP_RNDN);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
template <unsigned Digits10>
|
|
1459
|
+
inline void eval_atan(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1460
|
+
{
|
|
1461
|
+
mpc_atan(result.data(), arg.data(), GMP_RNDN);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
template <unsigned Digits10>
|
|
1465
|
+
inline void eval_sinh(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1466
|
+
{
|
|
1467
|
+
mpc_sinh(result.data(), arg.data(), GMP_RNDN);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
template <unsigned Digits10>
|
|
1471
|
+
inline void eval_cosh(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1472
|
+
{
|
|
1473
|
+
mpc_cosh(result.data(), arg.data(), GMP_RNDN);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
template <unsigned Digits10>
|
|
1477
|
+
inline void eval_tanh(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1478
|
+
{
|
|
1479
|
+
mpc_tanh(result.data(), arg.data(), GMP_RNDN);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
template <unsigned Digits10>
|
|
1483
|
+
inline void eval_asinh(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1484
|
+
{
|
|
1485
|
+
mpc_asinh(result.data(), arg.data(), GMP_RNDN);
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
template <unsigned Digits10>
|
|
1489
|
+
inline void eval_acosh(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1490
|
+
{
|
|
1491
|
+
mpc_acosh(result.data(), arg.data(), GMP_RNDN);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
template <unsigned Digits10>
|
|
1495
|
+
inline void eval_atanh(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1496
|
+
{
|
|
1497
|
+
mpc_atanh(result.data(), arg.data(), GMP_RNDN);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
template <unsigned Digits10>
|
|
1501
|
+
inline void eval_conj(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1502
|
+
{
|
|
1503
|
+
mpc_conj(result.data(), arg.data(), GMP_RNDN);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
template <unsigned Digits10>
|
|
1507
|
+
inline void eval_proj(mpc_complex_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1508
|
+
{
|
|
1509
|
+
mpc_proj(result.data(), arg.data(), GMP_RNDN);
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
template <unsigned Digits10>
|
|
1513
|
+
inline void eval_real(mpfr_float_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1514
|
+
{
|
|
1515
|
+
mpfr_set_prec(result.data(), mpfr_get_prec(mpc_realref(arg.data())));
|
|
1516
|
+
mpfr_set(result.data(), mpc_realref(arg.data()), GMP_RNDN);
|
|
1517
|
+
}
|
|
1518
|
+
template <unsigned Digits10>
|
|
1519
|
+
inline void eval_imag(mpfr_float_backend<Digits10>& result, const mpc_complex_backend<Digits10>& arg)
|
|
1520
|
+
{
|
|
1521
|
+
mpfr_set_prec(result.data(), mpfr_get_prec(mpc_imagref(arg.data())));
|
|
1522
|
+
mpfr_set(result.data(), mpc_imagref(arg.data()), GMP_RNDN);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
template <unsigned Digits10>
|
|
1526
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg)
|
|
1527
|
+
{
|
|
1528
|
+
mpfr_set(mpc_imagref(result.data()), arg.data(), GMP_RNDN);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
template <unsigned Digits10>
|
|
1532
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg)
|
|
1533
|
+
{
|
|
1534
|
+
mpfr_set(mpc_realref(result.data()), arg.data(), GMP_RNDN);
|
|
1535
|
+
}
|
|
1536
|
+
template <unsigned Digits10>
|
|
1537
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const gmp_int& arg)
|
|
1538
|
+
{
|
|
1539
|
+
mpfr_set_z(mpc_realref(result.data()), arg.data(), GMP_RNDN);
|
|
1540
|
+
}
|
|
1541
|
+
template <unsigned Digits10>
|
|
1542
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const gmp_rational& arg)
|
|
1543
|
+
{
|
|
1544
|
+
mpfr_set_q(mpc_realref(result.data()), arg.data(), GMP_RNDN);
|
|
1545
|
+
}
|
|
1546
|
+
template <unsigned Digits10>
|
|
1547
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const unsigned& arg)
|
|
1548
|
+
{
|
|
1549
|
+
mpfr_set_ui(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1550
|
+
}
|
|
1551
|
+
template <unsigned Digits10>
|
|
1552
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const unsigned long& arg)
|
|
1553
|
+
{
|
|
1554
|
+
mpfr_set_ui(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1555
|
+
}
|
|
1556
|
+
template <unsigned Digits10>
|
|
1557
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const int& arg)
|
|
1558
|
+
{
|
|
1559
|
+
mpfr_set_si(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1560
|
+
}
|
|
1561
|
+
template <unsigned Digits10>
|
|
1562
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const long& arg)
|
|
1563
|
+
{
|
|
1564
|
+
mpfr_set_si(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1565
|
+
}
|
|
1566
|
+
template <unsigned Digits10>
|
|
1567
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const float& arg)
|
|
1568
|
+
{
|
|
1569
|
+
mpfr_set_flt(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1570
|
+
}
|
|
1571
|
+
template <unsigned Digits10>
|
|
1572
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const double& arg)
|
|
1573
|
+
{
|
|
1574
|
+
mpfr_set_d(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1575
|
+
}
|
|
1576
|
+
template <unsigned Digits10>
|
|
1577
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const long double& arg)
|
|
1578
|
+
{
|
|
1579
|
+
mpfr_set_ld(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1580
|
+
}
|
|
1581
|
+
#if defined(BOOST_HAS_LONG_LONG) && defined(_MPFR_H_HAVE_INTMAX_T)
|
|
1582
|
+
template <unsigned Digits10>
|
|
1583
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const unsigned long long& arg)
|
|
1584
|
+
{
|
|
1585
|
+
mpfr_set_uj(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1586
|
+
}
|
|
1587
|
+
template <unsigned Digits10>
|
|
1588
|
+
inline void eval_set_real(mpc_complex_backend<Digits10>& result, const long long& arg)
|
|
1589
|
+
{
|
|
1590
|
+
mpfr_set_sj(mpc_realref(result.data()), arg, GMP_RNDN);
|
|
1591
|
+
}
|
|
1592
|
+
#endif
|
|
1593
|
+
|
|
1594
|
+
template <unsigned Digits10>
|
|
1595
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const gmp_int& arg)
|
|
1596
|
+
{
|
|
1597
|
+
mpfr_set_z(mpc_imagref(result.data()), arg.data(), GMP_RNDN);
|
|
1598
|
+
}
|
|
1599
|
+
template <unsigned Digits10>
|
|
1600
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const gmp_rational& arg)
|
|
1601
|
+
{
|
|
1602
|
+
mpfr_set_q(mpc_imagref(result.data()), arg.data(), GMP_RNDN);
|
|
1603
|
+
}
|
|
1604
|
+
template <unsigned Digits10>
|
|
1605
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const unsigned& arg)
|
|
1606
|
+
{
|
|
1607
|
+
mpfr_set_ui(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1608
|
+
}
|
|
1609
|
+
template <unsigned Digits10>
|
|
1610
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const unsigned long& arg)
|
|
1611
|
+
{
|
|
1612
|
+
mpfr_set_ui(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1613
|
+
}
|
|
1614
|
+
template <unsigned Digits10>
|
|
1615
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const int& arg)
|
|
1616
|
+
{
|
|
1617
|
+
mpfr_set_si(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1618
|
+
}
|
|
1619
|
+
template <unsigned Digits10>
|
|
1620
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const long& arg)
|
|
1621
|
+
{
|
|
1622
|
+
mpfr_set_si(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1623
|
+
}
|
|
1624
|
+
template <unsigned Digits10>
|
|
1625
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const float& arg)
|
|
1626
|
+
{
|
|
1627
|
+
mpfr_set_flt(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1628
|
+
}
|
|
1629
|
+
template <unsigned Digits10>
|
|
1630
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const double& arg)
|
|
1631
|
+
{
|
|
1632
|
+
mpfr_set_d(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1633
|
+
}
|
|
1634
|
+
template <unsigned Digits10>
|
|
1635
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const long double& arg)
|
|
1636
|
+
{
|
|
1637
|
+
mpfr_set_ld(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1638
|
+
}
|
|
1639
|
+
#if defined(BOOST_HAS_LONG_LONG) && defined(_MPFR_H_HAVE_INTMAX_T)
|
|
1640
|
+
template <unsigned Digits10>
|
|
1641
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const unsigned long long& arg)
|
|
1642
|
+
{
|
|
1643
|
+
mpfr_set_uj(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1644
|
+
}
|
|
1645
|
+
template <unsigned Digits10>
|
|
1646
|
+
inline void eval_set_imag(mpc_complex_backend<Digits10>& result, const long long& arg)
|
|
1647
|
+
{
|
|
1648
|
+
mpfr_set_sj(mpc_imagref(result.data()), arg, GMP_RNDN);
|
|
1649
|
+
}
|
|
1650
|
+
#endif
|
|
1651
|
+
|
|
1652
|
+
template <unsigned Digits10>
|
|
1653
|
+
inline std::size_t hash_value(const mpc_complex_backend<Digits10>& val)
|
|
1654
|
+
{
|
|
1655
|
+
std::size_t result = 0;
|
|
1656
|
+
std::size_t len = val.data()[0].re[0]._mpfr_prec / mp_bits_per_limb;
|
|
1657
|
+
if (val.data()[0].re[0]._mpfr_prec % mp_bits_per_limb)
|
|
1658
|
+
++len;
|
|
1659
|
+
for (std::size_t i = 0; i < len; ++i)
|
|
1660
|
+
boost::multiprecision::detail::hash_combine(result, val.data()[0].re[0]._mpfr_d[i]);
|
|
1661
|
+
boost::multiprecision::detail::hash_combine(result, val.data()[0].re[0]._mpfr_exp, val.data()[0].re[0]._mpfr_sign);
|
|
1662
|
+
|
|
1663
|
+
len = val.data()[0].im[0]._mpfr_prec / mp_bits_per_limb;
|
|
1664
|
+
if (val.data()[0].im[0]._mpfr_prec % mp_bits_per_limb)
|
|
1665
|
+
++len;
|
|
1666
|
+
for (std::size_t i = 0; i < len; ++i)
|
|
1667
|
+
boost::multiprecision::detail::hash_combine(result, val.data()[0].im[0]._mpfr_d[i]);
|
|
1668
|
+
boost::multiprecision::detail::hash_combine(result, val.data()[0].im[0]._mpfr_exp, val.data()[0].im[0]._mpfr_sign);
|
|
1669
|
+
return result;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
} // namespace backends
|
|
1673
|
+
|
|
1674
|
+
namespace detail {
|
|
1675
|
+
template <>
|
|
1676
|
+
struct is_variable_precision<backends::mpc_complex_backend<0> > : public std::integral_constant<bool, true>
|
|
1677
|
+
{};
|
|
1678
|
+
} // namespace detail
|
|
1679
|
+
|
|
1680
|
+
template <>
|
|
1681
|
+
struct number_category<detail::canonical<mpc_t, backends::mpc_complex_backend<0> >::type> : public std::integral_constant<int, number_kind_floating_point>
|
|
1682
|
+
{};
|
|
1683
|
+
|
|
1684
|
+
template <unsigned Digits10, expression_template_option ExpressionTemplates>
|
|
1685
|
+
struct component_type<number<mpc_complex_backend<Digits10>, ExpressionTemplates> >
|
|
1686
|
+
{
|
|
1687
|
+
using type = number<mpfr_float_backend<Digits10>, ExpressionTemplates>;
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
template <unsigned Digits10, expression_template_option ExpressionTemplates>
|
|
1691
|
+
struct component_type<number<backends::logged_adaptor<mpc_complex_backend<Digits10> >, ExpressionTemplates> >
|
|
1692
|
+
{
|
|
1693
|
+
using type = number<mpfr_float_backend<Digits10>, ExpressionTemplates>;
|
|
1694
|
+
};
|
|
1695
|
+
template <unsigned Digits10, expression_template_option ExpressionTemplates>
|
|
1696
|
+
struct component_type<number<backends::debug_adaptor<mpc_complex_backend<Digits10> >, ExpressionTemplates> >
|
|
1697
|
+
{
|
|
1698
|
+
using type = number<backends::debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates>;
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
template <unsigned Digits10, expression_template_option ExpressionTemplates>
|
|
1702
|
+
struct complex_result_from_scalar<number<mpfr_float_backend<Digits10>, ExpressionTemplates> >
|
|
1703
|
+
{
|
|
1704
|
+
using type = number<mpc_complex_backend<Digits10>, ExpressionTemplates>;
|
|
1705
|
+
};
|
|
1706
|
+
template <unsigned Digits10, expression_template_option ExpressionTemplates>
|
|
1707
|
+
struct complex_result_from_scalar<number<backends::logged_adaptor<mpfr_float_backend<Digits10>>, ExpressionTemplates> >
|
|
1708
|
+
{
|
|
1709
|
+
using type = number<mpc_complex_backend<Digits10>, ExpressionTemplates>;
|
|
1710
|
+
};
|
|
1711
|
+
template <unsigned Digits10, expression_template_option ExpressionTemplates>
|
|
1712
|
+
struct complex_result_from_scalar<number<backends::debug_adaptor<mpfr_float_backend<Digits10>>, ExpressionTemplates> >
|
|
1713
|
+
{
|
|
1714
|
+
using type = number<backends::debug_adaptor<mpc_complex_backend<Digits10> >, ExpressionTemplates>;
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
} // namespace boost::multiprecision
|
|
1720
|
+
|
|
1721
|
+
#endif
|