Z
ZillionDollarSadist
Hello,
I declared a class with some array of doubles as attributes. I have a
function called init to initialize them through parameters passed from
the outside, and here it is:
void weights::init (int labels, int nnodes, int maxpool, int wcon, int
npatterns, int npointers) {
patterns_out=new double[npatterns];
npats=npatterns;
nodes=nnodes;
LENGHT=labels+(npointers*(nodes-1));
NPOINTERS=npointers;
labelWeights=new double[LENGHT];
oldLabelWeights=new double[LENGHT];
===================================== problems follow!
recWeights=new double[npointers]; (1)
oldRecWeights=new double[npointers];
update_C=new double[LENGHT];
oldUpdate_C=new double[LENGHT]; (2)
rccDerivatives=new double[npointers];
oldRccDerivatives=new double[npointers];
deltaRccDerivatives=new double[npointers];
oldDeltaRccDerivatives=new double[npointers];
residual=new double[npatterns];
tmpRcc=new double[npatterns];
}
Pretty average, it seems. Well, right after the line, there's always
one of the following statements rising a segmentation fault, generally
1 or 2.
I don't understand why, these seem to be very basic operations.
Thanks in advance.
ZDS.
I declared a class with some array of doubles as attributes. I have a
function called init to initialize them through parameters passed from
the outside, and here it is:
void weights::init (int labels, int nnodes, int maxpool, int wcon, int
npatterns, int npointers) {
patterns_out=new double[npatterns];
npats=npatterns;
nodes=nnodes;
LENGHT=labels+(npointers*(nodes-1));
NPOINTERS=npointers;
labelWeights=new double[LENGHT];
oldLabelWeights=new double[LENGHT];
===================================== problems follow!
recWeights=new double[npointers]; (1)
oldRecWeights=new double[npointers];
update_C=new double[LENGHT];
oldUpdate_C=new double[LENGHT]; (2)
rccDerivatives=new double[npointers];
oldRccDerivatives=new double[npointers];
deltaRccDerivatives=new double[npointers];
oldDeltaRccDerivatives=new double[npointers];
residual=new double[npatterns];
tmpRcc=new double[npatterns];
}
Pretty average, it seems. Well, right after the line, there's always
one of the following statements rising a segmentation fault, generally
1 or 2.
I don't understand why, these seem to be very basic operations.
Thanks in advance.
ZDS.