LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hole in Wall - Deleting an Array of Indices from an Array of Indices

The very first two elements of "Wall Indices" are the same (3878).

 

The original code passes both values through since 3878 isn't a "hole" which is why it gives an answer that is 1 larger in size compared to the Map/Set examples. If 3878 was a hole, the original code would only remove the first instance while Map/Set would remove both.

0 Kudos
Message 11 of 18
(500 Views)

 

(Sorry, could not look at your VI, so maybe I misunderstood)

 

<content deleted>

 

Edit: Sorry, I misunderstood the problem...

 

0 Kudos
Message 12 of 18
(477 Views)

@BertMcMahan wrote:

Well heck then, here's a much simpler version:
BertMcMahan_0-1705086859007.png


Here's an even simpler version.

~20ms in my testing (on a W10 VM where your solution is about 100ms) producing the exactly same result as the original code.

 

 

altenbach_0-1705179959572.png

 

Message 13 of 18
(461 Views)

@LuminaryKnight wrote:


So I'm not entirely sure I follow what you're trying to do here.  Let me know if I didn't duplicate it correctly.  But this nearly broke my machine.  Filled up  my memory instantly.

 

LuminaryKnight_0-1705071031496.png


That looks correct to me. I just tried with 500k Wall and 10k holes and it was almost instant. It is Array Subset you're using, right? (The picture i posted was a Snippet, if you save it to disk you should be able to drag it into a VI and get the code)

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 14 of 18
(417 Views)

Version 2, with Maps ... i just realized it's basically identical to Altenbachs ... i guess that's a good thing. 🙂

RemoveHolesMap.png

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 15 of 18
(414 Views)

@Yamaeda wrote:
That looks correct to me. I just tried with 500k Wall and 10k holes and it was almost instant.

It does not preserve the original order of the elements. You also need to be careful if the input is a diagram constant, because the entire thing could potentially be constant folded once debugging is disabled, making any benchmarking meaningless.

 

Whenever I hear "almost instant", I am reminded of the comic Steven Wright who once said: "I put instant coffee in a microwave oven and almost went back in time" (The joke made sense back in the time where these ovens were touted as being so much faster than regular cooking.)

 


@Yamaeda wrote:

Version 2, with Maps ... i just realized it's basically identical to Altenbachs ... i guess that's a good thing. 🙂


I was using a Set, not a Map (small difference)! 😄

 

 

0 Kudos
Message 16 of 18
(391 Views)

@altenbach wrote:

@BertMcMahan wrote:

Well heck then, here's a much simpler version:
BertMcMahan_0-1705086859007.png


Here's an even simpler version.

~20ms in my testing (on a W10 VM where your solution is about 100ms) producing the exactly same result as the original code.

 

 

altenbach_0-1705179959572.png

 


Greatly appreciated.  I did not even know these functions were available.  Adding new stuff to my bag of tricks.  Thank you everyone!

0 Kudos
Message 17 of 18
(344 Views)

@LuminaryKnight wrote:
Greatly appreciated.  I did not even know these functions were available.  Adding new stuff to my bag of tricks.  Thank you everyone!

Sets and Maps are extremely useful and relatively new (introduced in LabVIEW 2019 and probably first suggested in 2010 😄 ).

 

For an overview, check my presentation.

0 Kudos
Message 18 of 18
(342 Views)