From 43cb182aa7991efb2d0d1e534f5bd366578836f0 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 9 Aug 2014 09:57:09 -0700 Subject: [PATCH] Have to use operator() for Matrix<>::operator* Matrix is a different class from Matrix so Matrix can't access protected member data on Matrix. There must be a better way that having to do the multiplies requires for operator(). --- src/basics/matrix.hh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/basics/matrix.hh b/src/basics/matrix.hh index b2dd107..b1d751b 100644 --- a/src/basics/matrix.hh +++ b/src/basics/matrix.hh @@ -249,13 +249,12 @@ Matrix::operator*(Matrix rhs) const { Matrix result; - for (int i = 0; i < N; i++) { - for (int j = 0; j < P; j++) { + for (UInt i = 0; i < N; i++) { + for (UInt j = 0; j < P; j++) { /* Each cell is Sigma(k=0, M)(lhs[ik] * rhs[kj]) */ - const int ij = i*N + j; - mData[ij] = 0.0; - for (int k = 0; k < M; k++) { - result.mData[ij] += mData[i*N + k] * rhs.mData[k*P + j]; + result(i, j) = 0.0; + for (UInt k = 0; k < M; k++) { + result(i, j) += mData[i*N + k] * rhs(k*P, j); } } }