This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: Complex matrices
- From: "Eugene Eremin" <eugene at hydro dot appl dot sci-nnov dot ru>
- To: "Dr. David Kirkby" <drkirkby at ntlworld dot com>, "gsl discussion list" <gsl-discuss at sources dot redhat dot com>
- Date: Wed, 6 Mar 2002 11:35:16 +0300
- Subject: Re: Complex matrices
- References: <3C8541D7.3E3512C5@ntlworld.com>
----- Original Message -----
From: "Dr. David Kirkby" <drkirkby@ntlworld.com>
To: "gsl discussion list" <gsl-discuss@sources.redhat.com>
Sent: Wednesday, March 06, 2002 1:08 AM
Subject: Complex matrices
> Hi,
> I'm trying to solve an equation of the form:
> [V]=[I].[Z], where V is a vector that is known, Z is square matrix that is
known
> and I is unknown. V, I and Z are all complex.
>
> I can't seem to find any routines in gsl for complex matrices - plenty for
> complex numbers and plenty for matrices. Am I missing something?? It seems
like
> quite a standard thing.
>
> My square matrix Z is symmetrical (i.e. Zxy=Zyx). Can I use this to my
> advantage? The matrix is not sparse.
> --
> Dr. David Kirkby PhD,
> email: drkirkby@ntlworld.com
> web page: http://www.david-kirkby.co.uk/
> Amateur radio callsign: G8WRB
>
Try this
Ax=b
//allocate memory for matrix
gsl_matrix_complex* A_matrix = gsl_matrix_complex_alloc(size,size);
gsl_vector_complex* B_vector = gsl_vector_complex_alloc(size);
gsl_vector_complex* X_vector = gsl_vector_complex_alloc(size);
//initilaze matrix A
gsl_matrix_complex_set(A_matrix,0,0 .............................
//solve system the LU methods
int s;
gsl_permutation * p = gsl_permutation_alloc (size);
gsl_linalg_complex_LU_decomp (A_matrix, p, &s);
gsl_linalg_complex_LU_solve (A_matrix, p, B_vector, X_vector);
//free memory after solve system
gsl_permutation_free(p);