changeset 1697:597c3ca9f6e8

[project @ 1996-01-07 02:13:24 by jwe]
author jwe
date Sun, 07 Jan 1996 02:13:24 +0000
parents 937366359b50
children 0892abda7553
files liboctave/dMatrix.cc
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/dMatrix.cc	Sun Jan 07 02:09:32 1996 +0000
+++ b/liboctave/dMatrix.cc	Sun Jan 07 02:13:24 1996 +0000
@@ -160,13 +160,18 @@
 Matrix&
 Matrix::insert (const DiagMatrix& a, int r, int c)
 {
-  if (r < 0 || r + a.rows () - 1 > rows ()
-      || c < 0 || c + a.cols () - 1 > cols ())
+  int a_nr = a.rows ();
+  int a_nc = a.cols ();
+
+  if (r < 0 || r + a_nr - 1 > rows ()
+      || c < 0 || c + a_nc - 1 > cols ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
     }
 
+  fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
+
   for (int i = 0; i < a.length (); i++)
     elem (r+i, c+i) = a.elem (i, i);