Have to use operator() for Matrix<>::operator*
Matrix<N,P> is a different class from Matrix<N,M> so Matrix<N,M> can't access protected member data on Matrix<N,P>. There must be a better way that having to do the multiplies requires for operator().
This commit is contained in:
parent
9aa557293a
commit
43cb182aa7
1 changed files with 5 additions and 6 deletions
|
@ -249,13 +249,12 @@ Matrix<N,M>::operator*(Matrix<M,P> rhs)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
Matrix<N,P> result;
|
Matrix<N,P> result;
|
||||||
for (int i = 0; i < N; i++) {
|
for (UInt i = 0; i < N; i++) {
|
||||||
for (int j = 0; j < P; j++) {
|
for (UInt j = 0; j < P; j++) {
|
||||||
/* Each cell is Sigma(k=0, M)(lhs[ik] * rhs[kj]) */
|
/* Each cell is Sigma(k=0, M)(lhs[ik] * rhs[kj]) */
|
||||||
const int ij = i*N + j;
|
result(i, j) = 0.0;
|
||||||
mData[ij] = 0.0;
|
for (UInt k = 0; k < M; k++) {
|
||||||
for (int k = 0; k < M; k++) {
|
result(i, j) += mData[i*N + k] * rhs(k*P, j);
|
||||||
result.mData[ij] += mData[i*N + k] * rhs.mData[k*P + j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue