Hi Luis,

For backward compatibility, operations default to supporting all real types, 
which is why you’re getting LDouble (the highest-numbered real type, but still 
below the complex ones). To make the various Image* operations work on native 
complex values, they just need telling to do so.

Could you try patching Libtmp/Image2D/image2d.pd with this at the top (cribbed 
from Basic/Ops/ops.pd) before the pp_addpm:

my $A = [ppdefs_all];

Then add “GenericTypes => $A” to at least the pp_def of conv2d, around line 266?

Please let us know if that works (you’d need to do a “make install”, or else a 
“make basic” then “perl -Mblib yourlocalscript.pl”). If it does, feel like 
PR-ing an update for all the Image* modules in Libtmp? :-)

Best regards,
Ed

From: Luis Mochan<mailto:moc...@icf.unam.mx>
Sent: 15 August 2022 17:39
To: perldl<mailto:pdl-general@lists.sourceforge.net>; 
perldl<mailto:pdl-de...@lists.sourceforge.net>
Subject: [Pdl-general] conv2d

Hello,
I tried to use conv2d from PDL::Image2D to make a simple average, as in
    $z->conv2d(ones(3,3))/9;
to take the arithmetic average a pixel with its neareast
neighbors. However, what I want to average is a component of an
electric field which is complex valued. It turns out that conv2d
doesn't work on complex quantities and the result I obtained was of
the LDouble type. Having looked further yet.
Regards,
Luis

--

                                                                  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

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

Reply via email to