LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Toeplitz Matrix which each row is a shifted version of the previous row.


@Michi_Fu wrote:

 

I think is correct, right?


It is difficult to verify if you don't resize the array containers so we can see at least one extra row and column (for example we cannot tell how big the "column" input really is. remember, container size is independent of array size.

 

While this solutions works correctly, the code is relatively inefficient (unless the compiler can do some good transforms) for the following reasons:

  • Constantly resizing arrays (build array--delete from array...built array, delete from array) can be hard on the memory manager.
  • same for pre-pending an element to an existing array (arrays are contiguous in memory, so if you add an element to the beginning, often all data needs to be moved in memory).
  • ...

Of course LabVIEW will take care of everything and give the expected result, but if you later need to work with much larger data structures, it could become much more expensive (slower, more memory fragmentation) than needed.

0 Kudos
Message 11 of 11
(236 Views)