Hi,
I read your previous mail.
I agree that if we get a(b)=7 then a=[4,7,6] that Octave acts:
a(b(1))=7
a(b(2))=7
a(b(3))=7
a(b(4))=7
this means we four times assign 7 to a(2) thus a(2)=7and a = [4, 7, 6]
the logic of the language when a(b)=a(b)+1 is obvious
first octave computes right hand side of equation
temp1=a(b)=[5 5 5 5]
then octave computes temp2=temp1+1=[6 6 6 6]
[but the right hand side of equation must not be confused with the left side]
then octave performs assigning the value to the variable four times that means:
a(b(1))=temp2(1)=6
a(b(2))=temp2(2)=6
a(b(3))=temp2(3)=6
a(b(4))=temp2(4)=6
then we have
>>a(b) = a(b) + 1
a=
4 6 6

but for computing a(b)++ octave first computes
 unique(b) and then computes a(unique(b))++
that is with its own overflow.I can use hist function
for computing one dimensional histograms but if I want to
compute Nd histograms the problem is still open. also if you claim
that this efficient method is not consistent with the rest of the
language I should
say that the ++ operator is not consistent with the rest of  the
language and if you think
a++ is a shorthand for a=a+1 we agree in our thinking that ++ operator
is not efficient.
yes, a++ is a shorthand for a=a+1 but for low level language such as c++ but in
array processing languages we can use array processing capabilities and
improve other aspects.
Thanks,
Hossein

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to