demos/spectrum/3rdparty/fftreal/TestAccuracy.h
changeset 25 e24348a560a6
equal deleted inserted replaced
23:89e065397ea6 25:e24348a560a6
       
     1 /*****************************************************************************
       
     2 
       
     3         TestAccuracy.h
       
     4         Copyright (c) 2005 Laurent de Soras
       
     5 
       
     6 --- Legal stuff ---
       
     7 
       
     8 This library is free software; you can redistribute it and/or
       
     9 modify it under the terms of the GNU Lesser General Public
       
    10 License as published by the Free Software Foundation; either
       
    11 version 2.1 of the License, or (at your option) any later version.
       
    12 
       
    13 This library is distributed in the hope that it will be useful,
       
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16 Lesser General Public License for more details.
       
    17 
       
    18 You should have received a copy of the GNU Lesser General Public
       
    19 License along with this library; if not, write to the Free Software
       
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    21 
       
    22 *Tab=3***********************************************************************/
       
    23 
       
    24 
       
    25 
       
    26 #if ! defined (TestAccuracy_HEADER_INCLUDED)
       
    27 #define	TestAccuracy_HEADER_INCLUDED
       
    28 
       
    29 #if defined (_MSC_VER)
       
    30 	#pragma once
       
    31 	#pragma warning (4 : 4250) // "Inherits via dominance."
       
    32 #endif
       
    33 
       
    34 
       
    35 
       
    36 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    37 
       
    38 
       
    39 
       
    40 template <class FO>
       
    41 class TestAccuracy
       
    42 {
       
    43 
       
    44 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    45 
       
    46 public:
       
    47 
       
    48 	typedef	typename FO::DataType	DataType;
       
    49 	typedef	long double	BigFloat;	// To get maximum accuracy during intermediate calculations
       
    50 
       
    51    static int		perform_test_single_object (FO &fft);
       
    52    static int		perform_test_d (FO &fft, const char *class_name_0);
       
    53    static int		perform_test_i (FO &fft, const char *class_name_0);
       
    54    static int		perform_test_di (FO &fft, const char *class_name_0);
       
    55 
       
    56 
       
    57 
       
    58 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    59 
       
    60 protected:
       
    61 
       
    62 
       
    63 
       
    64 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    65 
       
    66 private:
       
    67 
       
    68 	enum {			NBR_ACC_TESTS	= 10 * 1000 * 1000	};
       
    69    enum {         MAX_NBR_TESTS  = 10000  };
       
    70 
       
    71    static void		compute_tf (DataType s [], const DataType x [], long length);
       
    72 	static void		compute_itf (DataType x [], const DataType s [], long length);
       
    73 	static int		compare_vect_display (const DataType x_ptr [], const DataType y_ptr [], long len, BigFloat &max_err_rel);
       
    74 	static BigFloat
       
    75 						compute_power (const DataType x_ptr [], long len);
       
    76 	static BigFloat
       
    77 						compute_power (const DataType x_ptr [], const DataType y_ptr [], long len);
       
    78 	static void		compare_vect (const DataType x_ptr [], const DataType y_ptr [], BigFloat &power, long &max_err_pos, long len);
       
    79 
       
    80 
       
    81 
       
    82 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    83 
       
    84 private:
       
    85 
       
    86 						TestAccuracy ();
       
    87 						~TestAccuracy ();
       
    88 						TestAccuracy (const TestAccuracy &other);
       
    89 	TestAccuracy &	operator = (const TestAccuracy &other);
       
    90 	bool				operator == (const TestAccuracy &other);
       
    91 	bool				operator != (const TestAccuracy &other);
       
    92 
       
    93 };	// class TestAccuracy
       
    94 
       
    95 
       
    96 
       
    97 #include	"TestAccuracy.hpp"
       
    98 
       
    99 
       
   100 
       
   101 #endif	// TestAccuracy_HEADER_INCLUDED
       
   102 
       
   103 
       
   104 
       
   105 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/