imate
C++/CUDA Reference
convergence_tools.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3  * SPDX-License-Identifier: BSD-3-Clause
4  * SPDX-FileType: SOURCE
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the license found in the LICENSE.txt file in the root
8  * directory of this source tree.
9  */
10 
11 
12 #ifndef _C_TRACE_ESTIMATOR_CONVERGENCE_TOOLS_H_
13 #define _C_TRACE_ESTIMATOR_CONVERGENCE_TOOLS_H_
14 
15 // ======
16 // Headers
17 // ======
18 
19 #include "../_definitions/types.h" // DataType, IndexType, FlagType
20 
21 
22 // =================
23 // c Trace Estimator
24 // =================
25 
34 
35 template <typename DataType>
37 {
38  public:
39 
40  // _check convergence
42  DataType** samples,
43  const IndexType min_num_samples,
44  const IndexType num_inquiries,
45  const IndexType* processed_samples_indices,
46  const IndexType num_processed_samples,
47  const DataType confidence_level,
48  const DataType error_atol,
49  const DataType error_rtol,
50  DataType* error,
51  IndexType* num_samples_used,
52  FlagType* converged);
53 
54  // _average estimates
55  static void average_estimates(
56  const DataType confidence_level,
57  const DataType outlier_significance_level,
58  const IndexType num_inquiries,
59  const IndexType max_num_samples,
60  const IndexType* num_samples_used,
61  const IndexType* processed_samples_indices,
62  DataType** samples,
63  IndexType* num_outliers,
64  DataType* trace,
65  DataType* error);
66 };
67 
68 #endif // _C_TRACE_ESTIMATOR_CONVERGENCE_TOOLS_H_
A static class to compute the trace of implicit matrix functions using stochastic Lanczos quadrature ...
static FlagType check_convergence(DataType **samples, const IndexType min_num_samples, const IndexType num_inquiries, const IndexType *processed_samples_indices, const IndexType num_processed_samples, const DataType confidence_level, const DataType error_atol, const DataType error_rtol, DataType *error, IndexType *num_samples_used, FlagType *converged)
Checks if the standard deviation of the set of the cumulative averages of trace estimators converged ...
static void average_estimates(const DataType confidence_level, const DataType outlier_significance_level, const IndexType num_inquiries, const IndexType max_num_samples, const IndexType *num_samples_used, const IndexType *processed_samples_indices, DataType **samples, IndexType *num_outliers, DataType *trace, DataType *error)
Averages the estimates of trace. Removes outliers and reevaluates the error to take into account for ...
int FlagType
Definition: types.h:68
int IndexType
Definition: types.h:65