Piszę Adaline z użyciem wektorów. Kod jak poniżej:
void Adaline::fillArrays()
{
for (int i = 0; i < numberOfNeurons; i++)
{
neuron[i].tabX.reserve(numberOfSignals);
neuron[i].output = 0;
neuron[i].z = 0;
neuron[i].y = -1;
}
// przypisanie wartości do sieci
for (int i = 0; i < numberOfNeurons; i++)
{
for (int j = 0; j < numberOfSignals; j++)
{
cout << "Enter signal [" << i << "," << j << "]: "; cin >> neuron[i].tabX[j];
neuron[i].wX.push_back(0.2+ 0.1*(j+1) - 0.08*(i+1));
neuron[i].dW.push_back(0);
}
cout << "Enter expected output: "; cin >> neuron[i].z;
}
}
Pojawiają się dziwne błędy pokroju:
+ message 0x01240288 L"vector subscript out of range" const wchar_t *
lub:
_STD_BEGIN
#ifdef _DEBUG
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Debug_message(const wchar_t *message, const wchar_t *file, unsigned int line)
{ // report error and die
if(::_CrtDbgReportW(_CRT_ASSERT, file, line, NULL, L"%ls", message)==1)
{
::_CrtDbgBreak();
}
}
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Debug_message(const unsigned short *message, const unsigned short *file, unsigned int line)
{ // report error and die
_Debug_message((wchar_t *) message, (wchar_t *) file, line);
}
#endif
_STD_END
Ma ktoś ideę, o co tutaj chodzi? Podejrzewam, że standardowo problem z pamięcią.