#include <math.h>
#include <iosfwd>
#include "Vector.h"
#include "Matrix.h"
Go to the source code of this file.
|
#define | maxDWORD 4294967295 |
|
#define | INF 1.7E+308 |
|
#define | EOL 10 |
|
#define | PI 3.1415926535897932384626433832795 |
|
#define | ROOT2 1.41421356 |
|
|
double | condorAbs (const double t1) |
|
double | sign (const double a) |
|
double | sign (const double t1, const double t2) |
|
double | isInt (const double a) |
|
double | mmin (const double t1, const double t2) |
|
unsigned | mmin (const unsigned t1, const unsigned t2) |
|
int | mmin (const int t1, const int t2) |
|
double | mmax (const double t1, const double t2) |
|
unsigned | mmax (const unsigned t1, const unsigned t2) |
|
int | mmax (int t1, int t2) |
|
double | sqr (const double &t) |
|
double | CondorRound (double a) |
|
unsigned long | choose (unsigned n, unsigned k) |
|
double | rand1 () |
|
void | initRandom (int i=0) |
|
double | euclidianNorm (int i, double *xp) |
|
char | emptyline (const char *line) |
|
char * | GetRidOfTheEOL (char *tline) |
|
char * | removeQuotes (char *t) |
|
char ** | getNameTable (const char *line, int *ncolumn) |
|
char * | stringDuplicate (const char *l) |
|
char | isEmpty (const char *line) |
|
char * | removeAllEOL (char *t) |
|
char * | loadFile (FILE *f) |
|
const char * | skipLine (const char *l) |
|
const char * | skipSpaces (const char *l) |
|
void | deleteFile (const char *l) |
|
◆ EOL
◆ INF
◆ maxDWORD
#define maxDWORD 4294967295 |
◆ PI
#define PI 3.1415926535897932384626433832795 |
◆ ROOT2
◆ choose()
unsigned long choose |
( |
unsigned |
n, |
|
|
unsigned |
k |
|
) |
| |
Definition at line 38 of file tools.cpp.
40 const unsigned long uupSize = 100;
41 static unsigned long uup[uupSize];
43 static unsigned long Nold = 0;
44 static unsigned long Kold = 0;
48 if ( (
n <
k) || !
n )
return 0;
56 if ( (Nold ==
n) && (k < Kold) )
57 return *(uup + k - 1);
61 printf(
"choose( unsigned, unsigned) : overflow\n");
74 for (j=0; j<
mmin(i,k); j++)
84 return *(uup + k - 1);
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
◆ condorAbs()
double condorAbs |
( |
const double |
t1 | ) |
|
|
inline |
Definition at line 47 of file tools.h.
49 return t1 > 0.0 ? t1 : -t1;
◆ CondorRound()
double CondorRound |
( |
double |
a | ) |
|
|
inline |
◆ deleteFile()
void deleteFile |
( |
const char * |
l | ) |
|
◆ emptyline()
char emptyline |
( |
const char * |
line | ) |
|
◆ euclidianNorm()
double euclidianNorm |
( |
int |
i, |
|
|
double * |
xp |
|
) |
| |
Definition at line 113 of file tools.cpp.
122 const double SMALL=5.422e-20, BIG=1.304e19/((double)
i);
123 double s1=0,s2=0,s3=0, x1max=0, x3max=0, xabs;
133 s1=1.0+s1*
sqr(x1max/xabs);
144 s3=1.0+s3*
sqr(x3max/xabs);
148 if (xabs!=0) s3+=
sqr(xabs/x3max);
153 if (s1!=0)
return x1max*
sqrt(s1+(s2/x1max)/x1max);
156 if (s2>=x3max)
return sqrt(s2*(1.0+(x3max/s2)*(x3max*s3)));
157 return sqrt(x3max*((s2/x3max)+(x3max*s3)));
159 return x3max*
sqrt(s3);
void sqrt(Image< double > &op)
◆ getNameTable()
char** getNameTable |
( |
const char * |
line, |
|
|
int * |
ncolumn |
|
) |
| |
Definition at line 204 of file tools.cpp.
208 if (ncolumn) nc=*ncolumn;
213 while ((*n)&&(*n!=
'\t')&&(*n!=
' ')&&(*n!=13)&&(*n!=10)) n++;
215 while ((*n)&&((*n==
'\t')||(*n==
' ')||(*n==13)||(*n==10))) n++;
218 if (ncolumn) *ncolumn=nc;
219 char **names=(
char**)malloc(nc*
sizeof(
char**));
220 n=(
char*)malloc(strlen(line)+1);
223 for (j=0; j<nc-1; j++)
226 while ((*n)&&(*n!=
'\t')&&(*n!=
' ')&&(*n!=13)&&(*n!=10)) n++;
227 if (*n) { *n=0; n++; }
228 while ((*n)&&((*n==
'\t')||(*n==
' ')||(*n==13)||(*n==10))) n++;
◆ GetRidOfTheEOL()
char* GetRidOfTheEOL |
( |
char * |
tline | ) |
|
Definition at line 185 of file tools.cpp.
189 while ((*tline!=
EOL1)&&(*tline!=
EOL2)&&(*tline)) tline++;
◆ initRandom()
void initRandom |
( |
int |
i = 0 | ) |
|
◆ isEmpty()
char isEmpty |
( |
const char * |
line | ) |
|
◆ isInt()
double isInt |
( |
const double |
a | ) |
|
|
inline |
Definition at line 64 of file tools.h.
__host__ __device__ float2 floor(const float2 v)
◆ loadFile()
char* loadFile |
( |
FILE * |
f | ) |
|
Definition at line 265 of file tools.cpp.
271 char *buf=(
char*)malloc(l+1);
272 if (fread(buf,l,1,
f) != l) {
273 std::cerr <<
"error while loading file (no more info available)" << std::endl; exit(255);
◆ mmax() [1/3]
double mmax |
( |
const double |
t1, |
|
|
const double |
t2 |
|
) |
| |
|
inline |
Definition at line 84 of file tools.h.
86 return t1 > t2 ? t1 : t2;
◆ mmax() [2/3]
unsigned mmax |
( |
const unsigned |
t1, |
|
|
const unsigned |
t2 |
|
) |
| |
|
inline |
Definition at line 89 of file tools.h.
91 return t1 > t2 ? t1 : t2;
◆ mmax() [3/3]
int mmax |
( |
int |
t1, |
|
|
int |
t2 |
|
) |
| |
|
inline |
Definition at line 94 of file tools.h.
96 return t1 > t2 ? t1 : t2;
◆ mmin() [1/3]
double mmin |
( |
const double |
t1, |
|
|
const double |
t2 |
|
) |
| |
|
inline |
Definition at line 69 of file tools.h.
71 return t1 < t2 ? t1 : t2;
◆ mmin() [2/3]
unsigned mmin |
( |
const unsigned |
t1, |
|
|
const unsigned |
t2 |
|
) |
| |
|
inline |
Definition at line 74 of file tools.h.
76 return t1 < t2 ? t1 : t2;
◆ mmin() [3/3]
int mmin |
( |
const int |
t1, |
|
|
const int |
t2 |
|
) |
| |
|
inline |
Definition at line 79 of file tools.h.
81 return t1 < t2 ? t1 : t2;
◆ rand1()
◆ removeAllEOL()
char* removeAllEOL |
( |
char * |
t | ) |
|
Definition at line 246 of file tools.cpp.
251 if ((*t==
'\r')||(*t==
'\n')) *t=
' ';
◆ removeQuotes()
char* removeQuotes |
( |
char * |
t | ) |
|
Definition at line 194 of file tools.cpp.
196 if ((*t==
'\'')||(*t==
'"'))
◆ sign() [1/2]
double sign |
( |
const double |
a | ) |
|
|
inline |
◆ sign() [2/2]
double sign |
( |
const double |
t1, |
|
|
const double |
t2 |
|
) |
| |
|
inline |
◆ skipLine()
const char* skipLine |
( |
const char * |
l | ) |
|
Definition at line 257 of file tools.cpp.
259 while ((*t!=
'\r')&&(*t!=
'\n')&&(*t)) t++;
260 if (*t==
'\n') {
if (*(t+1)==
'\r') t++; }
261 else if (*t==
'\r') {
if (*(t+1)==
'\n') t++; }
◆ skipSpaces()
const char* skipSpaces |
( |
const char * |
l | ) |
|
Definition at line 171 of file tools.cpp.
173 while ((*t==
' ')||(*t==
'\t')) t++;
◆ sqr()
double sqr |
( |
const double & |
t | ) |
|
|
inline |
◆ stringDuplicate()
char* stringDuplicate |
( |
const char * |
l | ) |
|
Definition at line 234 of file tools.cpp.
236 int l=(int)strlen(line);
238 if ((*line==
'\'')||(*line==
'"')) { l-=2; line++; }
239 char *t=(
char*)malloc(l+1);