Please discard my previous posting. I now see I missed brackets in the
Pars section.
I've now got the file to compile, and now get the error
Error in Pdgsev_:Wrong dims
at the moment of the call with the attached perl file.
Apparently, I miss out on something with the dimensions...
-----------------------------
use blib; # when using inside the dist tree
use PDL; # this must be called before (!) 'use Inline Pdlpp' calls
use POSIX;
# for this example you need the numerical recipes library
# edit the INC and LIBS info below to point
# Inline towards the location of include and library files
use Inline Pdlpp => Config =>
INC => "-I$ENV{HOME}/include",
LIBS => "-L$ENV{HOME}/lib -llapack -lm",
AUTO_INCLUDE => <<'EOINC',
#include <math.h>
#ifdef USE_HEADER
#include "f2c.h" /* type definitions for a files */
#include "../../../clapack.h" /* Definitions of all routines */
#else
extern void dgesv_(int *n, int *nrhs, double *a, int *lda,
int *ipiv, double *b, int *ldb, int *info);
#endif
EOINC
BOOT => ''; # catch errors at the perl level
use Inline Pdlpp; # the actual code is in the __Pdlpp__ block below
$n= pdl 4;
$A = PDL->zeroes(double ,$n,$n);
for $i (0.. $n-1 ) {
for $j (0.. $n-1 ) {
set $A,$i,$j , pow($i,$j)+$n*$j+1;
}
}
$oneone = pdl 1;
$b = PDL->zeroes(double ,$n,$oneone);
for $i (0.. $n-1 ) {
set $b,$i,0, pow(2,$i+1);
}
$ipiv = PDL->zeroes(int ,$n);
$info = pdl -1;
print $A;
print $b;
print "\n";
PDL::Pdgsev_($n,$oneone,$A,$n,$ipiv,$b,$n,$info);
print $info;
print $b;
# Other approach
# Pars => ' [o] a (lda,n); int [o] ipiv(n); [o] b (ldb,nrhs); int
[o] info;',
# Code => 'dgesv_($SIZE(n), $SIZE(nrhs), $P(a), $SIZE(lda), $P(ipiv),
$P(b), $SIZE(ldb), $P(info) );',
__DATA__
__Pdlpp__
# Call dgsev
pp_def('Pdgsev_',
Pars => 'int n();int nrhs();double [o]a(lda,n);int lda();int [o]ipiv(n);
double [o]b(ldb,nrhs); int ldb();int [o]info();',
GenericTypes => [D],
Code => 'dgesv_($P(n), $P(nrhs), $P(a), $P(lda), $P(ipiv), $P(b),
$P(ldb), $P(info) );',
);
-----------------------------
Jan Hoogenraad wrote:
> Please help me with starting an interface to lapack.
> Chris Marshall (marshallch) requested that I'll put my progress and
> questions onto this list.
>
> I've come as far as installing PDL and starting to use inlpp_link.pl as
> a template.
>
> I set up attached .pl file. This does not compile, as line 64 does not
> parse.
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl