#endif
- const unsigned int m = this->m(), n = src.n(), l = this->n();
+ const size_type m = this->m(), n = src.n(), l = this->n();
- // arrange the loops in a way that
- // we keep write operations low,
- // (writing is usually more costly
- // than reading), even though we
- // need to access the data in src
- // not in a contiguous way.
+ // arrange the loops in a way that we keep write operations low, (writing is
+ // usually more costly than reading), even though we need to access the data
+ // in src not in a contiguous way.
- for (unsigned int i=0; i<m; i++)
- for (unsigned int j=0; j<n; j++)
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
{
number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
+ for (size_type k=0; k<l; k++)
add_value += (number2)(*this)(i,k) * (number2)(src(k,j));
dst(i,j) = add_value;
}
#endif
- const unsigned int m = n(), n = src.n(), l = this->m();
+ const size_type m = n(), n = src.n(), l = this->m();
- // arrange the loops in a way that
- // we keep write operations low,
- // (writing is usually more costly
- // than reading), even though we
- // need to access the data in src
- // not in a contiguous way. However,
- // we should usually end up in the
- // optimized gemm operation in case
- // the matrix is big, so this
- // shouldn't be too bad.
- for (size_type i=0; i<m; i++)
- for (size_type j=0; j<n; j++)
- {
- number2 add_value = adding ? dst(i,j) : 0.;
- for (size_type k=0; k<l; k++)
- add_value += (number2)(*this)(k,i) * (number2)(src(k,j));
- dst(i,j) = add_value;
- }
+ // symmetric matrix if the two matrices are the same
+ if (PointerComparison::equal(this, &src))
- for (unsigned int i=0; i<m; ++i)
- for (unsigned int j=i; j<m; ++j)
++ for (size_type i=0; i<m; ++i)
++ for (size_type j=i; j<m; ++j)
+ {
+ number2 add_value = 0.;
- for (unsigned int k=0; k<l; ++k)
++ for (size_type k=0; k<l; ++k)
+ add_value += (number2)(*this)(k,i) * (number2)(*this)(k,j);
+ if (adding)
+ {
+ dst(i,j) += add_value;
+ if (i<j)
+ dst(j,i) += add_value;
+ }
+ else
+ dst(i,j) = dst(j,i) = add_value;
+ }
+ // arrange the loops in a way that we keep write operations low, (writing is
+ // usually more costly than reading), even though we need to access the data
+ // in src not in a contiguous way. However, we should usually end up in the
+ // optimized gemm operation in case the matrix is big, so this shouldn't be
+ // too bad.
+ else
- for (unsigned int i=0; i<m; i++)
- for (unsigned int j=0; j<n; j++)
++ for (size_type i=0; i<m; i++)
++ for (size_type j=0; j<n; j++)
+ {
+ number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
++ for (size_type k=0; k<l; k++)
+ add_value += (number2)(*this)(k,i) * (number2)(src(k,j));
+ dst(i,j) = add_value;
+ }
}
#endif
- const unsigned int m = this->m(), n = src.m(), l = this->n();
+ const size_type m = this->m(), n = src.m(), l = this->n();
++<<<<<<< .working
+ // arrange the loops in a way that
+ // we keep write operations low,
+ // (writing is usually more costly
+ // than reading).
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
+ {
+ number2 add_value = adding ? dst(i,j) : 0.;
+ for (size_type k=0; k<l; k++)
+ add_value += (number2)(*this)(i,k) * (number2)(src(j,k));
+ dst(i,j) = add_value;
+ }
++=======
+ // symmetric matrix if the two matrices are the same
+ if (PointerComparison::equal(this, &src))
+ for (unsigned int i=0; i<m; ++i)
+ for (unsigned int j=i; j<m; ++j)
+ {
+ number2 add_value = 0.;
+ for (unsigned int k=0; k<l; ++k)
+ add_value += (number2)(*this)(i,k) * (number2)(*this)(j,k);
+ if (adding)
+ {
+ dst(i,j) += add_value;
+ if (i<j)
+ dst(j,i) += add_value;
+ }
+ else
+ dst(i,j) = dst(j,i) = add_value;
+ }
+ else
+ // arrange the loops in a way that we keep write operations low, (writing is
+ // usually more costly than reading).
+ for (unsigned int i=0; i<m; i++)
+ for (unsigned int j=0; j<n; j++)
+ {
+ number2 add_value = adding ? dst(i,j) : 0.;
+ for (unsigned int k=0; k<l; k++)
+ add_value += (number2)(*this)(i,k) * (number2)(src(j,k));
+ dst(i,j) = add_value;
+ }
++>>>>>>> .merge-right.r29408
}
#endif
- const unsigned int m = n(), n = src.m(), l = this->m();
+ const size_type m = n(), n = src.m(), l = this->m();
- // arrange the loops in a way that
- // we keep write operations low,
- // (writing is usually more costly
- // than reading), even though we
- // need to access the data in the
- // calling matrix not in a
- // contiguous way. However, we
- // should usually end up in the
- // optimized gemm operation in case
- // the matrix is big, so this
- // shouldn't be too bad.
+ // arrange the loops in a way that we keep write operations low, (writing is
+ // usually more costly than reading), even though we need to access the data
+ // in the calling matrix in a non-contiguous way, possibly leading to cache
+ // misses. However, we should usually end up in the optimized gemm operation
+ // in case the matrix is big, so this shouldn't be too bad.
- for (unsigned int i=0; i<m; i++)
- for (unsigned int j=0; j<n; j++)
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
{
number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
+ for (size_type k=0; k<l; k++)
add_value += (number2)(*this)(k,i) * (number2)(src(j,k));
dst(i,j) = add_value;
}