From 3d5a1861d3bd4ac8cc2ec6b17ecbb328803fe056 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 18 Sep 2012 09:13:44 +0200
Subject: [PATCH] added implementation of initialising constructor

---
 MathLib/LinAlg/Dense/Matrix.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/MathLib/LinAlg/Dense/Matrix.h b/MathLib/LinAlg/Dense/Matrix.h
index c1045cf4498..ecc0db91bde 100644
--- a/MathLib/LinAlg/Dense/Matrix.h
+++ b/MathLib/LinAlg/Dense/Matrix.h
@@ -107,6 +107,13 @@ template<class T> Matrix<T>::Matrix (std::size_t rows, std::size_t cols)
       : nrows (rows), ncols (cols), data (new T[nrows*ncols])
 {}
 
+template<class T> Matrix<T>::Matrix (std::size_t rows, std::size_t cols, T const& initial_value)
+	: nrows (rows), ncols (cols), data (new T[nrows * ncols])
+{
+	const std::size_t n(nrows*ncols);
+	for (std::size_t k(0); k<n; k++) data[k] = initial_value;
+}
+
 template<class T> Matrix<T>::Matrix (const Matrix& src) :
 	nrows (src.getNRows ()), ncols (src.getNCols ()), data (new T[nrows * ncols])
 {
-- 
GitLab