max (matrix, DIM) does not behave as advertised
Francesco Potortì
Potorti at isti.cnr.it
Tue Nov 11 14:18:22 CST 2008
>Francesco Potortì wrote:
>> The help string says:
>>
>> -- Mapping Function: max (X, Y, DIM)
>>
>> For a matrix
>> argument, return the maximum value from each column, as a row
>> vector, or over the dimension DIM if defined.
>>
>> but:
>>
>> octave3.1> max(ones(2),2)
>> ans =
>>
>> 2 2
>> 2 2
>
>That is consistent
No, the help string distinguishes between the cases of one matrix and
two matrices argument. From what I read in it, the example I proposed
should produce a column vector of ones. Here is the complete help
string:
For a vector argument, return the maximum value. For a matrix
argument, return the maximum value from each column, as a row
vector, or over the dimension DIM if defined. For two matrices (or
a matrix and scalar), return the pair-wise maximum.
> .. I believe you mean
>
>max(ones(2,2),[],2)
Yes, that one works, thanks. But as I said above, either the help
string should be clarified or the behaviour changed.
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: Potorti at isti.cnr.it
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/
More information about the Bug-octave
mailing list