public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* help with gsl_matrix_complex_row
@ 2003-05-15 21:31 Mario Pernici
  2003-05-19  9:42 ` Brian Gough
       [not found] ` <200305191158.43653.ivo.alxneit@psi.ch>
  0 siblings, 2 replies; 6+ messages in thread
From: Mario Pernici @ 2003-05-15 21:31 UTC (permalink / raw)
  To: gsl-discuss


Hello.
I cannot find what I do wrong using gsl_matrix_complex_row.
The following example gives garbage in the second row.
The corresponding example with gsl_matrix_row and doubles works correctly.
Help would be appreciated.
Bye
 Mario

Here is the example:
#include <stdio.h>
#include <gsl/gsl_matrix_complex_double.h>

int main()
{
  gsl_complex z00, z01, z10, z11;
  gsl_matrix_complex * m;
  gsl_vector_complex_view vv0, vv1;
  int i;

  GSL_SET_COMPLEX(&z00, 1.0, 1.1); GSL_SET_COMPLEX(&z01, 1.2, 1.3);
  GSL_SET_COMPLEX(&z10, 1.4, 1.5); GSL_SET_COMPLEX(&z11, 1.6, 1.7);

  m = gsl_matrix_complex_alloc(2,2);
  gsl_matrix_complex_set(m,0,0,z00); gsl_matrix_complex_set(m,0,1,z01);
  gsl_matrix_complex_set(m,1,0,z10); gsl_matrix_complex_set(m,1,1,z11);

  vv0 = gsl_matrix_complex_row(m,0); vv1 = gsl_matrix_complex_row(m,1);

  for(i=0; i < 2; i++) {
  gsl_complex z0;
  z0 = gsl_vector_complex_get(&vv0.vector, i);
  printf("row0(%d) = %g, %g\n", i, GSL_REAL(z0), GSL_IMAG(z0));

  z0 = gsl_vector_complex_get(&vv1.vector, i);
  printf("row1(%d) = %g, %g\n", i, GSL_REAL(z0), GSL_IMAG(z0));
  }

  gsl_matrix_complex_free (m);
}

===========
Output:
row0(0) = 1, 1.1
row1(0) = -3.00652e-182, 7.7651e-62
row0(1) = 1.2, 1.3
row1(1) = -1.31435e+64, 3.39464e+184



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with gsl_matrix_complex_row
  2003-05-15 21:31 help with gsl_matrix_complex_row Mario Pernici
@ 2003-05-19  9:42 ` Brian Gough
       [not found] ` <200305191158.43653.ivo.alxneit@psi.ch>
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Gough @ 2003-05-19  9:42 UTC (permalink / raw)
  To: Mario Pernici; +Cc: gsl-discuss

Mario Pernici writes:
 > I cannot find what I do wrong using gsl_matrix_complex_row.
 > The following example gives garbage in the second row.
 > The corresponding example with gsl_matrix_row and doubles works correctly.
 > Help would be appreciated.
 >
 > Output:
 > row0(0) = 1, 1.1
 > row1(0) = -3.00652e-182, 7.7651e-62
 > row0(1) = 1.2, 1.3
 > row1(1) = -1.31435e+64, 3.39464e+184

What platform and compiler?

It works for me (gcc 2.95.4 on x86, Debian 3.0).

bjg|debian> ./a.out 
row0(0) = 1, 1.1
row1(0) = 1.4, 1.5
row0(1) = 1.2, 1.3
row1(1) = 1.6, 1.7

-- 
Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with gsl_matrix_complex_row
       [not found]   ` <16073.2415.364552.763652@debian.local>
@ 2003-05-20  9:17     ` Ivo Alxneit
  0 siblings, 0 replies; 6+ messages in thread
From: Ivo Alxneit @ 2003-05-20  9:17 UTC (permalink / raw)
  To: Brian Gough; +Cc: gsl-discuss

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ooops my initial response was not cc'ed to gsl-discuss so i include it here :
> >i get
> >row0(0) = 1, 1.1
> >row1(0) = -3.00652e-182, 7.7651e-62
> >row0(1) = 1.2, 1.3
> >row1(1) = -1.31435e+64, 3.39464e+184
> >on
> >gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
> >
> >compiler problem?
> >
> >i checked with ddd. gsl_matrix m is correctly initialized but
> >vv1=gsl_matrix_complex_row fails.
> >
> > my initial response ends here

On Monday 19 May 2003 18:42, you wrote:
> Ivo Alxneit writes:
>  > gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
>  >
>  > compiler problem?
>
> Yes, I don't think the library passes "make check" with that compiler,
> because of this problem with complex numbers.
i just tried make check 

