discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Discuss-gnuradio] complex vector output of a block


From: Samy Sammour
Subject: RE: [Discuss-gnuradio] complex vector output of a block
Date: Thu, 10 Jun 2010 01:28:15 +0100

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


Get a new e-mail account with Hotmail - Free. Sign-up now.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]