Is there a way to make a complex number in Numpy accurate to decimal type?

I work in Python with NumPy arrays of complex numbers that go well beyond the normal floating point values โ€‹โ€‹of the NumPys type of the default Complex (numbers greater than 10 ^ 500). I wanted to know if there is a way to expand NumPy so that it can handle complex numbers with such a magnitude. For example, is there a way to create a complex NumPy type that uses functionality from a decimal module?

I know that there are resources available, such as mpmath ( https://code.google.com/p/mpmath/ ), which could probably do what I need, however this requirement is my project, which I use Numpy

For those who are wondering why I need these huge numbers, this is because I am working on modeling the numerical relativity of the early Universe.

+6
source share
1 answer

Depending on your platform, you may have support for complex192 & / or complex256, they are usually not available on Intel platforms under Windows, but are on some others - if your code works in Solaris or in a supercomputer cluster, it can support one of these types. On Linux, you can even find them available or create an array using dtype=object , and then use bigfloat or gmpy2.mpc.

  • complex256 numbers up to 10 ^ 4932 + 10 ^ 4932j
  • complex192 but with less accuracy
  • I even noticed the mention of numpy and complex512 ...
+2
source

All Articles