This is not enough information. That line of code is meaningless without context (how are B and repeated_squaring defined? What is repeated_squaring supposed to be doing? What about this is recursive?). It's better to show more code -- at least enough so we can get the idea of what's going on.
You also don't tell us what the error is. Don't paraphrase the error because you'll probably get it wrong or omit a critical detail. Copy/paste the actual error you're getting - in full.
void repeated_squaring(Matrix B, int n, int k)
{
Matrix C;
{
if (k == 1){
cout << 1 << endl;
cout << B << endl;
exit(0);
}
if(k > 1 && k % 2!= 0){
cout << 2 << endl;
cout << endl;
cout << B << endl;
B * repeated_squaring(B*B, n, (k-1)/2);
}
else{
cout << 3 << endl;
cout<< B << endl;
repeated_squaring(B*B,n,k/2);
}
}
}
B is a randomly generated matrix. I have B being outputted in places in the code and 1, 2 and 3 being outputted so I can see whats going on when the code runs, not because it needs to be there.
In my main function the user inputs an n and k where n is the square matrix's size and k is the power to take the square matrix too. The code is supposed to be a repeated squaring algorithm that cuts down the amount of time it takes to take large matrices to large powers.
My problem is in the part where K is odd. I need to get B times the recursive function but I do not know how to do that.