gpt4 book ai didi

C++:错误:数组下标的无效类型 ‘size_t {aka long unsigned int}[size_t {aka long unsigned int}]’

转载 作者:行者123 更新时间:2023-11-30 05:25:08 31 4
gpt4 key购买 nike

<分区>

编译时出现以下错误:错误:数组下标 interactionMatrix[i][k]=interaction;

代码如下:

void Tree::computeInteractionScore(size_t* interactionMatrix){
size_t num_independent_variables = data->getNumCols() - no_split_variables->size();

for (size_t i = 0; i < num_independent_variables; ++i) {
for (size_t k = 0; i < num_independent_variables; ++k) {
size_t interaction = 0;
if(k!=i){
// interaction = computeInteraction(i,k);
}
interactionMatrix[i][k]=interaction;
}
}
}

interactionMatrix 声明如下:

  size_t num_independent_variables = data->getNumCols() - no_split_variables->size();

size_t interactionMatrix[num_independent_variables][num_independent_variables];

for (size_t i = 0; i < num_trees; ++i) {
trees[i]->computeInteractionScore(&interactionMatrix);
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com