[Top][All Lists]

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

Shift in C++

From: Kristof Timmermans
Subject: Shift in C++
Date: Tue, 30 Sep 2003 13:45:50 +0200


does anyone know if there is a command to shift a rowvector in C++ (just
like the octave command shift) that I can use?

I have written two functions to shift left and right. The function look
similar but there is a great speed difference between the two:


for (int i = 0; i < inputvector.length(); i++)
    retval(i) = retval(i+1);

shift right:

for (int i = inputvector.length() i > 0; i--)
    retval(i) = retval(i-1);

To shift left, there is no problem, but when I shift to the right, it
goes very slow...anyone an idea?



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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