annotate liboctave/numeric/DET.h @ 31855:1daf8bfceac3

default or disable more ctors, dtors, and assignment ops In most classes in liboctave and libinterp (except for the files in octave-value subdirectory) that had at least one of the following functions defined default constructor copy constructor copy assignment operator destructor declare all of them. In most cases, this means declaring default or deleted functions. In some cases, explicit definitions have been replaced by equivalent default functions. In some cases, default or deleted move constructors and move assignment operators have also been declared. Files affected: __magick_read__.cc, c-file-ptr-stream.h, dynamic-ld.h, environment.h, error.h, event-manager.h, fcn-info.h, genprops.awk, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gtk-manager.h, hook-fcn.h, input.h, interpreter.cc, latex-text-renderer.cc, load-path.h, load-save.h, ls-hdf5.h, mex.cc, mxarray.h, oct-errno.h, oct-fstrm.h, oct-hist.h, oct-iostrm.h, oct-map.h, oct-prcstrm.h, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h, pager.h, procstream.h, symrec.h, symtab.h, text-engine.h, text-renderer.h, utils.h, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc, octave.h, anon-fcn-validator.h, bp-table.h, comment-list.h, lex.h, oct-lvalue.h, oct-parse.yy, parse.h, profiler.h, pt-args-block.h, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-classdef.h, pt-cmd.h, pt-decl.h, pt-eval.h, pt-id.h, pt-misc.h, pt-spmd.h, token.h, Array-base.cc, CColVector.h, CNDArray.h, CRowVector.h, CSparse.h, Range.h, boolNDArray.h, boolSparse.h, chNDArray.h, dColVector.h, dNDArray.h, dRowVector.h, dSparse.h, fCColVector.h, fCNDArray.h, fCRowVector.h, fColVector.h, fNDArray.h, fRowVector.h, idx-vector.h, DASPK.h, DASRT.h, DASSL.h, DET.h, LSODE.h, Quad.h, chol.h, oct-fftw.h, oct-norm.cc, oct-rand.h, sparse-qr.cc, svd.cc, child-list.h, file-stat.h, oct-env.h, oct-group.h, oct-time.h, action-container.h, cmd-edit.cc, cmd-hist.cc, kpse.h, lo-array-errwarn.h, lo-regexp.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-string.h, octave-preserve-stream-state.h, quit.h, unwind-prot.h, and octave-svgconvert.cc.
author John W. Eaton <jwe@octave.org>
date Fri, 17 Feb 2023 23:27:46 -0500
parents 21f9b34eb893
children ae4e19c0a2b1 2e484f9f1f18
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
3 // Copyright (C) 2008-2023 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #if ! defined (octave_DET_h)
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
27 #define octave_DET_h 1
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
30
23662
bd77ab816e43 eliminate obsolete file lo-math.h
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
31 #include <cmath>
bd77ab816e43 eliminate obsolete file lo-math.h
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
32
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
33 #include "lo-mappers.h"
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
34 #include "oct-cmplx.h"
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
35
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
36 template <typename T>
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
37 class
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
38 base_det
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
39 {
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
40 public:
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
41
11505
9a308e96194e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
42 base_det (T c = 1, int e = 0)
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
43 : m_c2 (), m_e2 ()
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
44 {
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
45 m_c2 = octave::math::log2 (c, m_e2);
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
46 m_e2 += e;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
47 }
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
48
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
49 base_det (T c, double e, double b)
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
50 : m_c2 (), m_e2 ()
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
51 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
52 e *= octave::math::log2 (b);
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
53 m_e2 = e;
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
54 c *= octave::math::exp2 (e - m_e2);
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
55 int f;
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
56 m_c2 = octave::math::log2 (c, f);
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
57 m_e2 += f;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
58 }
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
59
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
60 OCTAVE_DEFAULT_COPY_MOVE_DELETE (base_det)
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
61
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
62 T coef () const { return m_c2; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
63 int exp () const { return m_e2; }
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
64
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
65 T value () const { return m_c2 * static_cast<T> (std::ldexp (1.0, m_e2)); }
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
66 operator T () const { return value (); }
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
67
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
68 base_det square () const { return base_det (m_c2*m_c2, m_e2+m_e2); }
8336
9813c07ca946 make det take advantage of matrix type
Jaroslav Hajek <highegg@gmail.com>
parents: 8335
diff changeset
69
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
70 void operator *= (T t)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
71 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
72 int e;
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
73 m_c2 *= t;
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
74 // Renormalize m_c2 to [0.5, 1), and find required change in exponent.
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
75 m_c2 = octave::math::log2 (m_c2, e);
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
76 m_e2 += e;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
77 }
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
78
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
79 private:
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
80
30054
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
81 T m_c2;
c75465d8e816 maint: use "m_" prefix for member variables in class base_det.
Rik <rik@octave.org>
parents: 29358
diff changeset
82 int m_e2;
8335
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
83 };
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
84
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
85 // Provide the old types by typedefs.
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
86 typedef base_det<double> DET;
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
87 typedef base_det<float> FloatDET;
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
88 typedef base_det<Complex> ComplexDET;
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
89 typedef base_det<FloatComplex> FloatComplexDET;
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
90
64cf956a109c templatize & fix DET
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
91 #endif