#395 please add "FieldMatrix += Scalar" operator
Metadata
Property | Value |
---|---|
Reported by | Jö Fahlke (jorrit@jorrit.de) |
Reported at | May 19, 2008 17:11 |
Type | Feature Request |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Description
The operator should add unity times the scalar to the matrix. For example adding the unit matrix to matrix A then becomes A += 1
. I currently use the following implementation:
template<typename K, int n>
FieldMatrix<K, n, n> &
operator+=(FieldMatrix<K, n, n> &M, K scalar)
{
for(int i = 0; i < n; ++i)
M[i][i] += scalar;
return M;
}