BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


@JÞB wrote:
I think he meant that the second 0 constant could be removed and migrate add to after the loops.

 


Who is "he"?

 


@JÞB wrote:
The PRNG marks that the loop is no longer constant folded. Why?  Because, although the PRNG WILL generate the same numbers, they may no longer be in the same order.  ?

 

No, the numbers are guaranteed to be in the same order at the output tunnel, even though they might not have been generated in index order. (However, with random number we could not tell unless we reverse engineer the random algorithm, which has been done, of course. 😄 )

 

In any case, you can never constant-fold anything that contains a dice. No dice! (pun)

 

(Folding would always return the same random values that have been generated at compile time. not random!) 

 

Here's my "slightly simpler" alternative to the original problem.

 

altenbach_0-1671642856067.png

 

Message 2481 of 2,571
(1,822 Views)

@altenbach wrote:

@JÞB wrote:
I think he meant that the second 0 constant could be removed and migrate add to after the loops.

 


Who is "he"?

 


@JÞB wrote:
The PRNG marks that the loop is no longer constant folded. Why?  Because, although the PRNG WILL generate the same numbers, they may no longer be in the same order.  ?

 

No, the numbers are guaranteed to be in the same order at the output tunnel, even though they might not have been generated in index order. (However, with random number we could not tell unless we reverse engineer the random algorithm, which has been done, of course. 😄 )

 

In any case, you can never constant-fold anything that contains a dice. No dice! (pun)

 

(Folding would always return the same random values that have been generated at compile time. not random!) 

 

Here's my "slightly simpler" alternative to the original problem.

 

altenbach_0-1671642856067.png

 


Turns out that I miss spoke a bit.  (and the darn default ini file had show constant folding turned off)

 

With PRNG, the order of the values output is in order of the iteration in which they are generated.  However, the seed for each call is dependent on the previous PRNG call. so for a given number of parallel iterations the same values are generated but, there is no guarantee that the calls are made sequentially and the order of the values may change at the output if loop parallelization is on and allow debugging is off 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2482 of 2,571
(1,816 Views)

Ah, right! Yeah, the + 0 is quite redundant. 😄

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2483 of 2,571
(1,784 Views)

@JÞB wrote:

With PRNG, the order of the values output is in order of the iteration in which they are generated.  However, the seed for each call is dependent on the previous PRNG call. so for a given number of parallel iterations the same values are generated but, there is no guarantee that the calls are made sequentially and the order of the values may change at the output if loop parallelization is on and allow debugging is off 


Sounds to me like an improvement of the Randomness of the numbers series. Not a significant one in terms of true crypto randomness but nevertheless. 😀

Rolf Kalbermatter
My Blog
Message 2484 of 2,571
(1,772 Views)

So we have a sequence structure. In the first frame is a "semi-transparent" event structure (timeout=0) with a value change event for "Gain" that locks the panel. In the "Gain:value changed" event case, we take the new value from the event data node and write it to the control (i.e. itself!) via a value property node. In the next frame, we read the "Gain" terminal.

 

What would the thought process be to do that crazy detour ????

 

(seen here)

 

altenbach_1-1673364448001.png

Message 2485 of 2,571
(1,590 Views)

In order to connect a waveform to a scalar numeric indicator, somebody used "variant to data". (scratches head...).

 

Look ma! Not even a coercion dot!!!!

 

altenbach_1-1673980660393.png

 

 

I am sure this must be obvious to all more experienced LabVIEW programmers (than rookie me), but what do you expect the indicator to display after running the above code (No cheating, i.e. without actually implementing it!)?

 

And yes, the following is equivalent. Somebody must have objected to the lipstick on the pig (coercion dot):

 

altenbach_0-1673981050666.png

 

 

 

 

0 Kudos
Message 2486 of 2,571
(1,484 Views)

@altenbach wrote:

what do you expect the indicator to display after running the above code (No cheating, i.e. without actually implementing it!)?

 

 


Nice way to obtain last element. And I asked me myself "if it works with waveform, why should not work with cluster with same elements like waveform?"

And then I've got an exception: 😁

Screenshot 2023-01-18 18.34.46.png

Nice side effect, can be submitted as bug. 2022Q3 64bit. You should select all elements in waveform, then move with Control key to make a copy. If you will drop copy in waveform and move, then exception can be raised. And one cosmetic issue.with label on diagram.

 

0 Kudos
Message 2487 of 2,571
(1,420 Views)

So we have a plain text file with one column (while it has a csv extension, there are no commas!). The first row is a header to be tossed.

 

(seen here)

 

In order to get that column, we apparently need to read it as a 2D array with one column, delete the first row, then reshape it to a 1D array based on the number of elements calculated from the product of the dimensions.

 

altenbach_0-1674322740382.png

 

0 Kudos
Message 2488 of 2,571
(1,318 Views)

Well, I want to see more precision, so setting the indicator to EXT seems like a completely logical idea....

 

(seen here)

 

 

altenbach_0-1675463508612.png

 

0 Kudos
Message 2489 of 2,571
(1,115 Views)

Even if you do all the math with EXT, you usually don't gain much.  The man difference between DBL and EXT is that EXT has no guard bits.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2490 of 2,571
(1,020 Views)