aboutsummaryrefslogtreecommitdiff
path: root/src/TP_utilities.c
diff options
context:
space:
mode:
authorknarf <knarf@b2a53a04-0f4f-0410-87ed-f9f25ced00cf>2005-02-26 14:05:39 +0000
committerknarf <knarf@b2a53a04-0f4f-0410-87ed-f9f25ced00cf>2005-02-26 14:05:39 +0000
commit0b28e2b6563dcc87e3e8ae0dd325f7b9dce76493 (patch)
tree6b6a655aaa9d8170b62f0f73ed0c130bfb1c0f01 /src/TP_utilities.c
parent4e6de8925c991fa2ba8cdb41cb4c3ed2044330e0 (diff)
transform // style comments into /* */ style comments because some compilers
do not understand C99 yet, unfortunately :( no other change done git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinInitialData/TwoPunctures/trunk@40 b2a53a04-0f4f-0410-87ed-f9f25ced00cf
Diffstat (limited to 'src/TP_utilities.c')
-rw-r--r--src/TP_utilities.c120
1 files changed, 61 insertions, 59 deletions
diff --git a/src/TP_utilities.c b/src/TP_utilities.c
index 5c4b5da..4a35884 100644
--- a/src/TP_utilities.c
+++ b/src/TP_utilities.c
@@ -1,4 +1,4 @@
-// TwoPunctures: File "utilities.c"
+/* TwoPunctures: File "utilities.c"*/
#include <math.h>
#include <stdio.h>
@@ -6,7 +6,7 @@
#include <stdlib.h>
#include "TP_utilities.h"
-//-----------------------------------------------------------------------------
+/*---------------------------------------------------------------------------*/
void
nrerror (char error_text[])
/* Numerical Recipes standard error handler */
@@ -17,7 +17,7 @@ nrerror (char error_text[])
exit (1);
}
-//-----------------------------------------------------------------------------
+/*---------------------------------------------------------------------------*/
int *
ivector (long nl, long nh)
/* allocate an int vector with subscript range v[nl..nh] */
@@ -30,7 +30,7 @@ ivector (long nl, long nh)
return v - nl + NR_END;
}
-//-----------------------------------------------------------------------------
+/*---------------------------------------------------------------------------*/
double *
dvector (long nl, long nh)
/* allocate a double vector with subscript range v[nl..nh] */
@@ -43,7 +43,7 @@ dvector (long nl, long nh)
return v - nl + NR_END;
}
-//-----------------------------------------------------------------------------
+/*---------------------------------------------------------------------------*/
int **
imatrix (long nrl, long nrh, long ncl, long nch)
/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
@@ -73,7 +73,7 @@ imatrix (long nrl, long nrh, long ncl, long nch)
return m;
}
-//-----------------------------------------------------------------------------
+/*---------------------------------------------------------------------------*/
double **
dmatrix (long nrl, long nrh, long ncl, long nch)
/* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
@@ -103,7 +103,7 @@ dmatrix (long nrl, long nrh, long ncl, long nch)
return m;
}
-//-----------------------------------------------------------------------------
+/*---------------------------------------------------------------------------*/
double ***
d3tensor (long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
/* allocate a double 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
@@ -150,7 +150,7 @@ d3tensor (long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
return t;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
void
free_ivector (int *v, long nl, long nh)
/* free an int vector allocated with ivector() */
@@ -158,7 +158,7 @@ free_ivector (int *v, long nl, long nh)
free ((FREE_ARG) (v + nl - NR_END));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
void
free_dvector (double *v, long nl, long nh)
/* free a double vector allocated with dvector() */
@@ -166,7 +166,7 @@ free_dvector (double *v, long nl, long nh)
free ((FREE_ARG) (v + nl - NR_END));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
void
free_imatrix (int **m, long nrl, long nrh, long ncl, long nch)
/* free an int matrix allocated by imatrix() */
@@ -175,7 +175,7 @@ free_imatrix (int **m, long nrl, long nrh, long ncl, long nch)
free ((FREE_ARG) (m + nrl - NR_END));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
void
free_dmatrix (double **m, long nrl, long nrh, long ncl, long nch)
/* free a double matrix allocated by dmatrix() */
@@ -184,7 +184,7 @@ free_dmatrix (double **m, long nrl, long nrh, long ncl, long nch)
free ((FREE_ARG) (m + nrl - NR_END));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
void
free_d3tensor (double ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh)
@@ -195,7 +195,7 @@ free_d3tensor (double ***t, long nrl, long nrh, long ncl, long nch,
free ((FREE_ARG) (t + nrl - NR_END));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
int
minimum2 (int i, int j)
{
@@ -205,7 +205,7 @@ minimum2 (int i, int j)
return result;
}
-//-----------------------------------------------------------------------------
+/*-------------------------------------------------------------------------*/
int
minimum3 (int i, int j, int k)
{
@@ -217,7 +217,7 @@ minimum3 (int i, int j, int k)
return result;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
int
maximum2 (int i, int j)
{
@@ -227,7 +227,7 @@ maximum2 (int i, int j)
return result;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
int
maximum3 (int i, int j, int k)
{
@@ -239,7 +239,7 @@ maximum3 (int i, int j, int k)
return result;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
int
pow_int (int mantisse, int exponent)
{
@@ -251,28 +251,28 @@ pow_int (int mantisse, int exponent)
return result;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
double
atanh (double x)
{
return 0.5 * log ((1 + x) / (1 - x));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
double
asinh (double x)
{
return log (x + sqrt (1 + x * x));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
double
acosh (double x)
{
return log (x + sqrt (x * x - 1));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Cadd (dcomplex a, dcomplex b)
{
@@ -282,7 +282,7 @@ Cadd (dcomplex a, dcomplex b)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Csub (dcomplex a, dcomplex b)
{
@@ -292,7 +292,7 @@ Csub (dcomplex a, dcomplex b)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Cmul (dcomplex a, dcomplex b)
{
@@ -302,7 +302,7 @@ Cmul (dcomplex a, dcomplex b)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
RCmul (double x, dcomplex a)
{
@@ -312,7 +312,7 @@ RCmul (double x, dcomplex a)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Cdiv (dcomplex a, dcomplex b)
{
@@ -335,7 +335,7 @@ Cdiv (dcomplex a, dcomplex b)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Complex (double re, double im)
{
@@ -345,7 +345,7 @@ Complex (double re, double im)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Conjg (dcomplex z)
{
@@ -355,7 +355,7 @@ Conjg (dcomplex z)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
double
Cabs (dcomplex z)
{
@@ -379,7 +379,7 @@ Cabs (dcomplex z)
return ans;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Csqrt (dcomplex z)
{
@@ -419,7 +419,7 @@ Csqrt (dcomplex z)
}
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Cexp (dcomplex z)
{
@@ -432,7 +432,7 @@ Cexp (dcomplex z)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Clog (dcomplex z)
{
@@ -444,7 +444,7 @@ Clog (dcomplex z)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Csin (dcomplex z)
{
@@ -454,7 +454,8 @@ Csin (dcomplex z)
c.i = cos (z.r) * sinh (z.i);
return c;
-} //-----------------------------------------------------------------------------
+}
+/*--------------------------------------------------------------------------*/
dcomplex
Ccos (dcomplex z)
@@ -467,21 +468,21 @@ Ccos (dcomplex z)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Ctan (dcomplex z)
{
return Cdiv (Csin (z), Ccos (z));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Ccot (dcomplex z)
{
return Cdiv (Ccos (z), Csin (z));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Csinh (dcomplex z)
{
@@ -491,7 +492,8 @@ Csinh (dcomplex z)
c.i = cosh (z.r) * sin (z.i);
return c;
-} //-----------------------------------------------------------------------------
+}
+/*--------------------------------------------------------------------------*/
dcomplex
Ccosh (dcomplex z)
@@ -504,21 +506,21 @@ Ccosh (dcomplex z)
return c;
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Ctanh (dcomplex z)
{
return Cdiv (Csinh (z), Ccosh (z));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
dcomplex
Ccoth (dcomplex z)
{
return Cdiv (Ccosh (z), Csinh (z));
}
-//-----------------------------------------------------------------------------
+/*--------------------------------------------------------------------------*/
void
chebft_Zeros (double u[], int n, int inv)
{
@@ -564,7 +566,7 @@ chebft_Zeros (double u[], int n, int inv)
free_dvector (c, 0, n);
}
-// -------------------------------------------------------------------------------
+/* --------------------------------------------------------------------------*/
void
chebft_Extremes (double u[], int n, int inv)
@@ -607,7 +609,7 @@ chebft_Extremes (double u[], int n, int inv)
free_dvector (c, 0, N);
}
-// -------------------------------------------------------------------------------
+/* --------------------------------------------------------------------------*/
void
chder (double *c, double *cder, int n)
@@ -620,7 +622,7 @@ chder (double *c, double *cder, int n)
cder[j] = cder[j + 2] + 2 * (j + 1) * c[j + 1];
}
-// -------------------------------------------------------------------------------
+/* --------------------------------------------------------------------------*/
double
chebev (double a, double b, double c[], int m, double x)
{
@@ -637,7 +639,7 @@ chebev (double a, double b, double c[], int m, double x)
return y * d - dd + 0.5 * c[0];
}
-// -------------------------------------------------------------------------------
+/* --------------------------------------------------------------------------*/
void
fourft (double *u, int N, int inv)
{
@@ -646,7 +648,7 @@ fourft (double *u, int N, int inv)
M = N / 2;
a = dvector (0, M);
- b = dvector (1, M); // Actually: b=vector(1,M-1) but this is problematic if M=1
+ b = dvector (1, M); /* Actually: b=vector(1,M-1) but this is problematic if M=1*/
fac = 1. / M;
Pi_fac = Pi * fac;
if (inv == 0)
@@ -750,11 +752,11 @@ fourev (double *u, int N, double x)
return result;
}
-// -------------------------------------------------------------------------------
+/* --------------------------------------------------------------------------*/
void
ludcmp (double **a, int n, int *indx, double *d)
-{ // Version of 'ludcmp' of the numerical recipes for
- // matrices a[0:n-1][0:n-1]
+{ /* Version of 'ludcmp' of the numerical recipes for*/
+ /* matrices a[0:n-1][0:n-1]*/
int i, imax, j, k;
double big, dum, sum, temp;
double *vv;
@@ -817,11 +819,11 @@ ludcmp (double **a, int n, int *indx, double *d)
free_dvector (vv, 0, n - 1);
}
-// -------------------------------------------------------------------------------
+/* --------------------------------------------------------------------------*/
void
lubksb (double **a, int n, int *indx, double b[])
-{ // Version of 'lubksb' of the numerical recipes for
- // matrices a[0:n-1][0:n-1] and vectors b[0:n-1]
+{ /* Version of 'lubksb' of the numerical recipes for*/
+ /* matrices a[0:n-1][0:n-1] and vectors b[0:n-1]*/
int i, ii = 0, ip, j;
double sum;
@@ -847,11 +849,11 @@ lubksb (double **a, int n, int *indx, double b[])
}
}
-// -----------------------------------------------------------------------------------
+/* -------------------------------------------------------------------------*/
void
tridag (double a[], double b[], double c[], double r[], double u[], int n)
-{ // Version of 'tridag' of the numerical recipes for
- // vectors a, b, c, r, u with indices in the range [0:n-1]
+{ /* Version of 'tridag' of the numerical recipes for*/
+ /* vectors a, b, c, r, u with indices in the range [0:n-1]*/
int j;
double bet, *gam;
@@ -872,7 +874,7 @@ tridag (double a[], double b[], double c[], double r[], double u[], int n)
free_dvector (gam, 0, n - 1);
}
-// -----------------------------------------------------------------------------------
+/* ------------------------------------------------------------------------*/
double
norm1 (double *v, int n)
{
@@ -886,7 +888,7 @@ norm1 (double *v, int n)
return result;
}
-// -----------------------------------------------------------------------------------
+/* -------------------------------------------------------------------------*/
double
norm2 (double *v, int n)
{
@@ -899,7 +901,7 @@ norm2 (double *v, int n)
return sqrt (result);
}
-// -----------------------------------------------------------------------------------
+/* -------------------------------------------------------------------------*/
double
scalarproduct (double *v, double *w, int n)
{
@@ -912,7 +914,7 @@ scalarproduct (double *v, double *w, int n)
return result;
}
-// -----------------------------------------------------------------------------------
+/* -------------------------------------------------------------------------*/
double
plgndr (int l, int m, double x)
{
@@ -953,4 +955,4 @@ plgndr (int l, int m, double x)
}
}
-// -----------------------------------------------------------------------------------
+/* -------------------------------------------------------------------------*/