Questions tagged [complex-arithmetic]

For questions about implementing and using complex arithmetic operations.

Filter by
Sorted by
Tagged with
0 votes
1 answer
55 views

Finding best phase in least-squares manner

I have the following problem: $$argmin_{\vec{x},\phi}||A\vec{x}-\vec{y}e^{j\phi}||_2^2$$ Here, $x$ and $y$ are vectors and $\phi$ is a constant phase factor that applies to the all entries of $y$. I ...
1 vote
0 answers
62 views

Does the choice of a complex inner product affect Krylov methods?

As far as I understand there are two definitions of the complex inner product: $$(a,b) = b^H a$$ and $$(a,b) = a^H b$$ I know some linear algebra libraries such as BLAS and Eigen uses the second one. ...
-2 votes
1 answer
48 views

Simplification of complex amplitudes

In a previous answer the following identity was presented $$-i \vec \kappa \exp^{[i\vec \kappa \cdot (\vec r_j - \vec r_i)]} = -\vec \kappa \sin[\vec \kappa \cdot (\vec r_j - \vec r_i)] \, .$$ Why ...
16 votes
3 answers
2k views

Why would a computational scientist need to implement their own version of std::complex?

Many of the better-known C++ libraries in computational science such as Eigen, Trilinos, and deal.II use the standard C++ template header library object, ...
2 votes
1 answer
646 views

Implicitly casting PetscReal to the real part of PetscComplex

The version of PETSc installed on my machine has PetscScalar set to be complex. I am making a matrix which has all real entries. Something like the following code ...
6 votes
2 answers
1k views

Complex Eigenvalues using eig (Matlab)

I wanted to find and plot the eigenvalues of large (around $1000\times1000$) matrices. But discovered when using the eig function in matlab, it gives complex ...
1 vote
1 answer
75 views

Why does this implementation for Eisenstein integer pairs of Euclid's method for finding greatest common denominators get stuck for this one point?

My Math SE question determining if a coincident point in a pair of rotated hexagonal lattices is closest to the origin? explains the problem I have. I won't reproduce the whole thing in detail here, ...
1 vote
1 answer
295 views

OpenMP threaded nonlinear solver for complex numbers

Problem: I have translated Jacobian-Free Newton-Krylov solver written by C. T. Kelley to Fortran and now want to parallelize it on a shared-memory system with OpenMP. In addition, I want to ...
4 votes
0 answers
193 views

Stable iterative solver for complex symmetric linear systems

I am interested in the iterative solution (preferably Krylov-type solvers) of a problem $\boldsymbol{A}x=b$, with $x,b\in\mathbb{C}^{n\times1}$ and $\boldsymbol{A}\in\mathbb{C}^{n\times n}$. $\...
12 votes
2 answers
657 views

Danger of complex arithmetic in scientific computing

The complex inner product $\langle u,v\rangle$ has two different definitions decided by conventions: $\bar{u}^Tv$ or $u^T\bar{v}$. In BLAS, I found the routines ...
2 votes
1 answer
470 views

Solving Schrodinger Equation with finite element and Crank-Nicolson?

I have asked this in Mathematic section, but received no reply. Please let me ask here to see if threr is any difference. The Schrodinger equation without potential has the following form: $$\...
8 votes
3 answers
1k views

Power of complex-valued neural network

I often see neural networks extended to complex-values. Those networks allow complex input, complex parameters, and complex output. My understanding is that the inner products and point nonlinearities ...
2 votes
1 answer
267 views

Methods to improve the efficiency and the memory requirement of LU factorization for complex symmetric system matrix

I want to solve a linear set of equations (Ax=b) using LU decomposition. My "A" matrix is a complex matrix which is ...
0 votes
0 answers
51 views

Split of complex parts in weak form

I am working on a numerical model to simulate the acoustic and elastic wave propagation in frequency domain via the Finite Element Method. Basically, the problem is to solve the Helmholtz equation in ...
3 votes
0 answers
145 views

What is the computational cost of using complex numbers in contrast to real numbers in matrix operations, e.g. $LU$ or $LDL^T$ factorizations? [duplicate]

I am curious about how much one loses in terms of computational cost when complex numbers are used instead of real numbers? I guess the number of floating-point operations and memory doubles, but I ...
2 votes
1 answer
401 views

Reference for QR algorithm for complex matrix

I am trying to find out if the known QR algorithm to find the eigenvalues of a real matrix, which can be found in the book Fundamentals of Matrix Computations, can also be used for complex matrices ...
6 votes
3 answers
294 views

Fast evaluation functions given by straight-line programs

I have a simple but long function that takes a vector x[10], and outputs a vector y[100]. It is an automatically generated eval function for a multivariate polynomial, ie, there is only (complex) ...
7 votes
2 answers
149 views

Algebraic multigrid for complex valued matrices

Assume one uses the classical AMG with Ruge-Stuben coarsening and direct interpolation for solving real valued problems. How can this approach be recycled to also solve complex valued problems like ...
1 vote
1 answer
447 views

Computing real normal modes from complex eigenvectors

I'm trying to get the normal modes of a system of springs and dasphots using the basic dynamic equations for a linear, damped elastic structure: $ M \ddot{u}(t) + C \dot{u}(t) + K u(t) = f(t) $ to ...
1 vote
1 answer
149 views

Mapping from n x n complex symmetric tridiagonal to 2n x 2n real symmetric tridiagonal

In my program I have a complex symmetric tridiagonal matrix. In order to perform some algorithmic optimizations I am searching for a (ideally linear) mapping from $n\times n$ complex symmetric ...
6 votes
1 answer
118 views

Numerical computation of the complex elliptic integral $E(k)$ for medium $|k|$

I have implemented Carlson's algorithm for $E(k)$ from Numerical computation of real or complex elliptic integrals (available from ArXiv eprint, see also DLMF). It is essentially his formula (46) ...
2 votes
0 answers
505 views

Arpack and Matlab give different values for eigenvalues

I am solving a generalized eigenvalues problem with inversed complex shift: $$(M-\sigma J)^{-1}J \boldsymbol{x} = \boldsymbol{x} \nu \enspace .$$ My matrices are obtained from a finite element ...
6 votes
1 answer
548 views

Reference BLAS/LAPACK from NETLIB is twice as fast as MKL for complex numbers

I'm solving the Helmholtz equation using PETSc. I found with the PETSc configure option --download-f-blas-lapack my program runs twice as fast over running it with ...