#10 err in diagonal


The following code gives an error message that is not always reproducable:
>$unitma = zeroes 3,3
>($tmp = $unitma->diagonal(0,1)) .=1

PDL barfed: Error in diagonalI:Diagonal: dims must be unique

To be honest, I can not say under which circumstances it occurs ( this
code is part of a bigger programm), but sometimes it's there.


  • john gehman

    john gehman - 2001-01-10

    I have a similar frustrating experience with `diagonal'. I'm using PDL-2.1.1, ExtUtils-F77-1.13, and egcs-g77-1.1.2-30

    I initially characterized the bug using the following code:

    use PDL;
    use PDL::Math;
    use strict;

    my $stepsize = 0.001;
    my @array = (0 .. 1000);
    my @_mixtimes = map { $stepsize * $_ } @array;
    #print "Meaningless print statement\n";

    my $_dc = pdl [

    my ($U,$eval) = eigens($_dc);

    foreach my $m ( @_mixtimes ) {
    my $Dt = $eval * $m;
    my $dc_n = zeroes $_dc;
    ( my $tmp = $dc_n->diagonal(0,1) ) += exp( $Dt );
    my $propagator = transpose($U) x $dc_n x $U;
    print "$m\n";

    With the "Meaningless print statement commented out, the program runs to $m = 0.065 and then I get

    PDL barfed: Error in diagonalI::Diagonal: dims must be unique
    Caught in file diagonal.pl, line 23, pkg main

    When I uncommented the "Meaningless print statement." I got the same error, but after $m = 0.346

    NOW, being a different day, I get the error after 0.065 regardless of the "Meaningless print statement" begin commented out or not.

    So, I echo schmauder's comments regarding the irritating and irreproducible nature of the diagonal bug. I think it must have something to do with memory allocation.

  • Christian Soeller

    • assigned_to: nobody --> csopen
    • milestone: 100444 --> critical
  • Christian Soeller

    fixed in cvs

  • Christian Soeller

    • status: open --> closed-fixed
  • Christian Soeller

    fixed in cvs


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks