GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-bool-sparse.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2015 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 #include <iostream>
29 #include <limits>
30 #include <vector>
31 
32 #include "dim-vector.h"
33 
34 #include "mxarray.h"
35 #include "ov-base.h"
36 #include "ov-scalar.h"
37 #include "ov-bool.h"
38 #include "ov-bool-mat.h"
39 #include "gripes.h"
40 #include "ops.h"
41 #include "oct-locbuf.h"
42 
43 #include "oct-hdf5.h"
44 
45 #include "ov-re-sparse.h"
46 #include "ov-cx-sparse.h"
47 #include "ov-bool-sparse.h"
48 
49 #include "ov-base-sparse.h"
50 #include "ov-base-sparse.cc"
51 
53 
54 
56  "sparse bool matrix", "logical");
57 
58 static octave_base_value *
60 {
62 
63  return
64  new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ()));
65 }
66 
69 {
72 }
73 
76 {
77  octave_base_value *retval = 0;
78 
80  {
81  // Don't use numel, since it can overflow for very large matrices
82  // Note that for the second test, this means it becomes approximative
83  // since it involves a cast to double to avoid issues of overflow
84  if (matrix.rows () == 1 && matrix.cols () == 1)
85  {
86  // Const copy of the matrix, so the right version of () operator used
87  const SparseBoolMatrix tmp (matrix);
88 
89  retval = new octave_bool (tmp (0));
90  }
91  else if (matrix.cols () > 0 && matrix.rows () > 0
92  && (double (matrix.byte_size ()) > double (matrix.rows ())
93  * double (matrix.cols ()) * sizeof (bool)))
94  retval = new octave_bool_matrix (matrix.matrix_value ());
95  }
96 
97  return retval;
98 }
99 
100 double
102 {
103  double retval = lo_ieee_nan_value ();
104 
105  if (numel () > 0)
106  {
107  if (numel () > 1)
108  gripe_implicit_conversion ("Octave:array-to-scalar",
109  "bool sparse matrix", "real scalar");
110 
111  retval = matrix (0, 0);
112  }
113  else
114  gripe_invalid_conversion ("bool sparse matrix", "real scalar");
115 
116  return retval;
117 }
118 
119 Complex
121 {
122  double tmp = lo_ieee_nan_value ();
123 
124  Complex retval (tmp, tmp);
125 
126  if (rows () > 0 && columns () > 0)
127  {
128  if (numel () > 1)
129  gripe_implicit_conversion ("Octave:array-to-scalar",
130  "bool sparse matrix", "complex scalar");
131 
132  retval = matrix (0, 0);
133  }
134  else
135  gripe_invalid_conversion ("bool sparse matrix", "complex scalar");
136 
137  return retval;
138 }
139 
142  char type) const
143 {
145  return tmp.convert_to_str (pad, force, type);
146 }
147 
148 // FIXME: These are inefficient ways of creating full matrices
149 
150 Matrix
152 {
153  return Matrix (matrix.matrix_value ());
154 }
155 
158 {
159  return ComplexMatrix (matrix.matrix_value ());
160 }
161 
164 {
166 }
167 
168 NDArray
170 {
171  return NDArray (Matrix (matrix.matrix_value ()));
172 }
173 
176 {
177  charNDArray retval (dims (), 0);
178  octave_idx_type nc = matrix.cols ();
179  octave_idx_type nr = matrix.rows ();
180 
181  for (octave_idx_type j = 0; j < nc; j++)
182  for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
183  retval(matrix.ridx (i) + nr * j) = static_cast<char>(matrix.data (i));
184 
185  return retval;
186 }
187 
190 {
191  return matrix.matrix_value ();
192 }
193 
196 {
197  return boolNDArray (matrix.matrix_value ());
198 }
199 
200 
203 {
204  return SparseMatrix (this->matrix);
205 }
206 
209 {
210  return SparseComplexMatrix (this->matrix);
211 }
212 
213 bool
214 octave_sparse_bool_matrix::save_binary (std::ostream& os, bool&)
215 {
216  dim_vector d = this->dims ();
217  if (d.length () < 1)
218  return false;
219 
220  // Ensure that additional memory is deallocated
222 
223  int nr = d(0);
224  int nc = d(1);
225  int nz = nnz ();
226 
227  int32_t itmp;
228  // Use negative value for ndims to be consistent with other formats
229  itmp = -2;
230  os.write (reinterpret_cast<char *> (&itmp), 4);
231 
232  itmp = nr;
233  os.write (reinterpret_cast<char *> (&itmp), 4);
234 
235  itmp = nc;
236  os.write (reinterpret_cast<char *> (&itmp), 4);
237 
238  itmp = nz;
239  os.write (reinterpret_cast<char *> (&itmp), 4);
240 
241  // add one to the printed indices to go from
242  // zero-based to one-based arrays
243  for (int i = 0; i < nc+1; i++)
244  {
245  octave_quit ();
246  itmp = matrix.cidx (i);
247  os.write (reinterpret_cast<char *> (&itmp), 4);
248  }
249 
250  for (int i = 0; i < nz; i++)
251  {
252  octave_quit ();
253  itmp = matrix.ridx (i);
254  os.write (reinterpret_cast<char *> (&itmp), 4);
255  }
256 
257  OCTAVE_LOCAL_BUFFER (char, htmp, nz);
258 
259  for (int i = 0; i < nz; i++)
260  htmp[i] = (matrix.data (i) ? 1 : 0);
261 
262  os.write (htmp, nz);
263 
264  return true;
265 }
266 
267 bool
268 octave_sparse_bool_matrix::load_binary (std::istream& is, bool swap,
269  oct_mach_info::float_format /* fmt */)
270 {
271  int32_t nz, nc, nr, tmp;
272  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
273  return false;
274 
275  if (swap)
276  swap_bytes<4> (&tmp);
277 
278  if (tmp != -2)
279  {
280  error ("load: only 2-D sparse matrices are supported");
281  return false;
282  }
283 
284  if (! is.read (reinterpret_cast<char *> (&nr), 4))
285  return false;
286  if (! is.read (reinterpret_cast<char *> (&nc), 4))
287  return false;
288  if (! is.read (reinterpret_cast<char *> (&nz), 4))
289  return false;
290 
291  if (swap)
292  {
293  swap_bytes<4> (&nr);
294  swap_bytes<4> (&nc);
295  swap_bytes<4> (&nz);
296  }
297 
298  SparseBoolMatrix m (static_cast<octave_idx_type> (nr),
299  static_cast<octave_idx_type> (nc),
300  static_cast<octave_idx_type> (nz));
301 
302  for (int i = 0; i < nc+1; i++)
303  {
304  octave_quit ();
305  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
306  return false;
307  if (swap)
308  swap_bytes<4> (&tmp);
309  m.cidx (i) = tmp;
310  }
311 
312  for (int i = 0; i < nz; i++)
313  {
314  octave_quit ();
315  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
316  return false;
317  if (swap)
318  swap_bytes<4> (&tmp);
319  m.ridx (i) = tmp;
320  }
321 
322  if (error_state || ! is)
323  return false;
324 
325  OCTAVE_LOCAL_BUFFER (char, htmp, nz);
326 
327  if (! is.read (htmp, nz))
328  return false;
329 
330  for (int i = 0; i < nz; i++)
331  m.data(i) = (htmp[i] ? 1 : 0);
332 
333  if (! m.indices_ok ())
334  return false;
335 
336  matrix = m;
337 
338  return true;
339 }
340 
341 bool
342 octave_sparse_bool_matrix::save_hdf5 (octave_hdf5_id loc_id, const char *name, bool)
343 {
344  bool retval = false;
345 
346 #if defined (HAVE_HDF5)
347 
348  dim_vector dv = dims ();
349  int empty = save_hdf5_empty (loc_id, name, dv);
350  if (empty)
351  return (empty > 0);
352 
353  // Ensure that additional memory is deallocated
355 #if HAVE_HDF5_18
356  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT,
357  H5P_DEFAULT);
358 #else
359  hid_t group_hid = H5Gcreate (loc_id, name, 0);
360 #endif
361  if (group_hid < 0)
362  return false;
363 
364  hid_t space_hid, data_hid;
365  space_hid = data_hid = -1;
367  octave_idx_type tmp;
368  hsize_t hdims[2];
369 
370  space_hid = H5Screate_simple (0, hdims, 0);
371  if (space_hid < 0)
372  {
373  H5Gclose (group_hid);
374  return false;
375  }
376 #if HAVE_HDF5_18
377  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
378  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
379 #else
380  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
381  H5P_DEFAULT);
382 #endif
383  if (data_hid < 0)
384  {
385  H5Sclose (space_hid);
386  H5Gclose (group_hid);
387  return false;
388  }
389 
390  tmp = m.rows ();
391  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL,
392  H5S_ALL, H5P_DEFAULT, &tmp) >= 0;
393  H5Dclose (data_hid);
394  if (!retval)
395  {
396  H5Sclose (space_hid);
397  H5Gclose (group_hid);
398  return false;
399  }
400 
401 #if HAVE_HDF5_18
402  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
403  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
404 #else
405  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
406  H5P_DEFAULT);
407 #endif
408  if (data_hid < 0)
409  {
410  H5Sclose (space_hid);
411  H5Gclose (group_hid);
412  return false;
413  }
414 
415  tmp = m.cols ();
416  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
417  H5P_DEFAULT, &tmp) >= 0;
418  H5Dclose (data_hid);
419  if (!retval)
420  {
421  H5Sclose (space_hid);
422  H5Gclose (group_hid);
423  return false;
424  }
425 
426 #if HAVE_HDF5_18
427  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
428  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
429 #else
430  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
431  H5P_DEFAULT);
432 #endif
433  if (data_hid < 0)
434  {
435  H5Sclose (space_hid);
436  H5Gclose (group_hid);
437  return false;
438  }
439 
440  tmp = m.nnz ();
441  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
442  H5P_DEFAULT, &tmp) >= 0;
443  H5Dclose (data_hid);
444  if (!retval)
445  {
446  H5Sclose (space_hid);
447  H5Gclose (group_hid);
448  return false;
449  }
450 
451  H5Sclose (space_hid);
452 
453  hdims[0] = m.cols () + 1;
454  hdims[1] = 1;
455 
456  space_hid = H5Screate_simple (2, hdims, 0);
457 
458  if (space_hid < 0)
459  {
460  H5Gclose (group_hid);
461  return false;
462  }
463 
464 #if HAVE_HDF5_18
465  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
466  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
467 #else
468  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
469  H5P_DEFAULT);
470 #endif
471  if (data_hid < 0)
472  {
473  H5Sclose (space_hid);
474  H5Gclose (group_hid);
475  return false;
476  }
477 
478  octave_idx_type * itmp = m.xcidx ();
479  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
480  H5P_DEFAULT, itmp) >= 0;
481  H5Dclose (data_hid);
482  if (!retval)
483  {
484  H5Sclose (space_hid);
485  H5Gclose (group_hid);
486  return false;
487  }
488 
489  H5Sclose (space_hid);
490 
491  hdims[0] = m.nnz ();
492  hdims[1] = 1;
493 
494  space_hid = H5Screate_simple (2, hdims, 0);
495 
496  if (space_hid < 0)
497  {
498  H5Gclose (group_hid);
499  return false;
500  }
501 
502 #if HAVE_HDF5_18
503  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
504  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
505 #else
506  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
507  H5P_DEFAULT);
508 #endif
509  if (data_hid < 0)
510  {
511  H5Sclose (space_hid);
512  H5Gclose (group_hid);
513  return false;
514  }
515 
516  itmp = m.xridx ();
517  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
518  H5P_DEFAULT, itmp) >= 0;
519  H5Dclose (data_hid);
520  if (!retval)
521  {
522  H5Sclose (space_hid);
523  H5Gclose (group_hid);
524  return false;
525  }
526 
527 #if HAVE_HDF5_18
528  data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid,
529  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
530 #else
531  data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid,
532  H5P_DEFAULT);
533 #endif
534  if (data_hid < 0)
535  {
536  H5Sclose (space_hid);
537  H5Gclose (group_hid);
538  return false;
539  }
540 
541  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, m.nnz ());
542  for (int i = 0; i < m.nnz (); i++)
543  htmp[i] = m.xdata(i);
544 
545  retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
546  H5P_DEFAULT, htmp) >= 0;
547  H5Dclose (data_hid);
548  H5Sclose (space_hid);
549  H5Gclose (group_hid);
550 
551 #else
552  gripe_save ("hdf5");
553 #endif
554 
555  return retval;
556 }
557 
558 bool
560 {
561  bool retval = false;
562 
563 #if defined (HAVE_HDF5)
564 
565  octave_idx_type nr, nc, nz;
566  hid_t group_hid, data_hid, space_hid;
567  hsize_t rank;
568 
569  dim_vector dv;
570  int empty = load_hdf5_empty (loc_id, name, dv);
571  if (empty > 0)
572  matrix.resize (dv);
573  if (empty)
574  return (empty > 0);
575 
576 #if HAVE_HDF5_18
577  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
578 #else
579  group_hid = H5Gopen (loc_id, name);
580 #endif
581  if (group_hid < 0) return false;
582 
583 #if HAVE_HDF5_18
584  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
585 #else
586  data_hid = H5Dopen (group_hid, "nr");
587 #endif
588  space_hid = H5Dget_space (data_hid);
589  rank = H5Sget_simple_extent_ndims (space_hid);
590 
591  if (rank != 0)
592  {
593  H5Dclose (data_hid);
594  H5Gclose (group_hid);
595  return false;
596  }
597 
598  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr)
599  < 0)
600  {
601  H5Dclose (data_hid);
602  H5Gclose (group_hid);
603  return false;
604  }
605 
606  H5Dclose (data_hid);
607 
608 #if HAVE_HDF5_18
609  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
610 #else
611  data_hid = H5Dopen (group_hid, "nc");
612 #endif
613  space_hid = H5Dget_space (data_hid);
614  rank = H5Sget_simple_extent_ndims (space_hid);
615 
616  if (rank != 0)
617  {
618  H5Dclose (data_hid);
619  H5Gclose (group_hid);
620  return false;
621  }
622 
623  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc)
624  < 0)
625  {
626  H5Dclose (data_hid);
627  H5Gclose (group_hid);
628  return false;
629  }
630 
631  H5Dclose (data_hid);
632 
633 #if HAVE_HDF5_18
634  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
635 #else
636  data_hid = H5Dopen (group_hid, "nz");
637 #endif
638  space_hid = H5Dget_space (data_hid);
639  rank = H5Sget_simple_extent_ndims (space_hid);
640 
641  if (rank != 0)
642  {
643  H5Dclose (data_hid);
644  H5Gclose (group_hid);
645  return false;
646  }
647 
648  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz)
649  < 0)
650  {
651  H5Dclose (data_hid);
652  H5Gclose (group_hid);
653  return false;
654  }
655 
656  H5Dclose (data_hid);
657 
658  SparseBoolMatrix m (static_cast<octave_idx_type> (nr),
659  static_cast<octave_idx_type> (nc),
660  static_cast<octave_idx_type> (nz));
661 
662 #if HAVE_HDF5_18
663  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
664 #else
665  data_hid = H5Dopen (group_hid, "cidx");
666 #endif
667  space_hid = H5Dget_space (data_hid);
668  rank = H5Sget_simple_extent_ndims (space_hid);
669 
670  if (rank != 2)
671  {
672  H5Sclose (space_hid);
673  H5Dclose (data_hid);
674  H5Gclose (group_hid);
675  return false;
676  }
677 
678  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
679  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
680 
681  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
682 
683  if (static_cast<int> (hdims[0]) != nc + 1
684  || static_cast<int> (hdims[1]) != 1)
685  {
686  H5Sclose (space_hid);
687  H5Dclose (data_hid);
688  H5Gclose (group_hid);
689  return false;
690  }
691 
692  octave_idx_type *itmp = m.xcidx ();
693  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp)
694  < 0)
695  {
696  H5Sclose (space_hid);
697  H5Dclose (data_hid);
698  H5Gclose (group_hid);
699  return false;
700  }
701 
702  H5Sclose (space_hid);
703  H5Dclose (data_hid);
704 
705 #if HAVE_HDF5_18
706  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
707 #else
708  data_hid = H5Dopen (group_hid, "ridx");
709 #endif
710  space_hid = H5Dget_space (data_hid);
711  rank = H5Sget_simple_extent_ndims (space_hid);
712 
713  if (rank != 2)
714  {
715  H5Sclose (space_hid);
716  H5Dclose (data_hid);
717  H5Gclose (group_hid);
718  return false;
719  }
720 
721  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
722 
723  if (static_cast<int> (hdims[0]) != nz
724  || static_cast<int> (hdims[1]) != 1)
725  {
726  H5Sclose (space_hid);
727  H5Dclose (data_hid);
728  H5Gclose (group_hid);
729  return false;
730  }
731 
732  itmp = m.xridx ();
733  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
734  H5P_DEFAULT, itmp) < 0)
735  {
736  H5Sclose (space_hid);
737  H5Dclose (data_hid);
738  H5Gclose (group_hid);
739  return false;
740  }
741 
742  H5Sclose (space_hid);
743  H5Dclose (data_hid);
744 
745 #if HAVE_HDF5_18
746  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
747 #else
748  data_hid = H5Dopen (group_hid, "data");
749 #endif
750  space_hid = H5Dget_space (data_hid);
751  rank = H5Sget_simple_extent_ndims (space_hid);
752 
753  if (rank != 2)
754  {
755  H5Sclose (space_hid);
756  H5Dclose (data_hid);
757  H5Gclose (group_hid);
758  return false;
759  }
760 
761  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
762 
763  if (static_cast<int> (hdims[0]) != nz
764  || static_cast<int> (hdims[1]) != 1)
765  {
766  H5Sclose (space_hid);
767  H5Dclose (data_hid);
768  H5Gclose (group_hid);
769  return false;
770  }
771 
772  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nz);
773 
774  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
775  H5P_DEFAULT, htmp) >= 0
776  && m.indices_ok ())
777  {
778  retval = true;
779 
780  for (int i = 0; i < nz; i++)
781  m.xdata(i) = htmp[i];
782 
783  matrix = m;
784  }
785 
786  H5Sclose (space_hid);
787  H5Dclose (data_hid);
788  H5Gclose (group_hid);
789 
790 #else
791  gripe_load ("hdf5");
792 #endif
793 
794  return retval;
795 }
796 
797 mxArray *
799 {
800  mwSize nz = nzmax ();
801  mxArray *retval = new mxArray (mxLOGICAL_CLASS, rows (), columns (),
802  nz, mxREAL);
803  bool *pr = static_cast<bool *> (retval->get_data ());
804  mwIndex *ir = retval->get_ir ();
805  mwIndex *jc = retval->get_jc ();
806 
807  for (mwIndex i = 0; i < nz; i++)
808  {
809  pr[i] = matrix.data (i);
810  ir[i] = matrix.ridx (i);
811  }
812 
813  for (mwIndex i = 0; i < columns () + 1; i++)
814  jc[i] = matrix.cidx (i);
815 
816  return retval;
817 }
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:180
octave_idx_type * xridx(void)
Definition: Sparse.h:524
ComplexMatrix complex_matrix_value(bool=false) const
octave_idx_type cols(void) const
Definition: Sparse.h:264
boolMatrix matrix_value(void) const
Definition: boolSparse.cc:248
T * data(void)
Definition: Sparse.h:509
octave_idx_type rows(void) const
Definition: Sparse.h:263
octave_idx_type columns(void) const
Definition: ov-base.h:301
void gripe_load(const char *type) const
Definition: ov-base.cc:1258
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
SparseMatrix sparse_matrix_value(bool=false) const
octave_idx_type * xcidx(void)
Definition: Sparse.h:537
void error(const char *fmt,...)
Definition: error.cc:476
void * get_data(void) const
Definition: mxarray.h:433
bool save_binary(std::ostream &os, bool &save_as_floats)
SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:164
void gripe_save(const char *type) const
Definition: ov-base.cc:1267
octave_idx_type * cidx(void)
Definition: Sparse.h:531
double lo_ieee_nan_value(void)
Definition: lo-ieee.cc:126
bool indices_ok(void) const
Definition: Sparse.h:684
octave_idx_type nzmax(void) const
Matrix matrix_value(bool=false) const
F77_RET_T const double const double double * d
int load_hdf5_empty(hid_t loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:790
octave_idx_type nnz(void) const
Definition: Sparse.h:248
boolNDArray bool_array_value(bool=false) const
mwIndex * get_ir(void) const
Definition: mxarray.h:442
double double_value(bool=false) const
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:59
#define CAST_CONV_ARG(t)
Definition: ops.h:83
ComplexNDArray complex_array_value(bool=false) const
#define OCTINTERP_API
Definition: mexproto.h:66
static int static_type_id(void)
Definition: ov-re-sparse.h:159
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
Definition: ov.h:1017
octave_idx_type numel(void) const
NDArray array_value(bool=false) const
Sparse< T > maybe_compress(bool remove_zeros=false)
Definition: Sparse.h:469
void resize(octave_idx_type r, octave_idx_type c)
Definition: Sparse.cc:944
boolMatrix bool_matrix_value(bool=false) const
int error_state
Definition: error.cc:101
size_t byte_size(void) const
Definition: Sparse.h:276
mxArray * as_mxArray(void) const
Definition: dMatrix.h:35
void mxArray
Definition: mex.h:53
friend class octave_value
Definition: ov-base.h:206
type_conv_info numeric_conversion_function(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
#define H5T_NATIVE_IDX
Definition: ls-hdf5.h:209
charNDArray char_array_value(bool=false) const
octave_idx_type * ridx(void)
Definition: Sparse.h:518
void gripe_invalid_conversion(const std::string &from, const std::string &to)
Definition: gripes.cc:99
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
T * xdata(void)
Definition: Sparse.h:511
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
int save_hdf5_empty(hid_t loc_id, const char *name, const dim_vector d)
Definition: ls-hdf5.cc:740
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:197
mwIndex * get_jc(void) const
Definition: mxarray.h:444
bool Vsparse_auto_mutate
Definition: ov-base.cc:118
octave_base_value * try_narrowing_conversion(void)
Definition: mxarray.h:52
std::complex< double > Complex
Definition: oct-cmplx.h:29
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Complex complex_value(bool=false) const
int length(void) const
Definition: dim-vector.h:281
octave_idx_type nnz(void) const
octave_idx_type rows(void) const
Definition: ov-base.h:294