File: math_utils.h

package info (click to toggle)
dpuser 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,632 kB
  • sloc: cpp: 121,623; ansic: 6,866; lex: 1,113; makefile: 747; yacc: 741; sh: 78
file content (64 lines) | stat: -rw-r--r-- 2,346 bytes parent folder | download | duplicates (4)
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
/***************************************************************************
                          math_utils.h  -  description
                             -------------------
    begin                : Wed Apr 19 2000
    copyright            : (C) 2000 by Thomas Ott
    email                : ott@mpe.mpg.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
/*
 * file: utils/math_utils.h
 * Purpose: some useful math routines not available in C - header file
 * Author: Thomas Ott
 *
 * History: 30.06.1999: file created
 */

#ifndef MATH_UTILS_H
#define MATH_UTILS_H

#include <math.h>
#include "defines.h"

#ifndef M_PI
#define M_PI (2.0*acos(0.0))
#endif

#define TWO_SQRT_LN2 2.0*sqrt(log(2.0))
#define FOUR_LN2 4.0*log(2.0)
#define EPS 1e-30
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr

int nint(double x);
double frac(double x);
int floatcmp(const void *a, const void *b);
double cosdeg(double x);
double sindeg(double x);
double rad2deg(double x);
double deg2rad(double x);
double sqr(double x);

#ifdef WIN
double asinh(double x);
double acosh(double x);
double atanh(double x);
#ifdef _WINDOWS // only for Visual C++ 6.0
extern "C" double rint(double x);
#endif
#endif /* WIN */

double lsqfit(double **A, double *S, int n, int m);
int trans_matrix(int ncoords, int nused, double *xref, double *yref, double *xim, double *yim, double *SX, double *SY, double *xerror, double *yerror);
int trans_matrix_errors(int ncoords, int nused, double *xref, double *yref, double *xim, double *yim, double *SX, double *SY, double *xerror, double *yerror);
double sinc(double x);
double cosc(double x);

#endif /* MATH_UTILS_H */