dpilger26 / NumCpp

C++ implementation of the Python Numpy library

Home Page:https://dpilger26.github.io/NumCpp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The formula gives an error, how can I change it?

YoungjaeDev opened this issue · comments

The below expression gives an error
Looking at the code, I want to pick out all the items whose column 5 is i, but it seems that an error occurs on the operator side. How can I not do that?

func (std::vector<std::vector<float>>& obj_list)

nc::NdArray<float> nd_predictions{obj_list}

for (int i = 0; i < class_num; i++)
{
auto [rowIndices, _] = (nd_predictions(nd_predictions.rSlice(), 5) == i).nonzero(); //error 
...
}

You are trying to compare floats and ints and there isn't an operator == defined for that. You could change it to static_cast<float>(i).