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