[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 |
Hello,
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:
shift_left:
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?
Greetz
Kristof
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------