1,451 questions
0
votes
1
answer
182
views
Numba error to compile a function in Python
I'm trying to program a Schrödinger simulation in python but I'm having problems with @njit from the library Numba to optimize functions.
This is the code. I'm just trying to solve a discreet ...
3
votes
1
answer
259
views
Include a C header with complex float types in C++
I can't figure out an easy method to include a C header with C complex types in C++. Assume you have the following files:
c_source.h
#include <complex.h>
#ifdef __cplusplus
extern "C"
...
1
vote
1
answer
165
views
Why isn't my Hermitian covariance matrix invertible?
I am following a paper that uses a Hermitian covariance matrix
and inverts it to produce a Fisher matrix. I construct my covariance as Gamma[i,m,n], stored inside a larger array of shape (n_z, n_k, ...
4
votes
1
answer
163
views
optimize computation of real part of complex product
I need (only) the real part of the product of two complex numbers. Naturally, I can code this as
real(x)*real(y) - imag(x)*imag(y);
or
real(x*y);
The latter, however, formally first computes the ...
1
vote
1
answer
155
views
If ARM has FMLA-FMLS, then why ARM has only FCMLA?
Arm® Architecture Reference Manual for A-profile architecture has the following instructions:
FMLA (Floating-point fused multiply-add)
FMLS (Floating-point fused multiply-subtract)
FCMLA (Floating-...
1
vote
1
answer
150
views
in pybind11, how do you test if py::object is a complex number or a callable?
Context: I've recently been using pybind11 to put a python frontend on an old c++ project of mine. This has mostly been a breeze (thanks pybind11 devs!), but there are some areas where I've had to ...
-1
votes
1
answer
121
views
Best practices for creating and deconstructing 32-bit complex values in C? (2 x 16-bit floats) [closed]
I am interested in working with 32-bit complex values in C, made up of 16-bit real and imaginary values. I am working with clang and gcc, and representing my 16-bit floats using _Float16, which I ...
6
votes
3
answers
299
views
How to select element from two complex number lists to get minimum magnitude for their sum
I have two python lists(list1 and list2),each containing 51 complex numbers. At each index i, I can choose either list1[i] or list2[i]. I want to select one element per index(Total of 51 elements) ...
0
votes
2
answers
71
views
Why does the square of a complex tensor with no imaginary part yields a result with an imaginary part?
I have a complex tensor: tensor1 = tensor([0.0000+0.j, -106990.0794+0.j], device='cuda:1', dtype=torch.complex128)
The both elements have no imaginary part (0.j), however, when squaring the variable ...
6
votes
1
answer
148
views
Can a real floating-point type alias a complex floating-point type in C?
According to the C Standard:
Each complex type has the same representation and alignment requirements as an array
type containing exactly two elements of the corresponding real type; the first ...
2
votes
1
answer
200
views
What is the fastest way to split even and odd indices with AVX2?
For example, what Intel AVX/SSE intrinsics can I use to split a array of complex numbers into a two arrays of real and imaginary parts respectively?
So something like [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7....
6
votes
2
answers
358
views
Is there a way to compute only the real part of a NumPy matmul?
Let's say I have two arrays a and b both with dtype np.complex128 and I want to compute C = np.matmul(a, b).real .
That is, I don't care about the imaginary part, only the real part. Is there a better ...
0
votes
0
answers
60
views
complex type conversion errors in NumPy vs C complex.h library
I have a large Python method that calculates a series of ndarray quantities of dtype=np.complex128. I have been experimenting with what speed increases are possible using Cython. In converting a ...
0
votes
0
answers
118
views
Quadruple precision complex matrix diagonalization in Fortran 90
I'm writing a code that mostly consists of matrices manipulation and, in particular, diagonalization. I already have a code, both in python and in Fortran 90 that are able to solve my problem in a ...
0
votes
0
answers
80
views
Understanding `omp_orig` in a custom OpenMP reduction
I've encountered a bug when using Clang[1] with libomp[2] whereby using omp_priv = omp_orig in the initializer of a custom OpenMP reduction silently gives erroneous output. For example:
/* file.cpp */
...