[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Discuss-gnuradio] complex vector output of a block
From: |
Sammour |
Subject: |
RE: [Discuss-gnuradio] complex vector output of a block |
Date: |
Sat, 12 Jun 2010 15:40:21 -0700 (PDT) |
Thanks for everyone, I sorted the problem out. I needed to increment "out"
after memcpy and then return noutput_items/(N*N).
Cheers,
Sam
Sammour wrote:
>
>
> Hi John, Thanks for the message sorry for using MATLAB notation without
> clarification 2:12 = from 2 upto 12.
>
> To simplify the case, I wrote the following code that actually carry the
> same problem concept:
> *****************************************************************************************************************
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> #endif
> #include <arraycomms_construct_rxx_vcc.h>
> #include <gr_io_signature.h>
>
> arraycomms_construct_rxx_vcc_sptr arraycomms_make_construct_rxx_vcc (int
> input_ports){
> return arraycomms_construct_rxx_vcc_sptr (new
> arraycomms_construct_rxx_vcc (input_ports));
> }
>
> unsigned int N=0; // number of input ports
>
> arraycomms_construct_rxx_vcc::arraycomms_construct_rxx_vcc (int
> num_input_ports)
> : gr_sync_block ("construct_rxx_vcc", gr_make_io_signature (2, 12,
> sizeof(gr_complex)),
> gr_make_io_signature (1,1 ,
> num_input_ports*num_input_ports*sizeof(gr_complex))){
>
> N=num_input_ports;
> }
>
> arraycomms_construct_rxx_vcc::~arraycomms_construct_rxx_vcc (){}
>
> int arraycomms_construct_rxx_vcc::work (int noutput_items,
> gr_vector_const_void_star &input_items,
> gr_vector_void_star &output_items)
> {
> gr_complex *out =(gr_complex *) output_items[0];
> gr_complex out_vector [N*N];
> const gr_complex *in[N];
> for (unsigned int i = 0; i<N; i++)
> {
> in[i] = (const gr_complex *) input_items[i];
> }
> for (int i = 0; i < noutput_items; i++){
> unsigned int index = 0;
> for (unsigned int n =1; n<=N*N; n++){
> out_vector[index]=gr_complex(4, 0);
> index++;
> }
> }
> memcpy(out, out_vector, N*N*sizeof(gr_complex));
> return noutput_items;
> }
> *********************************************************************************************
>
> This code is supposed to generate a vector of 4 elements ( I used N=2 in
> the GRC) with each element = 4+j0 whatever the input is. However, the
> content of the sink file is:
> 4.0000000e+00
> 4.0000000e+00
> 4.0000000e+00
> 4.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> .....
> 4.0000000e+00
> 4.0000000e+00
> 4.0000000e+00
> 4.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
> 0.0000000e+00
>
> I hope the situation is now clearer.
>
> Cheers,
> Sam
>
>> To: address@hidden; address@hidden
>> Subject: Re: [Discuss-gnuradio] complex vector output of a block
>> Date: Wed, 9 Jun 2010 16:49:15 -0700
>> From: address@hidden
>>
>> > Thanks for replying. N is designed to be 2:12.
>>
>> Maybe others understand what you're saying, but 2:12 doesn't mean
>> anything
>> to me. Do you mean "between 2 and 12"? Or is this a Biblical reference,
>> or perhaps the time of day?
>>
>> I suggest that you just post the code that's giving you the trouble
>> (either in an email, or if it's more than about 200 lines, put it on
>> a web site or pastebin or wiki and email a URL for it). Trying to
>> debug somebody else's code piecemeal by asking little questions is
>> unlikely to lead to success.
>>
>> John
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> Do you have a story that started on Hotmail? Tell us now
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
--
View this message in context:
http://old.nabble.com/complex-vector-output-of-a-block-tp28828557p28867921.html
Sent from the GnuRadio mailing list archive at Nabble.com.
Re: [Discuss-gnuradio] complex vector output of a block, Eric Blossom, 2010/06/09