On Wed, 30 Nov 2016, Sven Schreiber wrote:
Hi,
another appearance of the subtle pitfalls of moving back and forth between a
1x1 matrix and a scalar.
<hansl>
function void matin( const matrix in)
print in
end function
matin( {cdf(N, {3})} ) # works
matin(cdf(N, {3})) # fails
</hansl>
So the cdf() function "destroys" the matrix property here, while I think it
shouldn't. (Don't know which other functions do as well.)
It's not the cdf() function in particular: the general policy is that
a 1x1 result is counted as a scalar unless the user has specified the
matrix type for the result.
As regards built-in functions this shouldn't cause problems, because
whenever a matrix argument is wanted, a scalar will do (it being
treated as a 1x1 matrix). As your example demonstrates, however, that
was not the case for user-defined functions. But that's now fixed in
git: if a scalar is passed as an argument to a user-function that
wants a matrix, we create a temporary 1x1 matrix to satisfy the
demand.
Allin