* complex matrices
@ 2003-05-27 8:53 Travis R Miller
2003-05-28 15:06 ` Brian Gough
0 siblings, 1 reply; 6+ messages in thread
From: Travis R Miller @ 2003-05-27 8:53 UTC (permalink / raw)
To: gsl-discuss
Your manual covers none of the functions usable for complex matrices.
Either how one sets their values or performs various operations on
them. There is a hint of a function for performing LU decomposition on
such a matrix in the linear algebra chapter, but there is nothing more.
Some help would be great. Here is a bit of code that returns a
segmentation fault. Perhaps you can explain what is wrong
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<gsl/gsl_rng.h>
#include<gsl/gsl_matrix_complex_double.h>
int main(void)
{
const gsl_rng_type *T;
gsl_rng *r;
gsl_matrix_complex *m;
gsl_complex x;
int i, j;
double u;
gsl_matrix_complex_alloc(4,4);
gsl_rng_env_setup();
T = gsl_rng_default;
r = gsl_rng_alloc(T);
for(i=0; i<4; i++) {
for(j=0; j<4; j++) {
u = gsl_rng_uniform(r);
printf("%.5f\n", u);
x.dat[0] = u;
u = gsl_rng_uniform(r);
printf("%.5f\n", u);
x.dat[1] = u;
gsl_matrix_complex_set(m, i, j, x);
}
}
gsl_rng_free(r);
return 1;
}
Thank you for your time,
Travis
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: complex matrices
2003-05-27 8:53 complex matrices Travis R Miller
@ 2003-05-28 15:06 ` Brian Gough
0 siblings, 0 replies; 6+ messages in thread
From: Brian Gough @ 2003-05-28 15:06 UTC (permalink / raw)
To: Travis R Miller; +Cc: gsl-discuss
Travis R Miller writes:
> Your manual covers none of the functions usable for complex matrices.
> Either how one sets their values or performs various operations on
> them. There is a hint of a function for performing LU decomposition on
> such a matrix in the linear algebra chapter, but there is nothing more.
> Some help would be great. Here is a bit of code that returns a
> segmentation fault. Perhaps you can explain what is wrong
Hi,
The chapter "Debugging Numerical Programs" in the GSL manual should
help you here.
regards
Brian Gough
^ permalink raw reply [flat|nested] 6+ messages in thread
* Complex matrices
@ 2002-12-31 9:55 Dr. David Kirkby
2002-03-05 14:08 ` Dr. David Kirkby
2002-12-31 9:55 ` Eugene Eremin
0 siblings, 2 replies; 6+ messages in thread
From: Dr. David Kirkby @ 2002-12-31 9:55 UTC (permalink / raw)
To: gsl discussion list
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complex matrices
2002-12-31 9:55 Complex matrices Dr. David Kirkby
2002-03-05 14:08 ` Dr. David Kirkby
@ 2002-12-31 9:55 ` Eugene Eremin
2002-03-06 0:39 ` Eugene Eremin
1 sibling, 1 reply; 6+ messages in thread
From: Eugene Eremin @ 2002-12-31 9:55 UTC (permalink / raw)
To: Dr. David Kirkby, gsl discussion list
----- 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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complex matrices
2002-12-31 9:55 ` Eugene Eremin
@ 2002-03-06 0:39 ` Eugene Eremin
0 siblings, 0 replies; 6+ messages in thread
From: Eugene Eremin @ 2002-03-06 0:39 UTC (permalink / raw)
To: Dr. David Kirkby, gsl discussion list
----- 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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Complex matrices
2002-12-31 9:55 Complex matrices Dr. David Kirkby
@ 2002-03-05 14:08 ` Dr. David Kirkby
2002-12-31 9:55 ` Eugene Eremin
1 sibling, 0 replies; 6+ messages in thread
From: Dr. David Kirkby @ 2002-03-05 14:08 UTC (permalink / raw)
To: gsl discussion list
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-05-28 15:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-27 8:53 complex matrices Travis R Miller
2003-05-28 15:06 ` Brian Gough
-- strict thread matches above, loose matches on Subject: below --
2002-12-31 9:55 Complex matrices Dr. David Kirkby
2002-03-05 14:08 ` Dr. David Kirkby
2002-12-31 9:55 ` Eugene Eremin
2002-03-06 0:39 ` Eugene Eremin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).