++ operator is not efficient

hossein sajjadi hossenabad at gmail.com
Mon Feb 4 11:18:02 CST 2008


*The ++ operator is not so efficient.*
for example
>a=[4,5,6]
ans=
    4 5 6
>b=[2,2,2,2]
ans=
    2 2 2 2
>a(b)++ ;
>a
ans=
4 6 6
this means a(b(1))+1
the efficient method is:

>a(b)++ should be equal
a(b(1))+1
a(b(2))+1
a(b(3))+1
a(b(4))+1
that gives
a(b(1))+1=a(2)+1=5+1
a(b(2))+1=a(2)+1=5+1+1
a(b(3))+1=a(2)+1=5+1+1+1
a(b(4))+1=a(2)+1=5+1+1+1+1
finally 'a' should be :
[4 9 6]
++ operator will be very efficient if this method is implemented.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080204/07045a98/attachment.html 


More information about the Octave-maintainers mailing list