diff src/ov.cc @ 5164:57077d0ddc8e

[project @ 2005-02-25 19:55:24 by jwe]
author jwe
date Fri, 25 Feb 2005 19:55:28 +0000
parents 47e4c91e5799
children 23b37da9fd5b
line wrap: on
line diff
--- a/src/ov.cc	Fri Feb 25 17:42:55 2005 +0000
+++ b/src/ov.cc	Fri Feb 25 19:55:28 2005 +0000
@@ -38,6 +38,9 @@
 #include "ov-cell.h"
 #include "ov-scalar.h"
 #include "ov-re-mat.h"
+#include "ov-bool-sparse.h"
+#include "ov-cx-sparse.h"
+#include "ov-re-sparse.h"
 #include "ov-int8.h"
 #include "ov-int16.h"
 #include "ov-int32.h"
@@ -602,6 +605,27 @@
   maybe_mutate ();
 }
 
+octave_value::octave_value (const SparseMatrix& m, const SparseType &t)
+  : rep (new octave_sparse_matrix (m, t))
+{
+  rep->count = 1;
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const SparseComplexMatrix& m, const SparseType &t)
+  : rep (new octave_sparse_complex_matrix (m, t))
+{
+  rep->count = 1;
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const SparseBoolMatrix& bm, const SparseType &t)
+  : rep (new octave_sparse_bool_matrix (bm, t))
+{
+  rep->count = 1;
+  maybe_mutate ();
+}
+
 octave_value::octave_value (const octave_int8& i)
   : rep (new octave_int8_scalar (i))
 {
@@ -1705,6 +1729,13 @@
 {
   octave_value retval;
 
+  // Rapid return for concatenation with an empty object. Dimension
+  // checking handled elsewhere.
+  if (v1.all_zero_dims ())
+    return v2;
+  if (v2.all_zero_dims ())
+    return v1;
+
   int t1 = v1.type_id ();
   int t2 = v2.type_id ();
 
@@ -2165,6 +2196,9 @@
   octave_uint16_matrix::register_type ();
   octave_uint32_matrix::register_type ();
   octave_uint64_matrix::register_type ();
+  octave_sparse_bool_matrix::register_type ();
+  octave_sparse_matrix::register_type ();
+  octave_sparse_complex_matrix::register_type ();
   octave_struct::register_type ();
   octave_file::register_type ();
   octave_list::register_type ();