GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DET.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2008-2017 Jaroslav Hajek
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_DET_h)
24 #define octave_DET_h 1
25 
26 #include "octave-config.h"
27 
28 #include <cmath>
29 #include "oct-cmplx.h"
30 #include "lo-mappers.h"
31 
32 template <typename T>
33 class
35 {
36 public:
37 
38  base_det (T c = 1, int e = 0)
39  : c2 (), e2 ()
40  {
41  c2 = octave::math::log2 (c, e2);
42  e2 += e;
43  }
44 
45  base_det (T c, double e, double b)
46  : c2 (), e2 ()
47  {
48  e *= octave::math::log2 (b);
49  e2 = e;
50  c *= octave::math::exp2 (e - e2);
51  int f;
52  c2 = octave::math::log2 (c, f);
53  e2 += f;
54  }
55 
56  base_det (const base_det& a) : c2 (a.c2), e2 (a.e2) { }
57 
59  {
60  c2 = a.c2;
61  e2 = a.e2;
62  return *this;
63  }
64 
65  T coef (void) const { return c2; }
66  int exp (void) const { return e2; }
67 
68  T value () const { return c2 * static_cast<T> (std::ldexp (1.0, e2)); }
69  operator T () const { return value (); }
70 
71  base_det square () const { return base_det (c2*c2, e2+e2); }
72 
73  void operator *= (T t)
74  {
75  int e;
76  c2 *= octave::math::log2 (t, e);
77  e2 += e;
78  }
79 
80 private:
81 
82  T c2;
83  int e2;
84 };
85 
86 // Provide the old types by typedefs.
91 
92 #endif
base_det< double > DET
Definition: DET.h:87
base_det< FloatComplex > FloatComplexDET
Definition: DET.h:90
int e2
Definition: DET.h:83
T coef(void) const
Definition: DET.h:65
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
double exp2(double x)
Definition: lo-mappers.cc:287
base_det(const base_det &a)
Definition: DET.h:56
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
T value() const
Definition: DET.h:68
i e
Definition: data.cc:2724
int exp(void) const
Definition: DET.h:66
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
base_det< float > FloatDET
Definition: DET.h:88
T c2
Definition: DET.h:82
base_det(T c=1, int e=0)
Definition: DET.h:38
ColumnVector & operator=(const ColumnVector &a)
Definition: dColVector.h:55
ComplexColumnVector operator*=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:151
Definition: DET.h:33
base_det square() const
Definition: DET.h:71
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by nd tex zero divided by nd ifnottex and any operation involving another NaN value(5+NaN).Note that NaN always compares not equal to NaN(NaN!
b
Definition: cellfun.cc:398
base_det< Complex > ComplexDET
Definition: DET.h:89
base_det(T c, double e, double b)
Definition: DET.h:45
double log2(double x)
Definition: lo-mappers.cc:233