Open
Description
Propagate efficient ndarray
and staticTensor
scalar+tensor operations such as
// lib/NDArray.chpl
operator +(a: ndarray(?rank,?eltType),c: ?scalarType): ndarray(rank,eltType)
where isNumericType(scalarType) do
return ndarray.scalarMapOp("+",a,c);
and
// lib/StaticTensor.chpl
operator +(a: staticTensor(?rank,?eltType),c: ?scalarType): staticTensor(rank,eltType)
where isNumericType(scalarType) do
return staticTensor.scalarMapOp("+",a,c : eltType);
up into the dynamicTensor
world. Right now these operations are implemented as
// lib/DynamicTensor.chpl
operator +(a: dynamicTensor(?eltType),c: ?scalarType): dynamicTensor(eltType)
where isNumericType(scalarType) {
for param rank in 1..maxRank {
if a.checkRank(rank) {
return (a.forceRank(rank) + c).eraseRank();
}
}
halt("Could not determine rank in dynamicTensor + " + scalarType:string + ".");
}
Which is not the most efficient implementation, and should use the versions defined in lib/NDArray.chpl
and lib/StaticTensor.chpl
.
The solution is trivial, as the definitions in lib/DynamicTensor.chpl
, which should use the definitions in lib/NDArray.chpl
. But there should be tests verifying this relationship.
Metadata
Metadata
Assignees
Labels
No labels