1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
/* matrix/test.c
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
#if defined( _MSC_VER ) && defined( GSL_DLL )
#undef inline
#define inline __forceinline
#endif
#if (!GSL_RANGE_CHECK) && defined(HAVE_INLINE)
#undef GSL_RANGE_CHECK
#define GSL_RANGE_CHECK 1
#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_test.h>
#include <gsl/gsl_ieee_utils.h>
int status = 0;
#ifndef DESC
#define DESC ""
#endif
#define BASE_GSL_COMPLEX_LONG
#include "templates_on.h"
#include "test_complex_source.c"
#include "templates_off.h"
#undef BASE_GSL_COMPLEX_LONG
#define BASE_GSL_COMPLEX
#include "templates_on.h"
#include "test_complex_source.c"
#include "templates_off.h"
#undef BASE_GSL_COMPLEX
#define BASE_GSL_COMPLEX_FLOAT
#include "templates_on.h"
#include "test_complex_source.c"
#include "templates_off.h"
#undef BASE_GSL_COMPLEX_FLOAT
#define BASE_LONG_DOUBLE
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_LONG_DOUBLE
#define BASE_DOUBLE
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_DOUBLE
#define BASE_FLOAT
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_FLOAT
#define BASE_ULONG
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_ULONG
#define BASE_LONG
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_LONG
#define BASE_UINT
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_UINT
#define BASE_INT
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_INT
#define BASE_USHORT
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_USHORT
#define BASE_SHORT
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_SHORT
#define BASE_UCHAR
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_UCHAR
#define BASE_CHAR
#include "templates_on.h"
#include "test_source.c"
#include "templates_off.h"
#undef BASE_CHAR
void my_error_handler (const char *reason, const char *file,
int line, int err);
int
main (void)
{
size_t M = 53;
size_t N = 107;
gsl_ieee_env_setup ();
test_func (M, N);
test_float_func (M, N);
test_long_double_func (M, N);
test_ulong_func (M, N);
test_long_func (M, N);
test_uint_func (M, N);
test_int_func (M, N);
test_ushort_func (M, N);
test_short_func (M, N);
test_uchar_func (M, N);
test_char_func (M, N);
test_complex_func (M, N);
test_complex_float_func (M, N);
test_complex_long_double_func (M, N);
test_ops (M, N);
test_float_ops (M, N);
test_long_double_ops (M, N);
test_ulong_ops (M, N);
test_long_ops (M, N);
test_uint_ops (M, N);
test_int_ops (M, N);
test_ushort_ops (M, N);
test_short_ops (M, N);
test_uchar_ops (M, N);
test_char_ops (M, N);
test_ops (N, M);
test_float_ops (N, M);
test_long_double_ops (N, M);
test_ulong_ops (N, M);
test_long_ops (N, M);
test_uint_ops (N, M);
test_int_ops (N, M);
test_ushort_ops (N, M);
test_short_ops (N, M);
test_uchar_ops (N, M);
test_char_ops (N, M);
/* Must use smaller dimensions to prevent approximation of floats in
float_mul_elements test*/
{
const size_t P = 8;
const size_t Q = 12;
test_complex_ops (P, Q);
test_complex_float_ops (P, Q);
test_complex_long_double_ops (P, Q);
}
test_text (M, N);
test_float_text (M, N);
#if HAVE_PRINTF_LONGDOUBLE
test_long_double_text (M, N);
#endif
test_ulong_text (M, N);
test_long_text (M, N);
test_uint_text (M, N);
test_int_text (M, N);
test_ushort_text (M, N);
test_short_text (M, N);
test_uchar_text (M, N);
test_char_text (M, N);
test_complex_text (M, N);
test_complex_float_text (M, N);
#if HAVE_PRINTF_LONGDOUBLE
test_complex_long_double_text (M, N);
#endif
test_binary (M, N);
test_float_binary (M, N);
test_long_double_binary (M, N);
test_ulong_binary (M, N);
test_long_binary (M, N);
test_uint_binary (M, N);
test_int_binary (M, N);
test_ushort_binary (M, N);
test_short_binary (M, N);
test_uchar_binary (M, N);
test_char_binary (M, N);
test_complex_binary (M, N);
test_complex_float_binary (M, N);
test_complex_long_double_binary (M, N);
test_binary_noncontiguous (M, N);
test_float_binary_noncontiguous (M, N);
test_long_double_binary_noncontiguous (M, N);
test_ulong_binary_noncontiguous (M, N);
test_long_binary_noncontiguous (M, N);
test_uint_binary_noncontiguous (M, N);
test_int_binary_noncontiguous (M, N);
test_ushort_binary_noncontiguous (M, N);
test_short_binary_noncontiguous (M, N);
test_uchar_binary_noncontiguous (M, N);
test_char_binary_noncontiguous (M, N);
test_complex_binary_noncontiguous (M, N);
test_complex_float_binary_noncontiguous (M, N);
test_complex_long_double_binary_noncontiguous (M, N);
#if GSL_RANGE_CHECK
gsl_set_error_handler (&my_error_handler);
test_trap (M, N);
test_float_trap (M, N);
test_long_double_trap (M, N);
test_ulong_trap (M, N);
test_long_trap (M, N);
test_uint_trap (M, N);
test_int_trap (M, N);
test_ushort_trap (M, N);
test_short_trap (M, N);
test_uchar_trap (M, N);
test_char_trap (M, N);
test_complex_trap (M, N);
test_complex_float_trap (M, N);
test_complex_long_double_trap (M, N);
#endif
exit (gsl_test_summary ());
}
void
my_error_handler (const char *reason, const char *file, int line, int err)
{
if (0)
printf ("(caught [%s:%d: %s (%d)])\n", file, line, reason, err);
status = 1;
}
|