UQTk: Uncertainty Quantification Toolkit  3.1.1
combin.h
Go to the documentation of this file.
1 /* =====================================================================================
2 
3  The UQ Toolkit (UQTk) version 3.1.1
4  Copyright (2021) NTESS
5  https://www.sandia.gov/UQToolkit/
6  https://github.com/sandialabs/UQTk
7 
8  Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
9  Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
10  retains certain rights in this software.
11 
12  This file is part of The UQ Toolkit (UQTk)
13 
14  UQTk is open source software: you can redistribute it and/or modify
15  it under the terms of BSD 3-Clause License
16 
17  UQTk is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  BSD 3 Clause License for more details.
21 
22  You should have received a copy of the BSD 3 Clause License
23  along with UQTk. If not, see https://choosealicense.com/licenses/bsd-3-clause/.
24 
25  Questions? Contact the UQTk Developers at <uqtk-developers@software.sandia.gov>
26  Sandia National Laboratories, Livermore, CA, USA
27 ===================================================================================== */
31 
32 #ifndef COMBIN_H
33 #define COMBIN_H
34 
35 #include "Array2D.h"
36 
37 
38 
40 int choose(int n,int k);
41 
43 int factorial(int number);
44 
46 double logfactorial(int number);
47 
50 void chooseComb(int n, int k,Array2D<int>& fullInd);
51 
52 
55 void get_perm(int n, int* perm,int seed);
56 
60 void get_perm(Array1D<int>& perm, int seed);
61 
62 
67 double gammai(const double a, const double x);
68 
70 double beta(const double z, const double w);
71 
76 double betai(const double p, const double q, const double x);
77 
81 double digama ( double x );
82 
89 void clust(Array2D<double>& data_in, Array1D<double>& w,int ncl, Array1D<int>& numData,int *pClusterIndex);
90 
92 double clust_best(Array2D<double>& data_in, Array1D<double>& w,int ncl, Array1D<int>& bestnumData,int *bestClusterIndex,int ntry);
94 int findNumCl(Array2D<double>& data_in,Array1D<double>& w,int ntry);
95 //---------------------------------------------------------------------------------------
96 #endif // COMBIN_H
2D Array class for any type T
Definition: Array1D.h:472
Definition: Array1D.h:262
void clust(Array2D< double > &data_in, Array1D< double > &w, int ncl, Array1D< int > &numData, int *pClusterIndex)
K-center clustering of data.
Definition: combin.cpp:383
int findNumCl(Array2D< double > &data_in, Array1D< double > &w, int ntry)
Find the best number of clusters in a dataset according to one of three (hardcoded) criteria.
Definition: combin.cpp:468
double clust_best(Array2D< double > &data_in, Array1D< double > &w, int ncl, Array1D< int > &bestnumData, int *bestClusterIndex, int ntry)
Multiple trials of K-center clustering and picking the best one according to explained variance crite...
Definition: combin.cpp:412
void chooseComb(int n, int k, Array2D< int > &fullInd)
Computes all possible k-combinations of the first n non-negative integers and returns them in fullInd...
Definition: combin.cpp:80
int factorial(int number)
Calculates the factorial of a number.
Definition: combin.cpp:59
double gammai(const double a, const double x)
Compute the incomplete Gamma function with parameter a at point x.
Definition: combin.cpp:149
double beta(const double z, const double w)
Compute the Beta function at the point pair (z,w)
Definition: combin.cpp:218
double logfactorial(int number)
Calculates the logfactorial of a number.
Definition: combin.cpp:69
double digama(double x)
Computes the digamma, or psi, function, i.e. derivative of the logarithm of gamma function.
Definition: combin.cpp:330
int choose(int n, int k)
Calculates binomial coefficient C(n,k): n-choose-k.
Definition: combin.cpp:41
double betai(const double p, const double q, const double x)
Compute the incomplete Beta function with parameters a and b at point x.
Definition: combin.cpp:256
void get_perm(int n, int *perm, int seed)
Computes a random permutation of the first n non-negative integers and returns is in perm
Definition: combin.cpp:123