octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

++ operator is not efficient


From: hossein sajjadi
Subject: ++ operator is not efficient
Date: Mon, 4 Feb 2008 20:48:02 +0330


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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]