Mercurial > octave-nkf
annotate libinterp/octave-value/ov-intx.h @ 17787:175b392e91fe
Use GNU style coding conventions for code in libinterp/
* libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc,
libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc,
libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h,
libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h,
libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc,
libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc,
libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h,
libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h,
libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/input.h, libinterp/corefcn/inv.cc,
libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc,
libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h,
libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc,
libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc,
libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc,
libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc,
libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc,
libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc,
libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h,
libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc,
libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h,
libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h,
libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h,
libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc,
libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc,
libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h,
libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc,
libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc,
libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc,
libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc,
libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc,
libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc,
libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc,
libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.cc,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc,
libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc,
libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc,
libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h,
libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h,
libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h,
libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.cc,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.cc,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.cc,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.cc,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc,
libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc,
libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h,
libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc,
libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc,
libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc,
libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h,
libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc,
libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc,
libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc,
libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc,
libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc,
libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc,
libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc,
libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc,
libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc,
libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc,
libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc,
libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc,
libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc,
libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc,
libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc,
libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc,
libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc,
libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc,
libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc,
libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc,
libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc,
libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc,
libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc,
libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc,
libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc,
libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc,
libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc,
libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc,
libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc,
libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc,
libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc,
libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc,
libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc,
libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc,
libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc,
libinterp/operators/ops.h, libinterp/parse-tree/lex.h,
libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h,
libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc,
libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h,
libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc,
libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc,
libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc,
libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h,
libinterp/parse-tree/token.h, libinterp/version.cc:
Use GNU style coding conventions for code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Mon, 28 Oct 2013 19:51:46 -0700 |
parents | d63878346099 |
children | e473c4853afc |
rev | line source |
---|---|
4904 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
3 Copyright (C) 2004-2013 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10405
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
4904 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
4904 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
4904 | 21 |
22 */ | |
23 | |
24 #include <cstdlib> | |
25 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
26 #include <iosfwd> |
4904 | 27 #include <string> |
28 | |
29 #include "mx-base.h" | |
30 #include "oct-alloc.h" | |
31 #include "str-vec.h" | |
32 | |
33 #include "error.h" | |
15149
62a35ae7d6a2
use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents:
15057
diff
changeset
|
34 #include "mxarray.h" |
4944 | 35 #include "oct-stream.h" |
4904 | 36 #include "ov-base.h" |
37 #include "ov-base-int.h" | |
38 #include "ov-typeinfo.h" | |
4982 | 39 #include "gripes.h" |
4904 | 40 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7201
diff
changeset
|
41 #include "ov-re-mat.h" |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7201
diff
changeset
|
42 #include "ov-scalar.h" |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7201
diff
changeset
|
43 |
4904 | 44 class |
6693 | 45 OCTINTERP_API |
4904 | 46 OCTAVE_VALUE_INT_MATRIX_T |
8321
69b6127f6962
better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents:
8039
diff
changeset
|
47 : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > |
4904 | 48 { |
49 public: | |
50 | |
51 OCTAVE_VALUE_INT_MATRIX_T (void) | |
8321
69b6127f6962
better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents:
8039
diff
changeset
|
52 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > () { } |
4904 | 53 |
8321
69b6127f6962
better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents:
8039
diff
changeset
|
54 OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda) |
69b6127f6962
better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents:
8039
diff
changeset
|
55 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { } |
4904 | 56 |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
57 OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda) |
8321
69b6127f6962
better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents:
8039
diff
changeset
|
58 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > |
69b6127f6962
better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents:
8039
diff
changeset
|
59 (intNDArray<OCTAVE_INT_T> (nda)) { } |
7064 | 60 |
4904 | 61 ~OCTAVE_VALUE_INT_MATRIX_T (void) { } |
62 | |
5759 | 63 octave_base_value *clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 { return new OCTAVE_VALUE_INT_MATRIX_T (*this); } |
4904 | 65 |
5759 | 66 octave_base_value *empty_clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 { return new OCTAVE_VALUE_INT_MATRIX_T (); } |
4904 | 68 |
6069 | 69 bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; } |
5895 | 70 |
6223 | 71 bool is_integer_type (void) const { return true; } |
72 | |
9685 | 73 builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; } |
74 | |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
75 public: |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
76 |
5533 | 77 int8NDArray |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
78 int8_array_value (void) const { return int8NDArray (matrix); } |
5533 | 79 |
80 int16NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
81 int16_array_value (void) const { return int16NDArray (matrix); } |
5533 | 82 |
83 int32NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
84 int32_array_value (void) const { return int32NDArray (matrix); } |
5533 | 85 |
86 int64NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
87 int64_array_value (void) const { return int64NDArray (matrix); } |
5533 | 88 |
89 uint8NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
90 uint8_array_value (void) const { return uint8NDArray (matrix); } |
5533 | 91 |
92 uint16NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
93 uint16_array_value (void) const { return uint16NDArray (matrix); } |
5533 | 94 |
95 uint32NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
96 uint32_array_value (void) const { return uint32NDArray (matrix); } |
5533 | 97 |
98 uint64NDArray | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
99 uint64_array_value (void) const { return uint64NDArray (matrix); } |
4904 | 100 |
4982 | 101 double |
102 double_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 double retval = lo_ieee_nan_value (); |
4982 | 105 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
106 if (numel () > 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
107 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 gripe_implicit_conversion ("Octave:array-to-scalar", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 type_name (), "real scalar"); |
4982 | 110 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 retval = matrix(0).double_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
112 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
113 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
114 gripe_invalid_conversion (type_name (), "real scalar"); |
4982 | 115 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
116 return retval; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
117 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
118 } |
4982 | 119 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
120 float |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
121 float_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 float retval = lo_ieee_float_nan_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
124 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 if (numel () > 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 gripe_implicit_conversion ("Octave:array-to-scalar", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 type_name (), "real scalar"); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
129 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 retval = matrix(0).float_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
132 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 gripe_invalid_conversion (type_name (), "real scalar"); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
134 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 return retval; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
136 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
138 |
4983 | 139 double scalar_value (bool = false) const { return double_value (); } |
4982 | 140 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
141 float float_scalar_value (bool = false) const { return float_value (); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
142 |
6214 | 143 Matrix |
144 matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
145 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
146 Matrix retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
147 dim_vector dv = dims (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
148 if (dv.length () > 2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
149 error ("invalid conversion of %s to Matrix", type_name ().c_str ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
150 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
152 retval = Matrix (dv(0), dv(1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
153 double *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
154 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
155 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
156 vec[i] = matrix(i).double_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
157 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
158 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 } |
6214 | 160 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
161 FloatMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
162 float_matrix_value (bool = false) const |
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 FloatMatrix retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
165 dim_vector dv = dims (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
166 if (dv.length () > 2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
168 else |
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 retval = FloatMatrix (dv(0), dv(1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 float *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
172 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
173 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
174 vec[i] = matrix(i).float_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
175 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
176 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
177 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
178 |
6214 | 179 ComplexMatrix |
180 complex_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
181 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 ComplexMatrix retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
183 dim_vector dv = dims (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
184 if (dv.length () > 2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 error ("invalid conversion of %s to Matrix", type_name ().c_str ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
186 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
187 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 retval = ComplexMatrix (dv(0), dv(1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
189 Complex *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
190 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
191 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
192 vec[i] = Complex (matrix(i).double_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
193 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
194 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
195 } |
6214 | 196 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
197 FloatComplexMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
198 float_complex_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
199 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
200 FloatComplexMatrix retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
201 dim_vector dv = dims (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
202 if (dv.length () > 2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
203 error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
204 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
205 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
206 retval = FloatComplexMatrix (dv(0), dv(1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
207 FloatComplex *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
208 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
209 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
210 vec[i] = FloatComplex (matrix(i).float_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
211 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
212 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
213 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
214 |
4915 | 215 NDArray |
216 array_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
217 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
218 NDArray retval (matrix.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
219 double *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
220 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
221 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
222 vec[i] = matrix(i).double_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
223 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
224 } |
4963 | 225 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
226 FloatNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
227 float_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
228 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
229 FloatNDArray retval (matrix.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
230 float *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
231 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
232 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
233 vec[i] = matrix(i).float_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
234 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
235 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
236 |
4963 | 237 ComplexNDArray |
238 complex_array_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
239 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
240 ComplexNDArray retval (matrix.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
241 Complex *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
242 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
243 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
244 vec[i] = Complex (matrix(i).double_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
245 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
246 } |
4915 | 247 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
248 FloatComplexNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
249 float_complex_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
250 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
251 FloatComplexNDArray retval (matrix.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
252 FloatComplex *vec = retval.fortran_vec (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
253 octave_idx_type nel = matrix.numel (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
254 for (octave_idx_type i = 0; i < nel; i++) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
255 vec[i] = FloatComplex (matrix(i).float_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
256 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
257 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
258 |
5898 | 259 boolNDArray |
5943 | 260 bool_array_value (bool warn = false) const |
5898 | 261 { |
262 boolNDArray retval (dims ()); | |
263 | |
264 octave_idx_type nel = numel (); | |
5943 | 265 |
266 if (warn && matrix.any_element_not_one_or_zero ()) | |
267 gripe_logical_conversion (); | |
268 | |
6214 | 269 bool *vec = retval.fortran_vec (); |
5898 | 270 for (octave_idx_type i = 0; i < nel; i++) |
7198 | 271 vec[i] = matrix(i).bool_value (); |
5898 | 272 |
273 return retval; | |
274 } | |
275 | |
5533 | 276 charNDArray |
277 char_array_value (bool = false) const | |
278 { | |
279 charNDArray retval (dims ()); | |
280 | |
281 octave_idx_type nel = numel (); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
282 |
6214 | 283 char *vec = retval.fortran_vec (); |
5533 | 284 for (octave_idx_type i = 0; i < nel; i++) |
7198 | 285 vec[i] = matrix(i).char_value (); |
5533 | 286 |
287 return retval; | |
288 } | |
289 | |
9606
a04352386a6b
clear index cache on ++,-- operators
Jaroslav Hajek <highegg@gmail.com>
parents:
9358
diff
changeset
|
290 // Use matrix_ref here to clear index cache. |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
291 void increment (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
292 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
293 matrix_ref () += OCTAVE_INT_T (1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
294 } |
8039
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
7999
diff
changeset
|
295 |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
7999
diff
changeset
|
296 void decrement (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
297 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
298 matrix_ref () -= OCTAVE_INT_T (1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
299 } |
5829 | 300 |
9607
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9606
diff
changeset
|
301 void changesign (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
302 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
303 matrix_ref ().changesign (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
304 } |
9607
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9606
diff
changeset
|
305 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
306 idx_vector index_vector (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
307 { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } |
4938 | 308 |
4944 | 309 int write (octave_stream& os, int block_size, |
10313 | 310 oct_data_conv::data_type output_type, int skip, |
311 oct_mach_info::float_format flt_fmt) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
312 { return os.write (matrix, block_size, output_type, skip, flt_fmt); } |
4944 | 313 |
9358
d4b1314a7c31
mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents:
9350
diff
changeset
|
314 // Unsafe. This function exists to support the MEX interface. |
d4b1314a7c31
mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents:
9350
diff
changeset
|
315 // You should not use it anywhere else. |
d4b1314a7c31
mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents:
9350
diff
changeset
|
316 void *mex_get_data (void) const { return matrix.mex_get_data (); } |
d4b1314a7c31
mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents:
9350
diff
changeset
|
317 |
5900 | 318 mxArray *as_mxArray (void) const |
319 { | |
320 mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, dims (), mxREAL); | |
321 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
322 OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
323 (retval->get_data ()); |
5900 | 324 |
6686 | 325 mwSize nel = numel (); |
5900 | 326 |
327 const OCTAVE_INT_T *p = matrix.data (); | |
328 | |
6686 | 329 for (mwIndex i = 0; i < nel; i++) |
5900 | 330 pr[i] = p[i].value (); |
331 | |
332 return retval; | |
333 } | |
334 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
335 octave_value map (unary_mapper_t umap) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
336 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
337 switch (umap) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
338 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
339 case umap_abs: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
340 return matrix.abs (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
341 case umap_signum: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
342 return matrix.signum (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
343 case umap_ceil: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
344 case umap_conj: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
345 case umap_fix: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
346 case umap_floor: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
347 case umap_real: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
348 case umap_round: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
349 return matrix; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
350 case umap_imag: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
351 return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
352 case umap_isnan: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
353 case umap_isna: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
354 case umap_isinf: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
355 return boolNDArray (matrix.dims (), false); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
356 case umap_finite: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
357 return boolNDArray (matrix.dims (), true); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
358 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
359 default: |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
360 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
361 octave_matrix m (array_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
362 return m.map (umap); |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
363 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
364 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
365 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7201
diff
changeset
|
366 |
4904 | 367 private: |
368 | |
369 DECLARE_OCTAVE_ALLOCATOR | |
370 | |
371 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
372 }; | |
373 | |
374 class | |
6693 | 375 OCTINTERP_API |
4904 | 376 OCTAVE_VALUE_INT_SCALAR_T |
377 : public octave_base_int_scalar<OCTAVE_INT_T> | |
378 { | |
379 public: | |
380 | |
381 OCTAVE_VALUE_INT_SCALAR_T (void) | |
382 : octave_base_int_scalar<OCTAVE_INT_T> () { } | |
383 | |
384 OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda) | |
385 : octave_base_int_scalar<OCTAVE_INT_T> (nda) { } | |
386 | |
387 ~OCTAVE_VALUE_INT_SCALAR_T (void) { } | |
388 | |
5759 | 389 octave_base_value *clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
390 { return new OCTAVE_VALUE_INT_SCALAR_T (*this); } |
4904 | 391 |
5759 | 392 octave_base_value *empty_clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
393 { return new OCTAVE_VALUE_INT_MATRIX_T (); } |
4904 | 394 |
5885 | 395 octave_value do_index_op (const octave_value_list& idx, |
10313 | 396 bool resize_ok = false) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
397 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
398 // FIXME: this doesn't solve the problem of |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
399 // |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
400 // a = 1; a([1,1], [1,1], [1,1]) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
401 // |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
402 // and similar constructions. Hmm... |
4964 | 403 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
404 // FIXME: using this constructor avoids narrowing the |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
405 // 1x1 matrix back to a scalar value. Need a better solution |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
406 // to this problem. |
4964 | 407 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
408 octave_value tmp |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
409 (new OCTAVE_VALUE_INT_MATRIX_T |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
410 (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ())); |
4964 | 411 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
412 return tmp.do_index_op (idx, resize_ok); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
413 } |
4964 | 414 |
6069 | 415 bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; } |
5895 | 416 |
6223 | 417 bool is_integer_type (void) const { return true; } |
418 | |
9685 | 419 builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; } |
420 | |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
421 public: |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
422 |
5533 | 423 octave_int8 |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
424 int8_scalar_value (void) const { return octave_int8 (scalar); } |
5533 | 425 |
426 octave_int16 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
427 int16_scalar_value (void) const { return octave_int16 (scalar); } |
5533 | 428 |
429 octave_int32 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
430 int32_scalar_value (void) const { return octave_int32 (scalar); } |
5533 | 431 |
432 octave_int64 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
433 int64_scalar_value (void) const { return octave_int64 (scalar); } |
5533 | 434 |
435 octave_uint8 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
436 uint8_scalar_value (void) const { return octave_uint8 (scalar); } |
5533 | 437 |
438 octave_uint16 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
439 uint16_scalar_value (void) const { return octave_uint16 (scalar); } |
5533 | 440 |
441 octave_uint32 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
442 uint32_scalar_value (void) const { return octave_uint32 (scalar); } |
5533 | 443 |
444 octave_uint64 | |
10405
cc69a17ec801
remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
445 uint64_scalar_value (void) const { return octave_uint64 (scalar); } |
5533 | 446 |
447 int8NDArray | |
448 int8_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
449 { return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); } |
4904 | 450 |
5533 | 451 int16NDArray |
452 int16_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
453 { return int16NDArray (dim_vector (1, 1), int16_scalar_value ()); } |
5533 | 454 |
455 int32NDArray | |
456 int32_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
457 { return int32NDArray (dim_vector (1, 1), int32_scalar_value ()); } |
5533 | 458 |
459 int64NDArray | |
460 int64_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
461 { return int64NDArray (dim_vector (1, 1), int64_scalar_value ()); } |
5533 | 462 |
463 uint8NDArray | |
464 uint8_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
465 { return uint8NDArray (dim_vector (1, 1), uint8_scalar_value ()); } |
5533 | 466 |
467 uint16NDArray | |
468 uint16_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
469 { return uint16NDArray (dim_vector (1, 1), uint16_scalar_value ()); } |
5533 | 470 |
471 uint32NDArray | |
472 uint32_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
473 { return uint32NDArray (dim_vector (1, 1), uint32_scalar_value ()); } |
5533 | 474 |
475 uint64NDArray | |
476 uint64_array_value (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
477 { return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); } |
4904 | 478 |
5731 | 479 octave_value resize (const dim_vector& dv, bool fill = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
480 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
481 if (fill) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
482 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
483 intNDArray<OCTAVE_INT_T> retval (dv, 0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
484 if (dv.numel ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
485 retval(0) = scalar; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
486 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
487 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
488 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
489 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
490 intNDArray<OCTAVE_INT_T> retval (dv); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
491 if (dv.numel ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
492 retval(0) = scalar; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
493 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
494 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
495 } |
4982 | 496 |
7198 | 497 double double_value (bool = false) const { return scalar.double_value (); } |
4983 | 498 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
499 float float_value (bool = false) const { return scalar.float_value (); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
500 |
7198 | 501 double scalar_value (bool = false) const { return scalar.double_value (); } |
4982 | 502 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
503 float float_scalar_value (bool = false) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
504 { return scalar.float_value (); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
505 |
6214 | 506 Matrix |
507 matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
508 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
509 Matrix retval (1, 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
510 retval(0,0) = scalar.double_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
511 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
512 } |
6214 | 513 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
514 FloatMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
515 float_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
516 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
517 FloatMatrix retval (1, 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
518 retval(0,0) = scalar.float_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
519 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
520 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
521 |
6214 | 522 ComplexMatrix |
523 complex_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
524 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
525 ComplexMatrix retval (1, 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
526 retval(0,0) = Complex (scalar.double_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
527 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
528 } |
6214 | 529 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
530 FloatComplexMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
531 float_complex_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
532 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
533 FloatComplexMatrix retval (1, 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
534 retval(0,0) = FloatComplex (scalar.float_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
535 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
536 } |
6214 | 537 |
4915 | 538 NDArray |
539 array_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
540 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
541 NDArray retval (dim_vector (1, 1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
542 retval(0) = scalar.double_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
543 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
544 } |
4963 | 545 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
546 FloatNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
547 float_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
548 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
549 FloatNDArray retval (dim_vector (1, 1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
550 retval(0) = scalar.float_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
551 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
552 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
553 |
4963 | 554 ComplexNDArray |
555 complex_array_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
556 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
557 ComplexNDArray retval (dim_vector (1, 1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
558 retval(0) = FloatComplex (scalar.double_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
559 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
560 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
561 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
562 FloatComplexNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7636
diff
changeset
|
563 float_complex_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
564 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
565 FloatComplexNDArray retval (dim_vector (1, 1)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
566 retval(0) = FloatComplex (scalar.float_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
567 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
568 } |
4915 | 569 |
12645
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
570 bool bool_value (bool warn = false) const |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
571 { |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
572 if (warn && scalar != 0.0 && scalar != 1.0) |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
573 gripe_logical_conversion (); |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
574 |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
575 return scalar.bool_value (); |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
576 } |
d3ccd2e37de6
Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
577 |
5898 | 578 boolNDArray |
5943 | 579 bool_array_value (bool warn = false) const |
5898 | 580 { |
581 boolNDArray retval (dim_vector (1, 1)); | |
5943 | 582 |
583 if (warn && scalar != 0.0 && scalar != 1.0) | |
584 gripe_logical_conversion (); | |
585 | |
7198 | 586 retval(0) = scalar.bool_value (); |
5943 | 587 |
5898 | 588 return retval; |
589 } | |
590 | |
5533 | 591 charNDArray |
592 char_array_value (bool = false) const | |
593 { | |
594 charNDArray retval (dim_vector (1, 1)); | |
7198 | 595 retval(0) = scalar.char_value (); |
5533 | 596 return retval; |
597 } | |
598 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
599 void increment (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
600 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
601 scalar += OCTAVE_INT_T (1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
602 } |
5829 | 603 |
8039
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
7999
diff
changeset
|
604 void decrement (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
605 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
606 scalar -= OCTAVE_INT_T (1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
607 } |
5829 | 608 |
4938 | 609 idx_vector index_vector (void) const { return idx_vector (scalar); } |
610 | |
4944 | 611 int write (octave_stream& os, int block_size, |
10313 | 612 oct_data_conv::data_type output_type, octave_idx_type skip, |
613 oct_mach_info::float_format flt_fmt) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
614 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
615 return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
616 block_size, output_type, skip, flt_fmt); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
617 } |
4944 | 618 |
5900 | 619 // Unsafe. This function exists to support the MEX interface. |
620 // You should not use it anywhere else. | |
621 void *mex_get_data (void) const { return scalar.mex_get_data (); } | |
622 | |
623 mxArray *as_mxArray (void) const | |
624 { | |
625 mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, 1, 1, mxREAL); | |
626 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
627 OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
628 (retval->get_data ()); |
5900 | 629 |
630 pr[0] = scalar.value (); | |
631 | |
632 return retval; | |
633 } | |
634 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
635 octave_value map (unary_mapper_t umap) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
636 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
637 switch (umap) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
638 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
639 case umap_abs: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
640 return scalar.abs (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
641 case umap_signum: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
642 return scalar.signum (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
643 case umap_ceil: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
644 case umap_conj: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
645 case umap_fix: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
646 case umap_floor: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
647 case umap_real: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
648 case umap_round: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
649 return scalar; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
650 case umap_imag: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
651 return OCTAVE_INT_T (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
652 case umap_isnan: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
653 case umap_isna: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
654 case umap_isinf: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
655 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
656 case umap_finite: |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
657 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
658 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
659 default: |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
660 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
661 octave_scalar m (scalar_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
662 return m.map (umap); |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
663 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
664 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
665 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7201
diff
changeset
|
666 |
4904 | 667 private: |
668 | |
669 DECLARE_OCTAVE_ALLOCATOR | |
670 | |
671 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
672 }; |