Komplex Development

Permutation routine that checks real and imaginary parts and swaps if needed for better numerical stability. More...
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "az_aztec.h"
#include "azk_komplex.h"
Functions  
void  AZK_permute_ri (int *options, double *params, int *proc_config, double *b, AZ_MATRIX *Amat_komplex) 
Permute a Komplex system for better numerical stability. 
Permutation routine that checks real and imaginary parts and swaps if needed for better numerical stability.
KOMPLEX is an addon module to AZTEC that allows users to solve complexvalued linear systems.
KOMPLEX solves a complexvalued linear system Ax = b by solving an equivalent realvalued system of twice the dimension. Specifically, writing in terms of real and imaginary parts, we have
or by separating into real and imaginary equations we have
which is a realvalued system of twice the size. If we find xr and xi, we can form the solution to the original system as x = xr +i*xi.
KOMPLEX accept user linear systems in three forms with either global or local index values.
1) The first form is true complex. The user passes in an MSR or VBR format matrix where the values are stored like Fortran complex numbers. Thus, the values array is of type double that is twice as long as the number of complex values. Each complex entry is stored with real part followed by imaginary part (as in Fortran).
2) The second form stores real and imaginary parts separately, but the pattern for each is identical. Thus only the values of the imaginary part are passed to the creation routines.
3) The third form accepts two realvalued matrices with no assumption about the structure of the matrices. Each matrix is multiplied by a usersupplied complex constant. This is the most general form.
Each of the above forms supports a global or local index set. By this we mean that the index values (stored in bindx) refer to the global problem indices, or the local indices (for example after calling AZ_transform).
void AZK_permute_ri  (  int *  options, 
double *  params,  
int *  proc_config,  
double *  b,  
AZ_MATRIX *  Amat_komplex  
) 
Permute a Komplex system for better numerical stability.
An alternative to the standard Komplex formulation is to permute the block rows so that the imaginary part is on the main diagonal. For example:
This action may be desirable, or necessary in situations where the real part has small or zero diagonal entries. This routine looks at each real/imaginary pair and, based on a heuristic may swap the real and imaginary parts. This action does not affect the sparsity pattern, but only the mapping from the complex (or real/imaginary) mapping to the komplex mapping, and back.
options  (In) Determines specific solution method and other parameters. 
params  (In) Drop tolerance and convergence tolerance info. 
proc_config  (In) Machine configuration. proc_config[AZ_node] is the node number. proc_config[AZ_N_procs] is the number of processors. 
b  (Out) Komplex version of RHS, possibly permuted. 
Amat_komplex  (Out) Komplex version of matrix stored as an AZ_MATRIX structure, possibly permuted. 
Referenced by AZK_create_linsys_c2k(), AZK_create_linsys_g2k(), and AZK_create_linsys_ri2k().