Re: [eigen] HELP : bad_alloc

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Here is the function which I am calling for 1000 iterations in my other function, it does not gives any error until iterations are less than 5,

double SumCapacityOfUserSet(VectorXi comb, MatrixXcd H, float SNR, int n_t, int n_r){

        double P, P_final, cwf, R_F = 0;
        int set_card = comb.size(), count;
        MatrixXcd H_final(n_r,n_t);

        P = pow((double) 10, (double) SNR/10);

        for (int k = 0 ; k < set_card ; k++){

                H_final = H.block(0,n_t*(comb(k)-1),n_r, n_t);
                if (set_card != 1){
                        MatrixXcd H_tilda(n_r*(set_card-1), n_t);
                        count = 1;
                        for (int l = 0 ; l < set_card ; l++){
                                if (comb(l) == comb(k)){
                                        continue;
                                }
                                H_tilda.block((count-1)*n_r, 0, n_r, n_t) = H.block(0, n_t*(comb(l)-1),n_r, n_t);
                                count++;
                        }
                        JacobiSVD<MatrixXcd> svd(H_tilda, ComputeFullV);
                        int rank = svd.singularValues().size();
                        MatrixXcd T = svd.matrixV().rightCols(n_t - rank);
                        H_final = H.block(0,n_t*(comb(k)-1),n_r, n_t) * T;
                }
                P_final = P / set_card;
                cwf = Sum_Capacity(H_final, P_final);
                R_F += cwf;
        }
        return(R_F);
}

Any help?


On Fri, Jun 29, 2012 at 3:28 AM, Carlos Becker <carlosbecker@xxxxxxxxx> wrote:
My first guess is that you are trying to allocate more memory than what you can get, so when allocating you get such a signal.
Can you post the part of the code where you get that error? You may also get a quicker answer if you try to debug your program (e.g. gdb for g++)

------------------------------------------
Carlos



On Thu, Jun 28, 2012 at 11:56 PM, Gaurav Gupta <gaurav71531@xxxxxxxxx> wrote:
I am getting this error on running my code : 
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted

What is the reason?




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/