Hi,
I willl provide an example tomorrow, it was very busy today. I thought
the info of the PDL dims were showing what the problem is.
Also, I tried reading the slatec module's doc, not comprehending much.
Then I luckily found the Func module. I admit I have difficulties in
reading signatures, although successfully working with PDL for years now.
Anyways, your replies are greatly appreciated.
PDL v. 2.4.10
Ingo
PS:
$ perl -V
Summary of my perl5 (revision 5 version 12 subversion 4) configuration:
Platform:
osname=linux, osvers=3.1.5-gentoo, archname=x86_64-linux-thread-multi
uname='linux riococo 3.1.5-gentoo #1 smp mon dec 12 16:41:23 cet
2011 x86_64 intel(r) xeon(r) cpu w3520 @ 2.67ghz genuineintel gnulinux '
config_args='-des -Duseshrplib -Darchname=x86_64-linux-thread
-Dcc=x86_64-pc-linux-gnu-gcc -Doptimize=-O2 -pipe -march=core2
-fomit-frame-pointer -msse4 -msse4.1 -msse4.2 -mcx16 -msahf
-Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dinstallprefix=/usr
-Dsiteprefix=/usr -Dvendorprefix=/usr -Dscriptdir=/usr/bin
-Dprivlib=/usr/lib64/perl5/5.12.4
-Darchlib=/usr/lib64/perl5/5.12.4/x86_64-linux-thread-multi
-Dsitelib=/usr/lib64/perl5/site_perl/5.12.4
-Dsitearch=/usr/lib64/perl5/site_perl/5.12.4/x86_64-linux-thread-multi
-Dvendorlib=/usr/lib64/perl5/vendor_perl/5.12.4
-Dvendorarch=/usr/lib64/perl5/vendor_perl/5.12.4/x86_64-linux-thread-multi
-Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3
-Dsiteman1dir=/usr/share/man/man1 -Dsiteman3dir=/usr/share/man/man3
-Dvendorman1dir=/usr/share/man/man1 -Dvendorman3dir=/usr/share/man/man3
-Dman1ext=1 -Dman3ext=3pm -Dlibperl=libperl.so.5.12.4
-Dlocincpth=/usr/include -Dglibpth=/lib64 /usr/lib64 -Duselargefiles
-Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost
-Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm
-Di_ndbm -Di_gdbm -Di_db -Dusethreads -DDEBUGGING=none
-Dinc_version_list=5.12.3/x86_64-linux-thread-multi 5.12.3
5.12.2/x86_64-linux-thread-multi 5.12.2 5.12.1/x86_64-linux-thread-multi
5.12.1 5.12.0/x86_64-linux-thread-multi 5.12.0
-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dnoextensions=ODBM_File'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='x86_64-pc-linux-gnu-gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE
-fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -pipe -march=core2 -fomit-frame-pointer -msse4
-msse4.1 -msse4.2 -mcx16 -msahf',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe'
ccversion='', gccversion='4.5.3', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='x86_64-pc-linux-gnu-gcc', ldflags ='-Wl,-O1 -Wl,--as-needed'
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
-lgdbm_compat
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.14.1.so, so=so, useshrplib=true,
libperl=libperl.so.5.12.4
gnulibc_version='2.14.1'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -pipe -march=core2
-fomit-frame-pointer -msse4 -msse4.1 -msse4.2 -mcx16 -msahf -Wl,-O1
-Wl,--as-needed'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
Locally applied patches:
0001-gentoo_MakeMaker-RUNPATH.diff
0002-gentoo_config_over.diff
0003-gentoo_cpan_definstalldirs.diff
0004-gentoo_cpanplus_definstalldirs.diff
0005-gentoo_create-libperl-soname.diff
0006-gentoo_MakeMaker-delete_packlist.diff
0007-fixes_8d66b3f9_h2hp_fix.diff
0008-fixes_f178b03b_h2ph_using_deprecated_goto.diff
0009-gentoo_mod-paths.diff
0010-gentoo_enc2xs.diff
0011-gentoo_IO-Compress_AutoLoader_dropped_from_Compress-Zlib.diff
0012-gentoo_drop-fstack-protector.diff
Built under linux
Compiled at Mar 5 2012 10:55:36
@INC:
/etc/perl
/usr/lib64/perl5/site_perl/5.12.4/x86_64-linux-thread-multi
/usr/lib64/perl5/site_perl/5.12.4
/usr/lib64/perl5/vendor_perl/5.12.4/x86_64-linux-thread-multi
/usr/lib64/perl5/vendor_perl/5.12.4
/usr/lib64/perl5/site_perl/5.12.1/x86_64-linux-thread-multi
/usr/lib64/perl5/site_perl/5.12.1
/usr/lib64/perl5/site_perl
/usr/lib64/perl5/vendor_perl/5.12.3/x86_64-linux-thread-multi
/usr/lib64/perl5/vendor_perl/5.12.3
/usr/lib64/perl5/vendor_perl/5.12.2/x86_64-linux-thread-multi
/usr/lib64/perl5/vendor_perl/5.12.2
/usr/lib64/perl5/vendor_perl/5.12.1/x86_64-linux-thread-multi
/usr/lib64/perl5/vendor_perl/5.12.1
/usr/lib64/perl5/vendor_perl
/usr/lib64/perl5/5.12.4/x86_64-linux-thread-multi
/usr/lib64/perl5/5.12.4
/usr/local/lib/site_perl
On 04/17/2012 04:27 PM, David Mertens wrote:
Actually, seconding my second, a good working (failing) example can be
the starting point for new failing tests, which are *always* useful in
development.
On Tue, Apr 17, 2012 at 9:26 AM, David Mertens
<[email protected] <mailto:[email protected]>> wrote:
On Tue, Apr 17, 2012 at 6:41 AM, Chris Marshall
<[email protected] <mailto:[email protected]>> wrote:
Hi Ingo,
Do you have a simple test case to
show the problem? What version
of perl+PL... do you have?
See BUGS in the PDL distribution for
the information needed for problem
reports.
--Chris
Ingo, I will second what Chris said. It's always helpful to give a
complete working (i.e. failing) example so that we devs can just
copy-and-paste it into an editor and start hacking. Also, the full
error message might have been helpful here as well, as it likely
would have given us this line number where the dimension mismatch
occurred. To make a long story short, this is a bug with
PDL::Func. Your best bet is to file a bug report on
sourceforge.net <http://sourceforge.net> here:
http://sourceforge.net/tracker/?func=browse&group_id=612&atid=100612&status=1
<http://sourceforge.net/tracker/?func=browse&group_id=612&atid=100612&status=1>.
I suggest using a title such as "PDL::Func does thread properly"
since the code works fine if you want the interpolation at a
single x-value. Be sure to read the instructions when adding a bug
(i.e. include the output of perldl -V, etc).
Even though you did not provide a working example, a difference in
dimension handling is usually pretty easy to pick out from the
module's code itself, so I decided to simply look over PDL::Func's
code. For devs and other interested parties, see PDL::Func
(Lib/Func.pm in the repo) starting around line 723. Hermite
interpolation uses the chfe routine provided by PDL::Slatec while
linear interpolation uses the interpolate routine provided by
PDL::Primitive. These two routines expect different kinds of
inputs, as evidenced by their signatures (which are far from
obvious and which I explain next):
chfe (x(n);f(n);d(n);int check();xe(ne);[o]fe(ne);int [o]ierr())
interpolate (xi(); x(n); y(n); [o] yi(); int [o] err())
For the Slatec function chfe(), x(n) and f(n) are the known x and
y values to be used in the interpolation. d(n) is... something
(the derivatives at these points, perhaps?); the docs do not make
it clear. The important point is that the value of x at which we
want interpolation are given by xe(ne). For interpolate(), x(n)
and y(n) are the known x and y values and the x at which we want
interpolation is xi(). NOTICE THE DIFFERENCE IN THE DIMENSION
between xi() and xe(ne). This difference was not properly
accounted for by Doug and means that the hermite interpolation and
linear interpolation interfaces are not interchangeable as
written. That sucks, as the whole point of this module was to
unify the interface between two distinct packages. Properly
reconciling differences in dimension handling is doable but
tricky, and writing cogent documentation to explain the dimension
handling is even trickier. :-P
David
On 4/17/12, Ingo Schmid <[email protected]
<mailto:[email protected]>> wrote:
> Hi,
>
> I just noticed that when using interpolate, there is an
inconsistency
> when changing from 'Hermite' to 'Linear' and threading. This
is my code.
> When I try 'Linear' it barfs with thread dim 0 mismatch.
>
> my $seq=sequence(eval $p{kx})-$p{kx}/2;
> say
$r->info,cat($r,$i)->info,$resample->info,$seq->info;
> >PDL: Double D [256,128,1,1,2,32]PDL: Double D
[256,128,1,1,2,32,2]PDL:
> Double D [256]PDL: Double D [256]
> my $obj=PDL::Func->init(Interpolate => "Hermite", x
> =>$resample, y=>cat($r,$i));
> my $kres=($obj->interpolate($seq))->mv(0,-1);
>
>
> Btw., are there other schemes/modules to try?
> Best
> Ingo
>
>
>
_______________________________________________
Perldl mailing list
[email protected] <mailto:[email protected]>
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
--
"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
--
"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
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl