[Pkg-electronics-commits] [gnucap] 14/47: asserts in const d, u, l like in the nonconst

felix salfelder felix-guest at moszumanska.debian.org
Mon Sep 26 10:35:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository gnucap.

commit 051c648b9564b8653a04970096a871d8e6331023
Author: Felix Salfelder <felix at salfelder.org>
Date:   Wed Sep 14 01:16:46 2016 +0100

    asserts in const d,u,l like in the nonconst
---
 include/m_matrix.h | 64 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 54 insertions(+), 10 deletions(-)

diff --git a/include/m_matrix.h b/include/m_matrix.h
index 6cb5140..469d0ab 100644
--- a/include/m_matrix.h
+++ b/include/m_matrix.h
@@ -149,12 +149,12 @@ public:
   void		dezero(T& o);
   int		size()const		{return _size;}
   double 	density();
-  T 	d(int r, int  )const	{return *(_diaptr[r]);}
-  T const& s(int r, int c)const;
+  T 	d(int r, int  )const;
+  T     s(int r, int c)const;
 private:
-  T 	u(int r, int c)const	{return _colptr[c][r];}
-  T 	l(int r, int c)const	{return _rowptr[r][-c];}
-  T&	d(int r, int c);
+  T 	u(int r, int c)const;
+  T 	l(int r, int c)const;
+  T&	d(int r, int  );
   T&	u(int r, int c);
   T&	l(int r, int c);
   T&	m(int r, int c);
@@ -388,12 +388,26 @@ double BSMATRIX<T>::density()
   }
 }
 /*--------------------------------------------------------------------------*/
-/* d: fast matrix entry access, lvalue
+/* d: fast matrix entry access
  * It is known that the entry is valid and on the diagonal
  */
 template <class T>
+T BSMATRIX<T>::d(int r, int c) const
+{untested();
+  USE(c);
+  assert(_diaptr);
+  assert(r == c);
+  assert(0 <= r);
+  assert(r <= _size);
+
+  return *(_diaptr[r]);
+}
+/*--------------------------------------------------------------------------*/
+/* d: as above, but lvalue */
+template <class T>
 T& BSMATRIX<T>::d(int r, int c)
-{
+{untested();
+  USE(c);
   assert(_diaptr);
   assert(r == c);
   assert(0 <= r);
@@ -406,8 +420,23 @@ T& BSMATRIX<T>::d(int r, int c)
  * It is known that the entry is valid and in the upper triangle
  */
 template <class T>
+T BSMATRIX<T>::u(int r, int c) const
+{untested();
+  assert(_colptr);
+  assert(_lownode);
+  assert(0 < r);
+  assert(r <= c);
+  assert(c <= _size);
+  assert(1 <= _lownode[c]);
+  assert(_lownode[c] <= r);
+
+  return _colptr[c][r];
+}
+/*--------------------------------------------------------------------------*/
+/* u: as above, but lvalue */
+template <class T>
 T& BSMATRIX<T>::u(int r, int c)
-{
+{untested();
   assert(_colptr);
   assert(_lownode);
   assert(0 < r);
@@ -423,8 +452,23 @@ T& BSMATRIX<T>::u(int r, int c)
  * It is known that the entry is valid and in the lower triangle
  */
 template <class T>
+T BSMATRIX<T>::l(int r, int c) const
+{untested();
+  assert(_rowptr);
+  assert(_lownode);
+  assert(0 < c);
+  assert(c <= r);
+  assert(r <= _size);
+  assert(1 <= _lownode[r]);
+  assert(_lownode[r] <= c);
+
+  return _rowptr[r][-c];
+}
+/*--------------------------------------------------------------------------*/
+/* l: as above, but lvalue */
+template <class T>
 T& BSMATRIX<T>::l(int r, int c)
-{
+{untested();
   assert(_rowptr);
   assert(_lownode);
   assert(0 < c);
@@ -459,7 +503,7 @@ T& BSMATRIX<T>::m(int r, int c)
  *   but reading it gives a number not useful for anything.
  */
 template <class T>
-T const& BSMATRIX<T>::s(int row, int col)const
+T BSMATRIX<T>::s(int row, int col)const
 {untested();
   assert(_lownode);
   assert(0 <= col);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git



More information about the Pkg-electronics-commits mailing list