Hi,

I've just released a new version of PDL-Dims, mainly fixing a few
things. Nowwhile actually using the module,I find the way thingswork a
little awkwardbut I don't knowa solution.

Let me explain:

I have a function like that, nothing fancy.

sub { $a*cos($t*$f)*exp(-$t*$r2) }

At compile time, however, I don't know what shape $a, $t2, $f haveor if
they are even PDLs. I'm a lazy guy and don't like keeping track of
dimensions, so I use PDL::Dims.

That winds upto wrapping each and every operation by nop / ncop to do
thedimensions magic:

Let's say:

use PDL::Dims
$a=pdl[1,2,3];
$r2=20;
$t=sequence 10;
$f=.5;
initdim $t,'t';
initdim $a,'amplitude';

sub { ncop ($a, ncop ( nop ( ncop ($f,$t,'mult',0), 'cos'),nop ( ncop (
ncop ( $t,1,'mult',0 ), $r2,'mult',0 ), 'exp' ), 'mult',0 ), 'mult',0 ); }

How could I hide some of that stuff within the module? I guess I could
overload explicitly the basic arithmetic operators(how?), at least, or
do you have abetter suggestions? Are there some hooks to inject code
before/after a methods call, for example?

Best
Ingo




------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to