annotate libinterp/octave-value/ov-base-mat.h @ 20940:48b2ad5ee801

maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity. * libinterp/corefcn/oct-obj.h: Replaced. Contains a #warning issued if used in compilation and includes "ovl.h" instead. Original file renamed to libinterp/octave-value/ovl.h * libinterp/corefcn/oct-obj.cc: Renamed to libinterp/octave-value/ovl.cc. * oct-obj.cc (ovl ()): Added new function to return empty octave_value_list. * libinterp/corefcn/module.mk: Remove oct-obj.cc from build system. * libinterp/octave-value/module.mk: Add ovl.h and ovl.cc to build system. * mk-opts.pl, annotation-dialog.h, Cell.cc, __contourc__.cc, __dsearchn__.cc, __lin_interpn__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, defaults.cc, defun.cc, det.cc, dirfns.cc, dlmread.cc, eig.cc, error.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, graphics.cc, gripes.cc, help.cc, hess.cc, hex2num.cc, hook-fcn.h, input.cc, input.h, inv.cc, kron.cc, load-save.cc, lookup.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, lsode.cc, lu.cc, luinc.cc, max.cc, mex.cc, oct-hist.cc, oct-lvalue.cc, oct-lvalue.h, oct-map.h, oct-stream.cc, oct.h, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sparse-xpow.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symtab.h, syscalls.cc, sysdep.cc, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, xpow.cc, __delaunayn__.cc, __glpk__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, chol.cc, convhulln.cc, dmperm.cc, qr.cc, symbfact.cc, mkbuiltins, ov-base-diag.h, ov-base-int.cc, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-bool-mat.cc, ov-bool.cc, ov-builtin.cc, ov-cell.cc, ov-colon.cc, ov-complex.cc, ov-cs-list.h, ov-cx-mat.cc, ov-dld-fcn.cc, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.h, ov-mex-fcn.cc, ov-perm.h, ov-range.cc, ov-re-mat.cc, ov-scalar.cc, ov-str-mat.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, octave.cc, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-double-conv.cc, op-fcdm-fcdm.cc, op-fcdm-fdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-float-conv.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int-conv.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, parse.h, pt-arg-list.cc, pt-assign.cc, pt-binop.cc, pt-cbinop.cc, pt-cell.cc, pt-colon.cc, pt-const.cc, pt-eval.h, pt-fcn-handle.cc, pt-funcall.h, pt-id.cc, pt-idx.cc, pt-jump.cc, pt-mat.cc, pt-select.cc, pt-unop.cc, token.cc, Array-sym.cc: replace '#include "oct-obj.h"' with '#include "ovl.h"'.
author Rik <rik@octave.org>
date Fri, 18 Dec 2015 16:04:56 -0800
parents f7084eae3318
children 538b57866b90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
1 /*
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 18416
diff changeset
3 Copyright (C) 1998-2015 John W. Eaton
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10759
diff changeset
4 Copyright (C) 2009-2010 VZLU Prague
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
5
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
7
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6376
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6376
diff changeset
11 option) any later version.
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
12
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
16 for more details.
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
17
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6376
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6376
diff changeset
20 <http://www.gnu.org/licenses/>.
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
21
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
22 */
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
23
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 #if ! defined (octave_ov_base_mat_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
25 #define octave_ov_base_mat_h 1
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
26
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
27 #include <cstdlib>
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
28
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
29 #include <iosfwd>
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
30 #include <string>
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
31
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
32 #include "mx-base.h"
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
33 #include "str-vec.h"
6376
0eac3484e8df [project @ 2007-03-02 02:18:37 by jwe]
jwe
parents: 5900
diff changeset
34 #include "MatrixType.h"
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
35
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
36 #include "error.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20791
diff changeset
37 #include "ovl.h"
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
38 #include "ov-base.h"
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
39 #include "ov-typeinfo.h"
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
40
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
41 class tree_walker;
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
42
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
43 // Real matrix values.
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
44
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3221
diff changeset
45 template <class MT>
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3221
diff changeset
46 class
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
47 octave_base_matrix : public octave_base_value
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
48 {
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
49 public:
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
50
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
51 octave_base_matrix (void)
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11523
diff changeset
52 : octave_base_value (), matrix (), typ (), idx_cache () { }
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
53
6376
0eac3484e8df [project @ 2007-03-02 02:18:37 by jwe]
jwe
parents: 5900
diff changeset
54 octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ())
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
55 : octave_base_value (), matrix (m),
14861
f7afecdd87ef maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents: 14557
diff changeset
56 typ (t.is_known () ? new MatrixType (t) : 0), idx_cache ()
4676
c0aa75a64635 [project @ 2003-12-16 16:47:52 by jwe]
jwe
parents: 4661
diff changeset
57 {
c0aa75a64635 [project @ 2003-12-16 16:47:52 by jwe]
jwe
parents: 4661
diff changeset
58 if (matrix.ndims () == 0)
c0aa75a64635 [project @ 2003-12-16 16:47:52 by jwe]
jwe
parents: 4661
diff changeset
59 matrix.resize (dim_vector (0, 0));
c0aa75a64635 [project @ 2003-12-16 16:47:52 by jwe]
jwe
parents: 4661
diff changeset
60 }
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
61
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
62 octave_base_matrix (const octave_base_matrix& m)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
63 : octave_base_value (), matrix (m.matrix),
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
64 typ (m.typ ? new MatrixType (*m.typ) : 0),
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
65 idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
66 { }
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
67
9350
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
68 ~octave_base_matrix (void) { clear_cached_info (); }
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
69
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4676
diff changeset
70 size_t byte_size (void) const { return matrix.byte_size (); }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4676
diff changeset
71
5147
47e4c91e5799 [project @ 2005-02-16 21:06:19 by jwe]
jwe
parents: 5105
diff changeset
72 octave_value squeeze (void) const { return MT (matrix.squeeze ()); }
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4513
diff changeset
73
8458
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
74 octave_value full_value (void) const { return matrix; }
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
75
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
76 void maybe_economize (void) { matrix.maybe_economize (); }
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
77
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
78 octave_value subsref (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
79 const std::list<octave_value_list>& idx);
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
80
7651
443a8f5a50fd require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents: 7620
diff changeset
81 octave_value_list subsref (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
82 const std::list<octave_value_list>& idx, int)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
83 { return subsref (type, idx); }
4271
be631c1720ea [project @ 2003-01-03 19:36:04 by jwe]
jwe
parents: 4247
diff changeset
84
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
85 octave_value subsasgn (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
86 const std::list<octave_value_list>& idx,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
87 const octave_value& rhs);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
88
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5785
diff changeset
89 octave_value do_index_op (const octave_value_list& idx,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
90 bool resize_ok = false);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3219
diff changeset
91
13696
d6118a2c0644 fix indexing bug for matrices inside anonymous functions
John W. Eaton <jwe@octave.org>
parents: 12153
diff changeset
92 octave_value_list do_multi_index_op (int, const octave_value_list& idx)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
93 { return do_index_op (idx); }
13696
d6118a2c0644 fix indexing bug for matrices inside anonymous functions
John W. Eaton <jwe@octave.org>
parents: 12153
diff changeset
94
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3523
diff changeset
95 void assign (const octave_value_list& idx, const MT& rhs);
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3523
diff changeset
96
8679
280fae940bb0 optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8523
diff changeset
97 void assign (const octave_value_list& idx, typename MT::element_type rhs);
280fae940bb0 optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8523
diff changeset
98
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7651
diff changeset
99 void delete_elements (const octave_value_list& idx);
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7651
diff changeset
100
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4271
diff changeset
101 dim_vector dims (void) const { return matrix.dims (); }
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4271
diff changeset
102
8994
a8d30dc1beec cellfun optimizations
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
103 octave_idx_type numel (void) const { return matrix.numel (); }
a8d30dc1beec cellfun optimizations
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
104
10653
ec5fa46e0e45 override ndims and numel for scalars and matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
105 int ndims (void) const { return matrix.ndims (); }
ec5fa46e0e45 override ndims and numel for scalars and matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
106
5602
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5307
diff changeset
107 octave_idx_type nnz (void) const { return matrix.nnz (); }
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5307
diff changeset
108
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4563
diff changeset
109 octave_value reshape (const dim_vector& new_dims) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
110 { return MT (matrix.reshape (new_dims)); }
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4563
diff changeset
111
4593
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4567
diff changeset
112 octave_value permute (const Array<int>& vec, bool inv = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
113 { return MT (matrix.permute (vec, inv)); }
4593
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4567
diff changeset
114
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5602
diff changeset
115 octave_value resize (const dim_vector& dv, bool fill = false) const;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
116
4017
0eb247b9cc9b [project @ 2002-08-03 04:07:14 by jwe]
jwe
parents: 4015
diff changeset
117 octave_value all (int dim = 0) const { return matrix.all (dim); }
0eb247b9cc9b [project @ 2002-08-03 04:07:14 by jwe]
jwe
parents: 4015
diff changeset
118 octave_value any (int dim = 0) const { return matrix.any (dim); }
3221
eba59b8c64dc [project @ 1998-11-19 20:31:46 by jwe]
jwe
parents: 3220
diff changeset
119
9350
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
120 MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); }
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
121 MatrixType matrix_type (const MatrixType& _typ) const;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5759
diff changeset
122
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
123 octave_value diag (octave_idx_type k = 0) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
124 { return octave_value (matrix.diag (k)); }
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
125
14557
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
126 octave_value diag (octave_idx_type m, octave_idx_type n) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
127 { return octave_value (matrix.diag (m, n)); }
14557
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
128
7463
2467639bd8c0 eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
129 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
130 { return octave_value (matrix.sort (dim, mode)); }
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
131 octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
132 sortmode mode = ASCENDING) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
133 { return octave_value (matrix.sort (sidx, dim, mode)); }
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
134
8734
767ed8cc6634 rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents: 8733
diff changeset
135 sortmode is_sorted (sortmode mode = UNSORTED) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
136 { return matrix.is_sorted (mode); }
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8679
diff changeset
137
8733
3ef774603887 rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
138 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
139 { return matrix.sort_rows_idx (mode); }
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8679
diff changeset
140
8734
767ed8cc6634 rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents: 8733
diff changeset
141 sortmode is_sorted_rows (sortmode mode = UNSORTED) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
142 { return matrix.is_sorted_rows (mode); }
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8679
diff changeset
143
3221
eba59b8c64dc [project @ 1998-11-19 20:31:46 by jwe]
jwe
parents: 3220
diff changeset
144 bool is_matrix_type (void) const { return true; }
eba59b8c64dc [project @ 1998-11-19 20:31:46 by jwe]
jwe
parents: 3220
diff changeset
145
eba59b8c64dc [project @ 1998-11-19 20:31:46 by jwe]
jwe
parents: 3220
diff changeset
146 bool is_numeric_type (void) const { return true; }
eba59b8c64dc [project @ 1998-11-19 20:31:46 by jwe]
jwe
parents: 3220
diff changeset
147
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
148 bool is_defined (void) const { return true; }
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
149
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
150 bool is_constant (void) const { return true; }
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
151
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3219
diff changeset
152 bool is_true (void) const;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3219
diff changeset
153
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
154 bool print_as_scalar (void) const;
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
155
18416
bcd71a2531d3 Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17870
diff changeset
156 void print (std::ostream& os, bool pr_as_read_syntax = false);
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
157
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
158 void print_info (std::ostream& os, const std::string& prefix) const;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
159
17870
1d2e709bbbda rework short_disp methods
John W. Eaton <jwe@octave.org>
parents: 17866
diff changeset
160 void short_disp (std::ostream& os) const;
17866
ea0ecbe2eaf5 display matrix values in GUI workspace viewer (bug #40499)
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
161
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9358
diff changeset
162 MT& matrix_ref (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
163 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
164 clear_cached_info ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
165 return matrix;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
166 }
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9358
diff changeset
167
10665
0f310fce905d implement octave_base_matrix::matrix_ref const
Jaroslav Hajek <highegg@gmail.com>
parents: 10653
diff changeset
168 const MT& matrix_ref (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
169 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
170 return matrix;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
171 }
10665
0f310fce905d implement octave_base_matrix::matrix_ref const
Jaroslav Hajek <highegg@gmail.com>
parents: 10653
diff changeset
172
10670
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10665
diff changeset
173 octave_value
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10665
diff changeset
174 fast_elem_extract (octave_idx_type n) const;
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10665
diff changeset
175
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10665
diff changeset
176 bool
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10665
diff changeset
177 fast_elem_insert (octave_idx_type n, const octave_value& x);
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10665
diff changeset
178
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
179 protected:
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
180
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
181 MT matrix;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5759
diff changeset
182
9350
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
183 idx_vector set_idx_cache (const idx_vector& idx) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
184 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
185 delete idx_cache;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
186 idx_cache = idx ? new idx_vector (idx) : 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
187 return idx;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
188 }
9350
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
189
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
190 void clear_cached_info (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
191 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
192 delete typ; typ = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
193 delete idx_cache; idx_cache = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
194 }
9350
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
195
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
196 mutable MatrixType *typ;
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8994
diff changeset
197 mutable idx_vector *idx_cache;
12153
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
198
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
199 private:
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
200
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
201 // No assignment.
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
202
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
203 octave_base_matrix& operator = (const octave_base_matrix&);
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
204 };
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
205
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents:
diff changeset
206 #endif