I am attempting to create an PDL interface to a Fortran function that
solves quadratic programming problems. I've made a fair bit of
progress getting up the PDL::PP, Fortran and XS learning curve, but I
am currently stumped by follow error message:

  Error in qpgen2:Wrong dims
   at .../PDL-QP/blib/lib/PDL/Opt/QP.pm line 148.
          PDL::Opt::QP::qp('PDL=SCALAR(0x10082e280)',
'PDL=SCALAR(0x1008362e0)', 'PDL=SCALAR(0x100891188)',
'PDL=SCALAR(0x1008360e8)', 'PDL=SCALAR(0x10082e3b8)')

I was able to trace it to a line in the .xs file, but I'm still at a
loss. I assume it is telling me that I'm calling the pp_def'd function
qpgen2 with the wrong arguments. I think the relevant code is:

pp_def("qpgen2",
    Pars => 'dmat(m,m); dvec(m); int fddmat(); int n();
        [o]sol(m); [o]lagr(q); [o]crval();
        amat(m,q); bvec(q); int fdamat(); int q(); int meq();
        int [o]iact(q); int [o]nact();
        int [o]iter(s=2); [t]work(z); int [io]ierr();
    ', ....

and the call:

  my $res = qpgen2(
            $Dmat,  # isPDL: Double D [3,3]
            $dvec,  # isPDL: Double D [3]
            $n,     # isPDL: Double D []
            $n,     # isPDL: Double D []
            $sol,   # isPDL: Double D [3]
            $lagr,  # isPDL: Double D [2]
            $crval, # isPDL: Double D []
            $Amat,  # isPDL: Double D [2,3]
            $bvec,  # isPDL: Double D [1,2]
            $n,     # isPDL: Double D []
            $q,     # isPDL: Double D []
            $meq,   # isPDL: Double D []
            $iact,  # isPDL: Double D []
            $nact,  # isPDL: Double D []
            $iter,  # isPDL: Double D [2]
            $work,  # isPDL: Double D [18]
            $ierr,  # isPDL: Double D []
        );

I've uploaded the project to github, if anyone would like dig deeper:

  https://github.com/mvgrimes/pdl-opt-qp

Thanks,
Mark

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to