c++ - invalid conversion from 'int' to int* [-fpermissive] -
previously had implemented , worked:
int *train_x = (int *)mxgetdata(in_a);// pointer 6th argument matrix train_x (int = 0; < 6; i++) { (int j = 0; j < 6; j++) { cout << train_x[6 * + j] << endl; } } int sizetrain_x1 = mxgetm(in_a); int sizetrain_x2 = mxgetn(in_a);
i manage check if correct sizes following , good.
cout <<"training input numofcollum:\n"<< sizetrain_x1 << endl; cout << "training input numofrows:\n"<<sizetrain_x2 << endl;
but when trying entire program following initialization compilation error:
for (int epoch = 0; epoch<training_epochs; epoch++) { (int = 0; i<train_s; i++) { rbm.contrastive_divergence(train_x[i], learning_rate, k); } }
here error message:
rbm.cpp: in function ‘void mexfunction(int, mxarray**, int, const mxarray**)’: rbm.cpp:570:64: error: invalid conversion ‘int’ ‘int*’ [-fpermissive] rbm.cpp:81:6: error: initializing argument 1 of ‘void rbm::contrastive_divergence(int*, double, int)’ [-fpermissive] rbm.cpp:615:32: error: invalid types ‘int[int]’ array subscript
train_x
int*
. when train_x[i]
int
. contrastive_divergence()
though wants int*
. since cannot convert int
int*
getting subsequent error. either need pass address of train_x[i]
&train_x[i]
or pass train_x
Comments
Post a Comment