imate
C++/CUDA Reference
c_trace_estimator.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_C_TRACE_ESTIMATOR_H_
13 #define _C_TRACE_ESTIMATOR_C_TRACE_ESTIMATOR_H_
14 
15 // ======
16 // Headers
17 // ======
18 
19 #include "../functions/functions.h" // Function
20 #include "../_c_linear_operator/c_linear_operator.h" // cLinearOperator
21 #include "../_definitions/types.h" // IndexType, FlagType
22 #include "../_random_generator/random_number_generator.h" // RandomNumberGe...
23 
24 
25 // =================
26 // c Trace Estimator
27 // =================
28 
37 
38 template <typename DataType>
40 {
41  public:
42 
43  // c trace estimator
46  DataType* parameters,
47  const IndexType num_inquiries,
48  const Function* matrix_function,
49  const FlagType gram,
50  const DataType exponent,
51  const FlagType orthogonalize,
52  const int64_t seed,
53  const IndexType lanczos_degree,
54  const DataType lanczos_tol,
55  const IndexType min_num_samples,
56  const IndexType max_num_samples,
57  const DataType error_atol,
58  const DataType error_rtol,
59  const DataType confidence_level,
60  const DataType outlier_significance_level,
61  const IndexType num_threads,
62  DataType* trace,
63  DataType* error,
64  DataType** samples,
65  IndexType* processed_samples_indices,
66  IndexType* num_samples_used,
67  IndexType* num_outliers,
68  FlagType* converged,
69  float& alg_wall_time);
70 
71  private:
72 
73  // _c stochastic lanczos quadrature
76  DataType* parameters,
77  const IndexType num_inquiries,
78  const Function* matrix_function,
79  const FlagType gram,
80  const DataType exponent,
81  const FlagType orthogonalize,
82  const IndexType lanczos_degree,
83  const DataType lanczos_tol,
84  RandomNumberGenerator& random_number_generator,
85  DataType* random_vector,
86  FlagType* converged,
87  DataType* trace_estimate);
88 };
89 
90 #endif // _C_TRACE_ESTIMATOR_C_TRACE_ESTIMATOR_H_
Defines the function .
Definition: functions.h:38
Generates 64-bit integers on multiple parallel threads.
Base class for linear operators. This class serves as interface for all derived classes.
A static class to compute the trace of implicit matrix functions using stochastic Lanczos quadrature ...
static void _c_stochastic_lanczos_quadrature(cLinearOperator< DataType > *A, DataType *parameters, const IndexType num_inquiries, const Function *matrix_function, const FlagType gram, const DataType exponent, const FlagType orthogonalize, const IndexType lanczos_degree, const DataType lanczos_tol, RandomNumberGenerator &random_number_generator, DataType *random_vector, FlagType *converged, DataType *trace_estimate)
For a given random input vector, computes one Monte-Carlo sample to estimate trace using Lanczos quad...
static FlagType c_trace_estimator(cLinearOperator< DataType > *A, DataType *parameters, const IndexType num_inquiries, const Function *matrix_function, const FlagType gram, const DataType exponent, const FlagType orthogonalize, const int64_t seed, const IndexType lanczos_degree, const DataType lanczos_tol, const IndexType min_num_samples, const IndexType max_num_samples, const DataType error_atol, const DataType error_rtol, const DataType confidence_level, const DataType outlier_significance_level, const IndexType num_threads, DataType *trace, DataType *error, DataType **samples, IndexType *processed_samples_indices, IndexType *num_samples_used, IndexType *num_outliers, FlagType *converged, float &alg_wall_time)
Stochastic Lanczos quadrature method to estimate trace of a function of a linear operator....
int FlagType
Definition: types.h:68
int IndexType
Definition: types.h:65