I'm trying to use matrix multiplication to multiply b onto a. Using the method I've written below, changes the values of matrix A which I've then realised messes up later calculations.

Would the best way to get around this be to make two copies of the matrices A and B in two second vectors?

Or does anyone know of a more efficient method?

Thanks in advance!

```
void Matrix::Multiply(Matrix b)
{
for (int i = 0; i < cols; i++)
{
for (int j = 1; j <= cols; j++)
{
data_[i] = (data_[(i % cols)+(j-1)*cols])*(b.data_[(i/cols)+(j-1)]);
}
}
}
//Multiply b to this matrix
```