Craig DeForest
2013-12-05 08:35:13 UTC
In the core-cleanup branch I just pushed a mod that prints a more helpful error message if thread dim reconciliation fails. It's a little old-skool but seems to work okay. Chris, would this have helped you debug the last issue?
pdl> ########## The simplest case (two scalar operators, 1 thread dim)
pdl> $a = sequence(5)
pdl> p $a+pdl(2,3)
PDL: PDL::Ops::plus(a,b,c): Parameter 'b':
Mismatched implicit thread dimension 0: size 5 vs. 2
There are 3 PDLs in the expression; 1 thread dim.
PDL IN EXPR. THREAD DIMS
# 0 (normal): 5
# 1 (normal): 2
# 2 (null)
.. at /usr/local/src/PDL/blib/lib/PDL/Complex.pm line 1260, <FOO> line 173.
pdl> ########## An example with index()
pdl> $a = sequence(5,3);
pdl> $b = sequence(2);
pdl> print $a->index($b);
Stringizing problem: PDL: PDL::Slices::index(a,ind,c): Parameter 'ind':
Mismatched implicit thread dimension 0: size 3 vs. 2
There are 3 PDLs in the expression; 2 thread dims.
PDL IN EXPR. ACTIVE DIMS | THREAD DIMS
# 0 (normal): 5 | 3 2
# 1 (normal): | 2
# 2 (null)
... eval {...} called at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 2957
pdl> ########## Chris's recent example with indadd()
pdl> $N = sequence(5);
pdl> $sum = zeroes(5,2);
pdl> $ind = floor(4*random(5))->long;
pdl> indadd $N(:,*2), $ind(:,*2), $sum;
PDL: PDL::Primitive::indadd(a,ind,sum): Parameter 'sum':
Mismatched implicit thread dimension 0: size 5 vs. 2
There are 3 PDLs in the expression; 2 thread dims.
PDL IN EXPR. ACTIVE DIMS | THREAD DIMS
# 0 (normal): | 5 2
# 1 (normal): | 5 2
# 2 (normal): 5 | 2
.. at (eval 109) line 4, <FOO> line 173.
pdl> ########## The simplest case (two scalar operators, 1 thread dim)
pdl> $a = sequence(5)
pdl> p $a+pdl(2,3)
PDL: PDL::Ops::plus(a,b,c): Parameter 'b':
Mismatched implicit thread dimension 0: size 5 vs. 2
There are 3 PDLs in the expression; 1 thread dim.
PDL IN EXPR. THREAD DIMS
# 0 (normal): 5
# 1 (normal): 2
# 2 (null)
.. at /usr/local/src/PDL/blib/lib/PDL/Complex.pm line 1260, <FOO> line 173.
pdl> ########## An example with index()
pdl> $a = sequence(5,3);
pdl> $b = sequence(2);
pdl> print $a->index($b);
Stringizing problem: PDL: PDL::Slices::index(a,ind,c): Parameter 'ind':
Mismatched implicit thread dimension 0: size 3 vs. 2
There are 3 PDLs in the expression; 2 thread dims.
PDL IN EXPR. ACTIVE DIMS | THREAD DIMS
# 0 (normal): 5 | 3 2
# 1 (normal): | 2
# 2 (null)
... eval {...} called at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 2957
pdl> ########## Chris's recent example with indadd()
pdl> $N = sequence(5);
pdl> $sum = zeroes(5,2);
pdl> $ind = floor(4*random(5))->long;
pdl> indadd $N(:,*2), $ind(:,*2), $sum;
PDL: PDL::Primitive::indadd(a,ind,sum): Parameter 'sum':
Mismatched implicit thread dimension 0: size 5 vs. 2
There are 3 PDLs in the expression; 2 thread dims.
PDL IN EXPR. ACTIVE DIMS | THREAD DIMS
# 0 (normal): | 5 2
# 1 (normal): | 5 2
# 2 (normal): 5 | 2
.. at (eval 109) line 4, <FOO> line 173.