05-20-2015 07:56 AM
05-20-2015 07:59 AM
05-20-2015 08:03 AM
05-20-2015 08:43 AM
I'm pretty sure the compiler is smart enough now to do all of that in place. The Rotate 1D Array is what will take a long time.
05-20-2015 09:22 AM
I'm not completely certain I understand what you are trying to do. I know you have a 4 x 608400 array, which I assume stays a fixed size. I think that you are treating it like a lossy queue, right? You are adding a new element, which "pushes" all the older elements up one space and deletes the oldest (first) one -- is that correct? And are you doing this for all 4 rows at once (in which case, I would describe it as "replacing a column" of the array)?
If this is what you are doing, then you have essentially created what I learned (when I programmed in Fortran) was called a "circular buffer". Depending on how you use this buffer, you can easily add a new element in very quickly with no array copying or rotation necessary. Just do what we did so many years ago -- maintain a pointer to the "next free slot" in the array (initially index 0, when the array is empty, and incrementing Mod 608400 with each insertion). Insertions thus take almost no time -- it is a simple "replace element at index "Next Free Slot and circularly increment the index". If you want to extract elements, the oldest is at "Next Free Slot", as well. Depending on how you want to use the elements, you may or might not need to modify the Index for other operations. In the event that, at some point, you need an entire row, simply copy the existing row, rotate it left by "Next Free Slot", and you are Good to Go.
Bob Schor
05-20-2015 09:26 AM
@Bob_Schor wrote:
If this is what you are doing, then you have essentially created what I learned (when I programmed in Fortran) was called a "circular buffer".
Did you say Circular Buffer. Full disclosure, I've never tested the circular buffer with an array of that size. No matter what you do there will be copies made, the goal is to make the fewest number of copies, and doing things efficiently.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-20-2015 10:23 AM
@AntonioNI wrote:
I have a big array 2D with 4 rows of 608400 elements, in a given time, y want to add a new point to the INE of the rows, deleting the element in indx 0, wich could be done by replacing the element 0 and then rotating the row by -1, but, in order to obtain the row you must first use array subset, and then make a branch in the original array and replace subset with this new row. In assuming this males a copie of the row wich slows down my program, and the in place element structure does not allow uwired inputs, only operates on elements. Ty in advance
"Array subset" is the incorrect tool to get a row. The correct tool is "index array" with the first index specifying the row and second index input disconnected.
You can do this nearly in-place using a loop and a shift regsiter. Can you show us some of your code? (Simplify it to make the rows smaller as a demo).
05-20-2015 02:52 PM
Example atached.
05-20-2015 03:16 PM
80-100 ms in all methods, including the last on in this atached img. I guess is not that bad, will have to deal with it xP
05-20-2015 03:25 PM
@AntonioNI wrote:
80-100 ms in all methods, including the last on in this atached img. I guess is not that bad, will have to deal with it xP
Why do you suddenly have 3D arrays?