Skip to content
Snippets Groups Projects
Commit 3da2bbcd authored by Uli Sack's avatar Uli Sack Committed by Oliver Sander
Browse files

introduce Construction via initializer list; copied more or less from FieldVector, see also FS#1166

parent 5cefba4b
No related branches found
No related tags found
No related merge requests found
......@@ -7,10 +7,12 @@
\brief This file implements a quadratic diagonal matrix of fixed size.
*/
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstddef>
#include <initializer_list>
#include <iostream>
#include <memory>
......@@ -106,6 +108,13 @@ namespace Dune {
: diag_(diag)
{}
DiagonalMatrix (std::initializer_list<K> const &l)
{
assert(l.size() == rows);// Actually, this is not needed any more!
std::copy_n(l.begin(), std::min(static_cast<std::size_t>(rows),
l.size()),
diag_.begin());
}
/** \brief Assignment from a scalar */
DiagonalMatrix& operator= (const K& k)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment