# Summing members of a vector

**URL:** <https://www.ruby-forum.com/t/summing-members-of-a-vector/231664>\
**Category:** GNU Radio\
**Created:** [August 21, 2014, 11:22pm UTC](https://www.ruby-forum.com/t/summing-members-of-a-vector/231664 "2014-08-21T23:22:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 21, 2014, 11:22pm UTC](https://www.ruby-forum.com/t/summing-members-of-a-vector/231664/1 "2014-08-21T23:22:58Z")

</div>

I am trying to find a block in the gnuradio-companion 3.7.3 that will  
allow me to sum the members of a vector. The example wouldbe that I have  
a complex to mag block with a vector length of 64 output that is being  
connected to a vector to streams block with 64 stream outputs. I then am  
using a add block with 64 inputs to connect all the individual streams  
to.

What I am looking for is a way to sum all the members of each vector so  
I just have one stream with the summed members of the vectors connecting  
to my next down stream block and avoiding a vector to streams with 64  
output streams and a add block with 64 inputs. The reason this is an  
issue is because I need to get to a vector length of 1024 and cant see  
doing this with a vector to streams block with 1024 outputs in the  
visual gnuradio-companion environment. Any answers, thoughts or ideas  
would be greatly appreciated.

Chris Simpson

---

<div class="post-metadata">

**Author:** ![Chris\_Simpson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7ab992/32.png) [@Chris\_Simpson](https://www.ruby-forum.com/u/Chris_Simpson)\
**Post date:** [August 24, 2014, 7:32am UTC](https://www.ruby-forum.com/t/summing-members-of-a-vector/231664/2 "2014-08-24T07:32:19Z")

</div>

Maybe you can convert the vector to stream, then integrate with  
decimation by  
64.

Thanks,  
Lou  
KD4HSO

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/Summing-members-of-a-vector-tp50042p50069.html](http://gnuradio.4.n7.nabble.com/Summing-members-of-a-vector-tp50042p50069.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Chris\_Simpson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7ab992/32.png) [@Chris\_Simpson](https://www.ruby-forum.com/u/Chris_Simpson)\
**Post date:** [August 24, 2014, 12:47pm UTC](https://www.ruby-forum.com/t/summing-members-of-a-vector/231664/3 "2014-08-24T12:47:20Z")

</div>

Good approach!  
Also, if this is more about using and learning GNU Radio than about bare  
performance, you could try to write your own python block; since the in-  
and output type wrappers for these are numpy arrays, a simple out[:] =  
in.sum() (or the like, depending on how you set up your names and types)  
would do the job 🙂

Greetings,  
Marcus
