04-24-2019 03:57 AM
I use a signal filtering subVI applied on a fixed size array. Depending on cRIO configuration, I use different fixed size array.
The thing is that I need to initialize filters with zeros. As maximum effectiveness in resources usage is required, I want to know how to get the fixed size array and set it to zero with most efficient way. Ideas that come to my mind:
Multiply by zero
Bit shift right 32 times (datatype I32)
Size of fixed size array is constant -> wiring "array size" output to initialize array (not working, size of fixed size array is not considered constant)
04-24-2019 05:29 AM
Or maybe subtract array from itself
04-24-2019 06:40 AM
Another idea: xor the array with itself.
I doubt there will be a significant performance difference between initialization methods. If the compiler recognizes the pattern, it should optimize it to a constant.
04-24-2019 07:05 AM
04-25-2019 04:21 AM
Do you need this during run-time or only at startup?
04-26-2019 01:19 AM
I did some testing and both multiplication by zero and subtracting the array from itself works in a single-cycle timed loop. This means you can do the initialization in the timeframe of one click.
04-26-2019 04:23 AM
Or just create a constant and use a select primitive.