LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Dragis

treat array 'sorted' status as part of datatype

Status: Declined

Any idea that has received less than 7 kudos within 7 years after posting will be automatically declined.

there have been several ideas on the forums pertaining to making labview smarter about how it handles arrays, but none of them (that i've been able to find) quite get to the root cause: labview doesn't directly support a 'sorted' status of arrays.

 

sorted-arrays.png

 

 

labview should add a 'sorted' field to the array data. when the array primitives detect, either at runtime or compile time, that an array is or could be sorted, it generates optimized code. for the most part primitives will function the same but just be more efficient (e.g. array min/max will be constant time operations).

 

the special cases for this feature are the array building and modifying primitives because i believe they will need special behavior in some cases to make sorted arrays useful.

 

build array  when all input arrays are sorted, the output array will be sorted. this seemed strange to me at first, but the more i thought about it, the better this seemed as the default behavior.

 

insert into array  when the input array is sorted and the index is unwired, the output will be sorted. this will be true whether or not the insertion is one element or an array of (possible unsorted) elements. 

 

i would assume you could turn any of these behaviors off by right-clicking on the node and configuring it. i'm sure the labview team can figure out mutation issues as necessary.

1 Comment
Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 7 kudos within 7 years after posting will be automatically declined.