UQTk: Uncertainty Quantification Toolkit 3.1.5
combin.h
Go to the documentation of this file.
1/* =====================================================================================
2
3 The UQ Toolkit (UQTk) version 3.1.5
4 Copyright (2024) NTESS
5 https://www.sandia.gov/UQToolkit/
6 https://github.com/sandialabs/UQTk
7
8 Copyright 2024 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 https://github.com/sandialabs/UQTk/discussions
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
40int choose(int n,int k);
41
43int factorial(int number);
44
46double logfactorial(int number);
47
50void chooseComb(int n, int k,Array2D<int>& fullInd);
51
52
55void get_perm(int n, int* perm,int seed);
56
60void get_perm(Array1D<int>& perm, int seed);
61
62
67double gammai(const double a, const double x);
68
70double beta(const double z, const double w);
71
76double betai(const double p, const double q, const double x);
77
81double digama ( double x );
82
89void clust(Array2D<double>& data_in, Array1D<double>& w,int ncl, Array1D<int>& numData,int *pClusterIndex);
90
92double clust_best(Array2D<double>& data_in, Array1D<double>& w,int ncl, Array1D<int>& bestnumData,int *bestClusterIndex,int ntry);
94int findNumCl(Array2D<double>& data_in,Array1D<double>& w,int ntry);
95//---------------------------------------------------------------------------------------
96#endif // COMBIN_H
2D Array class for any type T
Stores data of any type T in a 1D array.
Definition Array1D.h:61
Stores data of any type T in a 2D array.
Definition Array2D.h:60
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