Mercurial > octave
view 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 |
line wrap: on
line source
//////////////////////////////////////////////////////////////////////// // // Copyright (C) 2008-2023 The Octave Project Developers // // See the file COPYRIGHT.md in the top-level directory of this // distribution or <https://octave.org/copyright/>. // // This file is part of Octave. // // Octave is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Octave is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Octave; see the file COPYING. If not, see // <https://www.gnu.org/licenses/>. // //////////////////////////////////////////////////////////////////////// #if ! defined (octave_DET_h) #define octave_DET_h 1 #include "octave-config.h" #include <cmath> #include "lo-mappers.h" #include "oct-cmplx.h" template <typename T> class base_det { public: base_det (T c = 1, int e = 0) : m_c2 (), m_e2 () { m_c2 = octave::math::log2 (c, m_e2); m_e2 += e; } base_det (T c, double e, double b) : m_c2 (), m_e2 () { e *= octave::math::log2 (b); m_e2 = e; c *= octave::math::exp2 (e - m_e2); int f; m_c2 = octave::math::log2 (c, f); m_e2 += f; } OCTAVE_DEFAULT_COPY_MOVE_DELETE (base_det) T coef () const { return m_c2; } int exp () const { return m_e2; } T value () const { return m_c2 * static_cast<T> (std::ldexp (1.0, m_e2)); } operator T () const { return value (); } base_det square () const { return base_det (m_c2*m_c2, m_e2+m_e2); } void operator *= (T t) { int e; m_c2 *= t; // Renormalize m_c2 to [0.5, 1), and find required change in exponent. m_c2 = octave::math::log2 (m_c2, e); m_e2 += e; } private: T m_c2; int m_e2; }; // Provide the old types by typedefs. typedef base_det<double> DET; typedef base_det<float> FloatDET; typedef base_det<Complex> ComplexDET; typedef base_det<FloatComplex> FloatComplexDET; #endif