make check stops with
make[2]: *** [check-TESTS] Error 1
make[2]: Leaving directory `/usr/local/src/gsl-1.3/eigen'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/usr/local/src/gsl-1.3/eigen'
make: *** [check-recursive] Error 1

no FAIL's in gsl/{complex,vector,matrix,block} !
careful: gsl_matrix_complex_row() is not checked but gsl_matrix_complex 
get_row PASSes!

i get a lot (1144) of FAIL's  in gsl/eigen in the herm(4) and herm(10) part. i 
dont include them here.
most of them are that i get completely different numbers than expected but 
there are also 'interesting' cases

FAIL: herm(4), eigenvalue(1,0), real, unsorted
       (-4.54283729443259248e-305 ob vs -1.77454581813773183e-307 expected)
FAIL: herm(4), eigenvalue(1,2), real, unsorted
      (-1.77454581813773144e-307 obs vs -4.54283729443259349e-305 expected)
- -> (1,0) and (1,2) exchanged??

quite some ieee errors like
nan expected versus 0/1 observed
inf expected versus 0 observed

- --
Dr. Ivo Alxneit
Laboratory for Solar Technology   phone: +41 56 310 4092
Paul Scherrer Institute             fax: +41 56 310 2624
CH-5232 Villigen                   http://solar.web.psi.ch
Switzerland                   gnupg key: 0x515E30C7
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE+yfDUAd7CE1FeMMcRAtPkAJ94X7YJQQ59QUpXeKGgD5H7MXP3jQCgvnpz
nFoOutfgDvhCnZ/amrL3HeU=
=zopR
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with gsl_matrix_complex_row
  2003-05-20 13:30 ` Dirk Eddelbuettel
@ 2003-05-20 22:15   ` Mario Pernici
  0 siblings, 0 replies; 6+ messages in thread
From: Mario Pernici @ 2003-05-20 22:15 UTC (permalink / raw)
  To: Dirk Eddelbuettel; +Cc: Mario Pernici, gsl-discuss

Hi Dirk,
 I upgraded to gcc version 3.0.4 (Red Hat Linux 7.2 3.0.4-1)
 and now it works.
 Thanks.
Bye
 Mario


On Tue, 20 May 2003, Dirk Eddelbuettel wrote:

> On Tue, May 20, 2003 at 03:01:43PM +0200, Mario Pernici wrote:
> > Dear Brian,
> >  > I cannot find what I do wrong using gsl_matrix_complex_row.
> >  > The following example gives garbage in the second row.
> >  > The corresponding example with gsl_matrix_row and doubles works 
> > correctly.
> >  > Help would be appreciated.
> >  >
> > 
> > < What platform and compiler?
> > < It works for me (gcc 2.95.4 on x86, Debian 3.0).
> > 
> >  I have Red Hat Linux 7.2 and
> >  gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
> 
> Isn't that infamous RedHat-only version known to cause all sorts of
> problems?  Can you try to upgrade to 3.0, 3.2 or 3.3, or downgrade to 2.95?
> 
> Dirk
> 
> -- 
> Don't drink and derive. Alcohol and analysis don't mix.
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with gsl_matrix_complex_row
  2003-05-20 13:01 Mario Pernici
@ 2003-05-20 13:30 ` Dirk Eddelbuettel
  2003-05-20 22:15   ` Mario Pernici
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Eddelbuettel @ 2003-05-20 13:30 UTC (permalink / raw)
  To: Mario Pernici; +Cc: gsl-discuss

On Tue, May 20, 2003 at 03:01:43PM +0200, Mario Pernici wrote:
> Dear Brian,
>  > I cannot find what I do wrong using gsl_matrix_complex_row.
>  > The following example gives garbage in the second row.
>  > The corresponding example with gsl_matrix_row and doubles works 
> correctly.
>  > Help would be appreciated.
>  >
> 
> < What platform and compiler?
> < It works for me (gcc 2.95.4 on x86, Debian 3.0).
> 
>  I have Red Hat Linux 7.2 and
>  gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)

Isn't that infamous RedHat-only version known to cause all sorts of
problems?  Can you try to upgrade to 3.0, 3.2 or 3.3, or downgrade to 2.95?

Dirk

-- 
Don't drink and derive. Alcohol and analysis don't mix.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* help with gsl_matrix_complex_row
@ 2003-05-20 13:01 Mario Pernici
  2003-05-20 13:30 ` Dirk Eddelbuettel
  0 siblings, 1 reply; 6+ messages in thread
From: Mario Pernici @ 2003-05-20 13:01 UTC (permalink / raw)
  To: gsl-discuss

Dear Brian,
 > I cannot find what I do wrong using gsl_matrix_complex_row.
 > The following example gives garbage in the second row.
 > The corresponding example with gsl_matrix_row and doubles works 
correctly.
 > Help would be appreciated.
 >

< What platform and compiler?
< It works for me (gcc 2.95.4 on x86, Debian 3.0).

 I have Red Hat Linux 7.2 and
 gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)

 Bye
  Mario




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-05-20 22:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-15 21:31 help with gsl_matrix_complex_row Mario Pernici
2003-05-19  9:42 ` Brian Gough
     [not found] ` <200305191158.43653.ivo.alxneit@psi.ch>
     [not found]   ` <16073.2415.364552.763652@debian.local>
2003-05-20  9:17     ` Ivo Alxneit
2003-05-20 13:01 Mario Pernici
2003-05-20 13:30 ` Dirk Eddelbuettel
2003-05-20 22:15   ` Mario Pernici

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).