erase elements from vectors then perform inner product

Write your question here.
1) is the overload of erase in my Vector class. _vec is a std::vector, private attribute
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1) void Vector::via(Scalar s){
	_vec.erase(_vec.begin()+s);
}

2) using Scalar as double. inner product succesfully overloaded in the class. 

I keep getting DIFFERENT ARRAY SIZES. I don't know where to look at.. 
Thank you for your help

2)Scalar AdjustedCosine::adjustedCosineSimilarity(Vector &v1,Vector &v2, Vector &means) const{

    Scalar res{};
    
    for (std::size_t i = 0; i < v1.size(); ++i){
        if((v1[i]==0)||(v2[i]==0))
        	{
        	v1.via(i);
            v2.via(i);
            i--;
        }
    }

    if (v1.size()==0)
        { return res;}
    
	res = (v1*v2)/(sqrt(v1*v1)*sqrt(v2*v2)+_shrinkage);

    return res;
}
 




¿why do you ask for an Scalar when you want an index?
Topic archived. No new replies allowed.