LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Summing specified elements in 2D array.

Hi!

I have a little problem with summing elements in 2D array… I have signal from 64 sources in the 2D array - 64 colums and (time*sampling) rows. I have to add some deley to every signal (different for each)  and then sum signals from all of the sources. I hope the picture below explains what I have to do:

Summing 

What's more - I have a 2D array of delays. By now I'm doing this by creating an 1D array of "0" and then putting in it the 1D signal array at index specified by delay value.

Now

And it works ok. But... It takes long time... Is there any method to do the summing "at once" for all the delays? Is there sth like "pointer" in array, so I could take elements from the array from specified element?

 

Rgds,

Mordimer 

0 Kudos
Message 1 of 11
(5,976 Views)

Hi Mordimer,

 

some smaller improvements:

- All "constant" operations do belong outside of loops: Move everything that is in the outer loop (except the inner loop) outside of the loop.

- In general: reading property nodes is slow!

- There is a "Sum" function in the arithmetics palette, you probably need that too...

 

- Why don't you attach snippets of your code? So we could play around with it...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(5,967 Views)

Thanks for the answer.

Property nodes are temporary - it'll be changed in future when I'll connect my code with another codes - this is only a part of a bigger app...

The biggest problem is it'll have to work in a real time... and by now I've no idea how to do it, because there's a lot of operations to do - add specified delay to each channel at once, sum values and repeat all of this for another set of delays.

 

I'm not pretty sure where I could use the sum function. I don't have to sum all elements in the array, but only elements in every column.

 

The snippet won't be helpfull - it's just to big app (or I'm just to bad programist;) It's also hard to send the VI, 'couse it's useless without data to operate on... 

 

I forgot - all of this is going to be delay and sum beamforming algorithm for 64 channel microphone matrix.

0 Kudos
Message 3 of 11
(5,954 Views)

One problem with your solution is also that the subset is of variable lenght due to truncation, so the shift register needs to be reallocated whenever the size changes. (Even if you define a lenght for the subset, you run out of elements and the result will be shorter!). You might want to e.g. truncate all to the shortest subset (longest delay) before summing for better inplaceness.

 

Why do you have a 2D array of delays? isn't the time spacing of each column constant?

 

What is your definition of "takes a long time": microseconds?, minutes?

Message Edited by altenbach on 12-03-2009 03:20 PM
Message 4 of 11
(5,938 Views)

I have 2D array of delays, because there's different "set" of delays for each angle of view - i.e. the mic array "looks" straight, so the angle of view is 0 [dgr], and delays are "0", but when it "looks" at 13 [dgr] delays are much different. The thing I could do is to replace the array of delays for each angle by a "fundamental" delay (the shortest one) and compute the others (they're 2, 3 ... times greater - for regular mic array). But I'm not sure if it would help.

 

"Takes a long time" means about 4s (signals are 48kHz, 2s long, the mic array is regular - 64 mics, 2cm between mics).

 

The best thing would be something like buffer - signals would be delayed in it and would be summed after this buffer (picture below shows what I mean). Is it possible to do?

buffer 

 

Rgds,

Mordimer 

0 Kudos
Message 5 of 11
(5,915 Views)

Mordimer wrote:

picture below shows what I mean 


The picture is not clear. Too many unlabeled squares arranged in weird patterns connected by random arrows.

 

I still don't understand the experiment. Is there a more detailed description on the web somewhere?

Message 6 of 11
(5,911 Views)

I hope this picture will be more helpful:

 buffer

A detailed description of what I'm doing is here -> B&K Technical review  (I'm doing it now in time domain, not in frequency domain).

0 Kudos
Message 7 of 11
(5,903 Views)

As i understand it:

 

Select a column (index array), rotate array/select subarray according to delay, replace column.

Now the table/matrix should be organized.

Do a Sum function on resulting matrix.

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 11
(5,895 Views)
After replacing all original columns with columns containing delays on begining I'm doing a sum of each row.
0 Kudos
Message 9 of 11
(5,890 Views)

OK, makes more senses now. Could you attach a very small VI that contains a typical input array as diagram constant, as well as a delay array and an array with the desired result.

 

(To make these arrays, simply add properly named indicators to the various wires, run the VI once, then right-click the indicator terminals...create constant. Show the label of the constants. Copy them all into a new VI and attach it here. No code needed.)

0 Kudos
Message 10 of 11
(5,872 Views)