Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ingo Schmid

HI Ed,

here's some feedback to the new release. Thank you for your tireless
efforts!

I experience errors in previously working code, at least in 2.074 and 2.075.

$r and $i are piddles, as are $empty_lines and $vlines. These lines (67

#!perl

use PDL;
use PDL::NiceSlice;

use 5.10.0;
use strict;

sub foo {
    my $r=shift; #piddle
    my $i=shift; #piddle

    my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
    unless ($empty_lines->isempty) {
    $empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
    my $vlines=$$p{y}-1-$empty_lines;
    $r(,$empty_lines,).=$r(,$vlines,); # syntax error
    $i(,$empty_lines,).=-$i(,$vlines,); # syntax error

    }
}

syntax error at /home/ingo/perl/test_errors.pl line 17, near "$r("
syntax error at /home/ingo/perl/test_errors.pl line 18, near "$i("

Could that be a PDL::NiceSlice issue?


Also, max (and probably min) are piddles now, (tested in 2.074), which
breaks some code. They used to returen perl scalars.


On 2/19/22 10:22, Ed . wrote:


Dear PDL folks,

PDL 2.075 has just been released. Notable changes since 2.064:

  * threading now called broadcasting (compat aliases created)
  * fix when readdata functions return error (#356)
  * RedoDimsCode can now use $SIZE(other_index) (#386)
  * can now unify Code and BadCode into Code, and use PDL_IF_BAD() or
#ifdef PDL_BAD_CODE
  * add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse)
in Code
  * fixes to PDL::NiceSlice including performance bug by
monkey-patching Text::Balanced::extract_multiple
  * Minuit and Slatec 64-bit safe

  * bifuncs like Ops::plus no longer need explicit swap parameter

Future plans, in something like intended order:

  * fix more open GitHub issues
  * make PDL::LinearAlgebra work right with “native complex” (several
of the above issues were related to enabling this)
  * “loop fusion” techniques to maximise locality of computation,
minimising data’s trips through the “straw” between CPU and main RAM
  * finish the independent C interface for making PDL usable from e.g.
Python
  * use OpenCL or other means to also utilise GPUs if available

The IRC channel (#pdl on irc.perl.org) is a great virtual place to
come and ask questions, or just watch the GitHub messages flow by.

As usual, please give the new PDL a try and report problems.

Best regards,

Ed



___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel
___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel


Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread David Mertens
To follow-up on max/min being piddles, this broke some of my tests in
PDL::Parallel::threads. Specifically croak-in-boolean-context is now easily
triggered where it used to be safe:

if ($data->max < 40) {  # croaks: piddle in boolean context

}

Was this use case considered and discussed? I missed it, though I haven't
always paid terribly close attention.

David

On Thu, Feb 24, 2022 at 10:18 AM Ingo Schmid  wrote:

> HI Ed,
>
> here's some feedback to the new release. Thank you for your tireless
> efforts!
>
> I experience errors in previously working code, at least in 2.074 and
> 2.075.
>
> $r and $i are piddles, as are $empty_lines and $vlines. These lines (67
>
> #!perl
>
> use PDL;
> use PDL::NiceSlice;
>
> use 5.10.0;
> use strict;
>
> sub foo {
> my $r=shift; #piddle
> my $i=shift; #piddle
>
> my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
> unless ($empty_lines->isempty) {
> $empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
> my $vlines=$$p{y}-1-$empty_lines;
> $r(,$empty_lines,).=$r(,$vlines,); # syntax error
> $i(,$empty_lines,).=-$i(,$vlines,); # syntax error
>
> }
> }
> syntax error at /home/ingo/perl/test_errors.pl line 17, near "$r("
> syntax error at /home/ingo/perl/test_errors.pl line 18, near "$i("
>
> Could that be a PDL::NiceSlice issue?
>
>
> Also, max (and probably min) are piddles now, (tested in 2.074), which
> breaks some code. They used to returen perl scalars.
>
>
> On 2/19/22 10:22, Ed . wrote:
>
> Dear PDL folks,
>
>
>
> PDL 2.075 has just been released. Notable changes since 2.064:
>
>
>
>- threading now called broadcasting (compat aliases created)
>- fix when readdata functions return error (#356)
>- RedoDimsCode can now use $SIZE(other_index) (#386)
>- can now unify Code and BadCode into Code, and use PDL_IF_BAD() or
>#ifdef PDL_BAD_CODE
>- add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in
>Code
>- fixes to PDL::NiceSlice including performance bug by monkey-patching
>Text::Balanced::extract_multiple
>- Minuit and Slatec 64-bit safe
>
>
>- bifuncs like Ops::plus no longer need explicit swap parameter
>
>
>
> Future plans, in something like intended order:
>
>- fix more open GitHub issues
>- make PDL::LinearAlgebra work right with “native complex” (several of
>the above issues were related to enabling this)
>- “loop fusion” techniques to maximise locality of computation,
>minimising data’s trips through the “straw” between CPU and main RAM
>- finish the independent C interface for making PDL usable from e.g.
>Python
>- use OpenCL or other means to also utilise GPUs if available
>
>
>
> The IRC channel (#pdl on irc.perl.org) is a great virtual place to come
> and ask questions, or just watch the GitHub messages flow by.
>
>
>
> As usual, please give the new PDL a try and report problems.
>
>
>
> Best regards,
>
> Ed
>
>
> ___
> pdl-devel mailing 
> listpdl-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/pdl-devel
>
> ___
> pdl-devel mailing list
> pdl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pdl-devel
>


-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel


Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ed .
Hi David,

Can you show a complete (small) example of using the return value of `max` in 
Boolean context that fails with the current code? I am unable to reproduce 
this, and it ought to work correctly.

The change was made in Aug 2021, with version 2.056. Those functions were never 
documented as returning Perl scalars, and I was extremely surprised when I 
discovered it then did so.

Best regards,
Ed

From: David Mertens
Sent: 24 February 2022 15:53
To: Ingo Schmid
Cc: pdl-devel
Subject: Re: [Pdl-devel] PDL 2.075 released

To follow-up on max/min being piddles, this broke some of my tests in 
PDL::Parallel::threads. Specifically croak-in-boolean-context is now easily 
triggered where it used to be safe:

if ($data->max < 40) {  # croaks: piddle in boolean context

}

Was this use case considered and discussed? I missed it, though I haven't 
always paid terribly close attention.

David

On Thu, Feb 24, 2022 at 10:18 AM Ingo Schmid 
mailto:ingo...@gmx.at>> wrote:

HI Ed,

here's some feedback to the new release. Thank you for your tireless efforts!

I experience errors in previously working code, at least in 2.074 and 2.075.

$r and $i are piddles, as are $empty_lines and $vlines. These lines (67

#!perl

use PDL;
use PDL::NiceSlice;

use 5.10.0;
use strict;

sub foo {
my $r=shift; #piddle
my $i=shift; #piddle

my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
unless ($empty_lines->isempty) {
$empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
$i(,$empty_lines,).=-$i(,$vlines,); # syntax error

}
}
syntax error at /home/ingo/perl/test_errors.pl line 17, 
near "$r("
syntax error at /home/ingo/perl/test_errors.pl line 18, 
near "$i("

Could that be a PDL::NiceSlice issue?



Also, max (and probably min) are piddles now, (tested in 2.074), which breaks 
some code. They used to returen perl scalars.


On 2/19/22 10:22, Ed . wrote:
Dear PDL folks,

PDL 2.075 has just been released. Notable changes since 2.064:


  *   threading now called broadcasting (compat aliases created)
  *   fix when readdata functions return error (#356)
  *   RedoDimsCode can now use $SIZE(other_index) (#386)
  *   can now unify Code and BadCode into Code, and use PDL_IF_BAD() or #ifdef 
PDL_BAD_CODE
  *   add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in Code
  *   fixes to PDL::NiceSlice including performance bug by monkey-patching 
Text::Balanced::extract_multiple
  *   Minuit and Slatec 64-bit safe

  *   bifuncs like Ops::plus no longer need explicit swap parameter

Future plans, in something like intended order:

  *   fix more open GitHub issues
  *   make PDL::LinearAlgebra work right with “native complex” (several of the 
above issues were related to enabling this)
  *   “loop fusion” techniques to maximise locality of computation, minimising 
data’s trips through the “straw” between CPU and main RAM
  *   finish the independent C interface for making PDL usable from e.g. Python
  *   use OpenCL or other means to also utilise GPUs if available

The IRC channel (#pdl on irc.perl.org) is a great virtual 
place to come and ask questions, or just watch the GitHub messages flow by.

As usual, please give the new PDL a try and report problems.

Best regards,
Ed




___

pdl-devel mailing list

pdl-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/pdl-devel
___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel


--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel


Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ed .
Hi Ingo,

I believe you didn’t run your code before emailing it, because $p isn’t 
defined. Also, I hope the real code doesn’t have an isempty followed by a 
Boolean check on ->nelem, because isempty is literally implemented as nelem == 
0.

When I adjust and experiment, the difference between a syntax error and not is 
removing the “unless ($empty_lines->isempty) {“ and matching “}”. Surprising! I 
am still investigating.

Best regards,
Ed

From: Ingo Schmid
Sent: 24 February 2022 15:18
To: pdl-devel@lists.sourceforge.net
Subject: Re: [Pdl-devel] PDL 2.075 released


HI Ed,

here's some feedback to the new release. Thank you for your tireless efforts!

I experience errors in previously working code, at least in 2.074 and 2.075.

$r and $i are piddles, as are $empty_lines and $vlines. These lines (67

#!perl

use PDL;
use PDL::NiceSlice;

use 5.10.0;
use strict;

sub foo {
my $r=shift; #piddle
my $i=shift; #piddle

my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
unless ($empty_lines->isempty) {
$empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
$i(,$empty_lines,).=-$i(,$vlines,); # syntax error

}
}
syntax error at /home/ingo/perl/test_errors.pl line 17, near "$r("
syntax error at /home/ingo/perl/test_errors.pl line 18, near "$i("

Could that be a PDL::NiceSlice issue?



Also, max (and probably min) are piddles now, (tested in 2.074), which breaks 
some code. They used to returen perl scalars.


On 2/19/22 10:22, Ed . wrote:
Dear PDL folks,

PDL 2.075 has just been released. Notable changes since 2.064:


  1.  threading now called broadcasting (compat aliases created)
  2.  fix when readdata functions return error (#356)
  3.  RedoDimsCode can now use $SIZE(other_index) (#386)
  4.  can now unify Code and BadCode into Code, and use PDL_IF_BAD() or #ifdef 
PDL_BAD_CODE
  5.  add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in Code
  6.  fixes to PDL::NiceSlice including performance bug by monkey-patching 
Text::Balanced::extract_multiple
  7.  Minuit and Slatec 64-bit safe

  1.  bifuncs like Ops::plus no longer need explicit swap parameter

Future plans, in something like intended order:

  1.  fix more open GitHub issues
  2.  make PDL::LinearAlgebra work right with “native complex” (several of the 
above issues were related to enabling this)
  3.  “loop fusion” techniques to maximise locality of computation, minimising 
data’s trips through the “straw” between CPU and main RAM
  4.  finish the independent C interface for making PDL usable from e.g. Python
  5.  use OpenCL or other means to also utilise GPUs if available

The IRC channel (#pdl on irc.perl.org) is a great virtual place to come and ask 
questions, or just watch the GitHub messages flow by.

As usual, please give the new PDL a try and report problems.

Best regards,
Ed




___

pdl-devel mailing list

pdl-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/pdl-devel

___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel


Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ed .
It appears (using this even more cut-down version, note the useful BEGIN bit 
which tells you what NiceSlice gets fed by Text::Balanced):

use PDL;
BEGIN { $PDL::NiceSlice::debug_filter = 1 }
use PDL::NiceSlice;

use strict;
use warnings;

my $p = {y=>0};

{
  my $r=zeroes((3) x 10); #ndarray
  my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
  {
$empty_lines=$empty_lines(0,;-);
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
  }
}

That the trigger is being nested in two levels of {}, and having a bare key of 
“y” (which is a Perl operator, a synonym for tr///). This appears to be yet 
another bug in Text::Balanced. Still investigating.

Best regards,
Ed

From: Ed .
Sent: 24 February 2022 17:22
To: Ingo Schmid; 
pdl-devel@lists.sourceforge.net
Subject: RE: [Pdl-devel] PDL 2.075 released

Hi Ingo,

I believe you didn’t run your code before emailing it, because $p isn’t 
defined. Also, I hope the real code doesn’t have an isempty followed by a 
Boolean check on ->nelem, because isempty is literally implemented as nelem == 
0.

When I adjust and experiment, the difference between a syntax error and not is 
removing the “unless ($empty_lines->isempty) {“ and matching “}”. Surprising! I 
am still investigating.

Best regards,
Ed

From: Ingo Schmid
Sent: 24 February 2022 15:18
To: pdl-devel@lists.sourceforge.net
Subject: Re: [Pdl-devel] PDL 2.075 released


HI Ed,

here's some feedback to the new release. Thank you for your tireless efforts!

I experience errors in previously working code, at least in 2.074 and 2.075.

$r and $i are piddles, as are $empty_lines and $vlines. These lines (67

#!perl

use PDL;
use PDL::NiceSlice;

use 5.10.0;
use strict;

sub foo {
my $r=shift; #piddle
my $i=shift; #piddle

my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
unless ($empty_lines->isempty) {
$empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
$i(,$empty_lines,).=-$i(,$vlines,); # syntax error

}
}
syntax error at /home/ingo/perl/test_errors.pl line 17, near "$r("
syntax error at /home/ingo/perl/test_errors.pl line 18, near "$i("

Could that be a PDL::NiceSlice issue?



Also, max (and probably min) are piddles now, (tested in 2.074), which breaks 
some code. They used to returen perl scalars.


On 2/19/22 10:22, Ed . wrote:
Dear PDL folks,

PDL 2.075 has just been released. Notable changes since 2.064:


  1.  threading now called broadcasting (compat aliases created)
  2.  fix when readdata functions return error (#356)
  3.  RedoDimsCode can now use $SIZE(other_index) (#386)
  4.  can now unify Code and BadCode into Code, and use PDL_IF_BAD() or #ifdef 
PDL_BAD_CODE
  5.  add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in Code
  6.  fixes to PDL::NiceSlice including performance bug by monkey-patching 
Text::Balanced::extract_multiple
  7.  Minuit and Slatec 64-bit safe

  1.  bifuncs like Ops::plus no longer need explicit swap parameter

Future plans, in something like intended order:

  1.  fix more open GitHub issues
  2.  make PDL::LinearAlgebra work right with “native complex” (several of the 
above issues were related to enabling this)
  3.  “loop fusion” techniques to maximise locality of computation, minimising 
data’s trips through the “straw” between CPU and main RAM
  4.  finish the independent C interface for making PDL usable from e.g. Python
  5.  use OpenCL or other means to also utilise GPUs if available

The IRC channel (#pdl on irc.perl.org) is a great virtual place to come and ask 
questions, or just watch the GitHub messages flow by.

As usual, please give the new PDL a try and report problems.

Best regards,
Ed



___

pdl-devel mailing list

pdl-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/pdl-devel


___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel


Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ingo Schmid
Ed & David,

I stumbled across the problem because of this behaviour:

pdl> p max pdl[]

BAD

which does not expand to 0 as would an undef perl scalar.  Here's the
function. The isbad() line was necessary to catch the case where which
returns an empty list.

sub openBox {

    my $filename=shift;

    my $filename2=shift;

    my $time=shift;

    $c_ti = 0;

    $c_loc = 0;

    if ( -f $filename && -f $filename2)  {

    $c_loc = 4;

    $pos=rcols( $filename, [], {LINES=>"1:"})->transpose; #
{ HEADER => "$border{0} $border{1} $border{2} $border{3}"};

    $posSF=rcols( $filename2, [], {LINES=>"1:"})->transpose;
# { HEADER => "$border{0} $border{1} $border{2} $border{3}"};

    do {

    $c_loc--;

    $c_ti=sclr max (which ($pos($c_loc)>-1));

    $c_ti=0 if isbad($c_ti);

    #say "border $c_loc time $c_ti";

    }

    while ($c_ti <= 0 && $c_loc>0) ;

    #say "Reading from file $filename; Size of box file
",$pos->info;

    } else {

    $pos = zeroes(4,$time)-1;

    $posSF = zeroes(4,$time)-1;

    }

    #say "border (open) $c_loc";

}




On 2/24/2022 5:51 PM, Ed . wrote:
>
> Hi David,
>
>  
>
> Can you show a complete (small) example of using the return value of
> `max` in Boolean context that fails with the current code? I am unable
> to reproduce this, and it ought to work correctly.
>
>  
>
> The change was made in Aug 2021, with version 2.056. Those functions
> were never documented as returning Perl scalars, and I was extremely
> surprised when I discovered it then did so.
>
>  
>
> Best regards,
>
> Ed
>
>  
>
> *From: *David Mertens 
> *Sent: *24 February 2022 15:53
> *To: *Ingo Schmid 
> *Cc: *pdl-devel 
> *Subject: *Re: [Pdl-devel] PDL 2.075 released
>
>  
>
> To follow-up on max/min being piddles, this broke some of my tests in
> PDL::Parallel::threads. Specifically croak-in-boolean-context is now
> easily triggered where it used to be safe:
>
>  
>
> if ($data->max < 40) {  # croaks: piddle in boolean context
>
>     
>
> }
>
>  
>
> Was this use case considered and discussed? I missed it, though I
> haven't always paid terribly close attention.
>
>  
>
> David
>
>  
>
> On Thu, Feb 24, 2022 at 10:18 AM Ingo Schmid  wrote:
>
> HI Ed,
>
> here's some feedback to the new release. Thank you for your
> tireless efforts!
>
> I experience errors in previously working code, at least in 2.074
> and 2.075.
>
> $r and $i are piddles, as are $empty_lines and $vlines. These
> lines (67
>
> #!perl
>
> use PDL;
> use PDL::NiceSlice;
>
> use 5.10.0;
> use strict;
>
> sub foo {
>     my $r=shift; #piddle
>     my $i=shift; #piddle
>
>     my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
>     unless ($empty_lines->isempty) {
>     $empty_lines=$empty_lines(0,;-) if
> $empty_lines->nelem;
>     my $vlines=$$p{y}-1-$empty_lines;
>     $r(,$empty_lines,).=$r(,$vlines,); # syntax error
>     $i(,$empty_lines,).=-$i(,$vlines,); # syntax error
>     
>     }
> }   
>
> syntax error at /home/ingo/perl/test_errors.pl
>  line 17, near "$r("
> syntax error at /home/ingo/perl/test_errors.pl
>  line 18, near "$i("
>
> Could that be a PDL::NiceSlice issue?
>
>  
>
> Also, max (and probably min) are piddles now, (tested in 2.074),
> which breaks some code. They used to returen perl scalars.
>
>  
>
> On 2/19/22 10:22, Ed . wrote:
>
> Dear PDL folks,
>
>  
>
> PDL 2.075 has just been released. Notable changes since 2.064:
>
>  
>
>   * threading now called broadcasting (compat aliases created)
>   * fix when readdata functions return error (#356)
>   * RedoDimsCode can now use $SIZE(other_index) (#386)
>   * can now unify Code and BadCode into Code, and use
> PDL_IF_BAD() or #ifdef PDL_BAD_CODE
>   * add macros
> PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in Code
>   * fixes to PDL::NiceSlice including performance bug by
> monkey-patching Text::Balanced::extract_multiple
>   * Minuit and Slatec 64-bit safe
>
>   * bifuncs like Ops::plus no longer need explicit swap parameter
>
>  
>
> Future plans, in something like intended order:
>
>   * fix more open GitHub issues
>   * make PDL::LinearAlgebra work right with “native complex”
> (several of the above issues were related to enabling this)
>   * “loop fusion” techniques to maximise locality of

Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ed .
Hi Ingo,

You can get exactly the old behaviour if you were to use 
“max(which($pos($c_loc)>-1))->at”, since that’s the bit that was removed from 
the Ufunc code.

Best regards,
Ed

From: Ingo Schmid
Sent: 24 February 2022 19:08
To: Ed .; David 
Mertens
Cc: pdl-devel
Subject: Re: [Pdl-devel] PDL 2.075 released


Ed & David,

I stumbled across the problem because of this behaviour:

pdl> p max pdl[]

BAD

which does not expand to 0 as would an undef perl scalar.  Here's the function. 
The isbad() line was necessary to catch the case where which returns an empty 
list.
sub openBox {

my $filename=shift;

my $filename2=shift;

my $time=shift;

$c_ti = 0;

$c_loc = 0;

if ( -f $filename && -f $filename2)  {

$c_loc = 4;

$pos=rcols( $filename, [], {LINES=>"1:"})->transpose; # { 
HEADER => "$border{0} $border{1} $border{2} $border{3}"};

$posSF=rcols( $filename2, [], {LINES=>"1:"})->transpose; # { 
HEADER => "$border{0} $border{1} $border{2} $border{3}"};

do {

$c_loc--;

$c_ti=sclr max (which ($pos($c_loc)>-1));

$c_ti=0 if isbad($c_ti);

#say "border $c_loc time $c_ti";

}

while ($c_ti <= 0 && $c_loc>0) ;

#say "Reading from file $filename; Size of box file 
",$pos->info;

} else {

$pos = zeroes(4,$time)-1;

$posSF = zeroes(4,$time)-1;

}

#say "border (open) $c_loc";

}



On 2/24/2022 5:51 PM, Ed . wrote:
Hi David,

Can you show a complete (small) example of using the return value of `max` in 
Boolean context that fails with the current code? I am unable to reproduce 
this, and it ought to work correctly.

The change was made in Aug 2021, with version 2.056. Those functions were never 
documented as returning Perl scalars, and I was extremely surprised when I 
discovered it then did so.

Best regards,
Ed

From: David Mertens
Sent: 24 February 2022 15:53
To: Ingo Schmid
Cc: pdl-devel
Subject: Re: [Pdl-devel] PDL 2.075 released

To follow-up on max/min being piddles, this broke some of my tests in 
PDL::Parallel::threads. Specifically croak-in-boolean-context is now easily 
triggered where it used to be safe:

if ($data->max < 40) {  # croaks: piddle in boolean context

}

Was this use case considered and discussed? I missed it, though I haven't 
always paid terribly close attention.

David

On Thu, Feb 24, 2022 at 10:18 AM Ingo Schmid 
mailto:ingo...@gmx.at>> wrote:

HI Ed,

here's some feedback to the new release. Thank you for your tireless efforts!

I experience errors in previously working code, at least in 2.074 and 2.075.

$r and $i are piddles, as are $empty_lines and $vlines. These lines (67

#!perl

use PDL;
use PDL::NiceSlice;

use 5.10.0;
use strict;

sub foo {
my $r=shift; #piddle
my $i=shift; #piddle

my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
unless ($empty_lines->isempty) {
$empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
$i(,$empty_lines,).=-$i(,$vlines,); # syntax error

}
}
syntax error at /home/ingo/perl/test_errors.pl line 17, 
near "$r("
syntax error at /home/ingo/perl/test_errors.pl line 18, 
near "$i("

Could that be a PDL::NiceSlice issue?



Also, max (and probably min) are piddles now, (tested in 2.074), which breaks 
some code. They used to returen perl scalars.


On 2/19/22 10:22, Ed . wrote:
Dear PDL folks,

PDL 2.075 has just been released. Notable changes since 2.064:

1.  threading now called broadcasting (compat aliases created)
2.  fix when readdata functions return error (#356)
3.  RedoDimsCode can now use $SIZE(other_index) (#386)
4.  can now unify Code and BadCode into Code, and use PDL_IF_BAD() or 
#ifdef PDL_BAD_CODE
5.  add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in 
Code
6.  fixes to PDL::NiceSlice including performance bug by monkey-patching 
Text::Balanced::extract_multiple
7.  Minuit and Slatec 64-bit safe
1.  bifuncs like Ops::plus no longer need explicit swap parameter

Future plans, in something like intended order:
1.  fix more open GitHub issues
2.  make PDL::LinearAlgebra work right with “native complex” (several of 
the above issues were related to enabling this)
3.  “loop fusion” techniques to maximise locality of computation, 
minimising data’s trips through the “straw” between CPU and main RAM
4.  finish the i

Re: [Pdl-devel] PDL 2.075 released

2022-02-24 Thread Ed .
In fact, I was wrong! It was bugs in both Text::Balanced and Filter::Simple. 
Workarounds have been added to PDL::NiceSlice, and the pull-request on T:B has 
been enhanced. Also the tests for NiceSlice are now much better set up to 
capture problems like this in the future, so please keep reporting them!

I’ve just released 2.076 with that plus other fixes. Please give it a go!

Best regards,
Ed

From: Ed .
Sent: 24 February 2022 17:44
To: Ingo Schmid; 
pdl-devel@lists.sourceforge.net
Subject: RE: [Pdl-devel] PDL 2.075 released

It appears (using this even more cut-down version, note the useful BEGIN bit 
which tells you what NiceSlice gets fed by Text::Balanced):

use PDL;
BEGIN { $PDL::NiceSlice::debug_filter = 1 }
use PDL::NiceSlice;

use strict;
use warnings;

my $p = {y=>0};

{
  my $r=zeroes((3) x 10); #ndarray
  my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
  {
$empty_lines=$empty_lines(0,;-);
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
  }
}

That the trigger is being nested in two levels of {}, and having a bare key of 
“y” (which is a Perl operator, a synonym for tr///). This appears to be yet 
another bug in Text::Balanced. Still investigating.

Best regards,
Ed

From: Ed .
Sent: 24 February 2022 17:22
To: Ingo Schmid; 
pdl-devel@lists.sourceforge.net
Subject: RE: [Pdl-devel] PDL 2.075 released

Hi Ingo,

I believe you didn’t run your code before emailing it, because $p isn’t 
defined. Also, I hope the real code doesn’t have an isempty followed by a 
Boolean check on ->nelem, because isempty is literally implemented as nelem == 
0.

When I adjust and experiment, the difference between a syntax error and not is 
removing the “unless ($empty_lines->isempty) {“ and matching “}”. Surprising! I 
am still investigating.

Best regards,
Ed

From: Ingo Schmid
Sent: 24 February 2022 15:18
To: pdl-devel@lists.sourceforge.net
Subject: Re: [Pdl-devel] PDL 2.075 released


HI Ed,

here's some feedback to the new release. Thank you for your tireless efforts!

I experience errors in previously working code, at least in 2.074 and 2.075.

$r and $i are piddles, as are $empty_lines and $vlines. These lines (67

#!perl

use PDL;
use PDL::NiceSlice;

use 5.10.0;
use strict;

sub foo {
my $r=shift; #piddle
my $i=shift; #piddle

my $empty_lines=(whichND ($r(0,,0,0,0,0,0,0;-)==0));
unless ($empty_lines->isempty) {
$empty_lines=$empty_lines(0,;-) if $empty_lines->nelem;
my $vlines=$$p{y}-1-$empty_lines;
$r(,$empty_lines,).=$r(,$vlines,); # syntax error
$i(,$empty_lines,).=-$i(,$vlines,); # syntax error

}
}
syntax error at /home/ingo/perl/test_errors.pl line 17, near "$r("
syntax error at /home/ingo/perl/test_errors.pl line 18, near "$i("

Could that be a PDL::NiceSlice issue?



Also, max (and probably min) are piddles now, (tested in 2.074), which breaks 
some code. They used to returen perl scalars.


On 2/19/22 10:22, Ed . wrote:
Dear PDL folks,

PDL 2.075 has just been released. Notable changes since 2.064:


  1.  threading now called broadcasting (compat aliases created)
  2.  fix when readdata functions return error (#356)
  3.  RedoDimsCode can now use $SIZE(other_index) (#386)
  4.  can now unify Code and BadCode into Code, and use PDL_IF_BAD() or #ifdef 
PDL_BAD_CODE
  5.  add macros PDL_IF_GENTYPE_{REAL,INTEGER,UNSIGNED}(iftrue,iffalse) in Code
  6.  fixes to PDL::NiceSlice including performance bug by monkey-patching 
Text::Balanced::extract_multiple
  7.  Minuit and Slatec 64-bit safe

  1.  bifuncs like Ops::plus no longer need explicit swap parameter

Future plans, in something like intended order:

  1.  fix more open GitHub issues
  2.  make PDL::LinearAlgebra work right with “native complex” (several of the 
above issues were related to enabling this)
  3.  “loop fusion” techniques to maximise locality of computation, minimising 
data’s trips through the “straw” between CPU and main RAM
  4.  finish the independent C interface for making PDL usable from e.g. Python
  5.  use OpenCL or other means to also utilise GPUs if available

The IRC channel (#pdl on irc.perl.org) is a great virtual place to come and ask 
questions, or just watch the GitHub messages flow by.

As usual, please give the new PDL a try and report problems.

Best regards,
Ed


___

pdl-devel mailing list

pdl-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/pdl-devel



___
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel