If I change the NiceSlice engine, using

    $ PDL_NICESLICE_ENGINE=Filter::Util::Call program.pl

I don't get the error, and the output of the filter is

    my $x=sequence(1);
    my $V=$x/$x->slice([-1,0,0]);
    #my $w=$A/$y->slice([-1,0,0]);

so that both the actual $x((-1)) and the same in the comment are
replaced by a call to 'slice'. The same happens if I use

    $ PDL_NICESLICE_ENGINE=Module::Compile program.pl

Thus, I guess the problem lies in PDL::NiceSlice::FilterSimple

Regards,
Luis




On Fri, Nov 04, 2022 at 05:41:46PM -0600, Luis Mochan wrote:
> Well, I found how to get the output from the filter.
> Consider the code:
>
>     #! /usr/bin/env perl
>     use PDL;
>     use PDL::NiceSlice;
>     use Filter::sh 'tee rem1.pl';
>     my $x=sequence(1);
>     my $V=$x/$x((-1));  #my $w=$A/$x((-1));
>
> The line
>
>     use Filter::sh 'tee rem1.pl';
>
> sends a copy of the last lines of the preprocessed source to the file
> rem1.pl. After feeding the code above to perl, the contents of rem1.pl
> are
>
>     my $x=sequence(1);
>     my $V=$x/$x((-1));
>     #my $w=$A/$x->slice([-1,0,0]);
>
> This shows that the NiceSlice filter is applied to the $x in the
> comment and not to the $x in the executable line. This happens even if
> I use $y instead of $x in the comment.
>
> Regards,
> Luis
>
>
>
> On Fri, Nov 04, 2022 at 11:46:05PM +0300, Yury Pakhomov wrote:
> > Hi Ed,
> >
> > I use last version of PDL 2.081. This problem also affected preview 2.080
> > version.
> >
> > Other machine has Fedora Core 36 with perl 5.34 and PDL 2.076
> >
> > Best regards,
> >
> > Yury
> >
> > 04.11.2022 18:49, Ed. пишет:
> > >
> > > Hi Yury,
> > >
> > > I had a look and I don’t think Slackware packages PDL. Can you tell us
> > > what version of PDL you have installed, on the two machines where you’ve
> > > tried your script?
> > >
> > > Best regards,
> > >
> > > Ed
> > >
> > > *From: *Yury Pakhomov <mailto:pakho...@inasan.ru>
> > > *Sent: *03 November 2022 13:14
> > > *To: *perldl <mailto:pdl-general@lists.sourceforge.net>
> > > *Subject: *[Pdl-general] PDL::NiceSlice and Perl 5.36
> > >
> > > Hello All!
> > >
> > > After update my system (Slackware 15) some PDL programs crashed.
> > > For example, below is simple part of my code.
> > >
> > > code.pl
> > > ________________________________
> > > #! /usr/bin/perl -w
> > > #use v5.36;
> > > use PDL;
> > > use PDL::NiceSlice;
> > >
> > > my $c=299792;
> > >
> > > my $x=5000+sequence(100);
> > >
> > > # Average step in lam
> > > my $dx=($x((-1))-$x((0)))/(nelem($x)-1);
> > >
> > > # Minimal step in V scale
> > > my $dV=$c*$dx/$x((-1));
> > >
> > > # Create uniform V scale (km/s)
> > > my $n=int(log($x((-1))/$x((0)))/log(1+$dV/$c))+2;
> > > my $v=sequence($n)*$dV;
> > > _________________________________
> > >
> > > # perl -c code.pl
> > > syntax error at bad2.pl line 14, near "$x("
> > > bad2.pl had compilation errors.
> > >
> > > If I change line 14 to "my $dV=$c*$dx/$x->at(-1)->sclr;" then works fine.
> > > Also the original code in other computer (perl 5.34) works fine too.
> > > Moreover, if delete last three lines in code.pl, then it works!
> > > Where source of these errors?
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > pdl-general mailing list
> > > pdl-general@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/pdl-general
> > >
>
>
> > _______________________________________________
> > pdl-general mailing list
> > pdl-general@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/pdl-general
>
>
> --
>
>                                                                   o
> W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
> Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
> Av. Universidad s/n CP 62210         |                           (*)/\/  \
> Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/
> GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB
>
>
> _______________________________________________
> pdl-general mailing list
> pdl-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pdl-general

-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Av. Universidad s/n CP 62210         |                           (*)/\/  \
Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB


_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to