IsoSpec
1.95
IsoSpec++
isoMath.h
1
/*
2
* Copyright (C) 2015-2018 Mateusz Łącki and Michał Startek.
3
*
4
* This file is part of IsoSpec.
5
*
6
* IsoSpec is free software: you can redistribute it and/or modify
7
* it under the terms of the Simplified ("2-clause") BSD licence.
8
*
9
* IsoSpec is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
*
13
* You should have received a copy of the Simplified BSD Licence
14
* along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15
*/
16
17
#pragma once
18
19
#include <cmath>
20
#include <fenv.h>
21
22
#if !defined(ISOSPEC_G_FACT_TABLE_SIZE)
23
// 10M should be enough for anyone, right?
24
// Actually, yes. If anyone tries to input a molecule that has more than 10M atoms,
25
// he deserves to get an exception thrown in his face.
26
#define ISOSPEC_G_FACT_TABLE_SIZE 1024*1024*10
27
#endif
28
29
namespace
IsoSpec
30
{
31
32
extern
double
* g_lfact_table;
33
34
static
inline
double
minuslogFactorial(
int
n)
35
{
36
if
(n < 2)
37
return
0.0;
38
if
(g_lfact_table[n] == 0.0)
39
g_lfact_table[n] = -lgamma(n+1);
40
41
return
g_lfact_table[n];
42
}
43
double
NormalCDFInverse(
double
p);
44
double
NormalCDFInverse(
double
p,
double
mean,
double
stdev);
45
double
NormalCDF(
double
x,
double
mean,
double
stdev);
46
double
NormalPDF(
double
x,
double
mean = 0.0,
double
stdev = 1.0);
47
48
}
// namespace IsoSpec
49
IsoSpec
Definition:
allocator.cpp:21
Generated by
1.8.13