imate
C++/CUDA Reference
Loading...
Searching...
No Matches
cu_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 _CU_TRACE_ESTIMATOR_CU_TRACE_ESTIMATOR_H_
13#define _CU_TRACE_ESTIMATOR_CU_TRACE_ESTIMATOR_H_
14
15// ======
16// Headers
17// ======
18
19#include "../functions/functions.h" // Function
20#include "../_cu_linear_operator/cu_linear_operator.h" // cuLinearOperator
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
38template <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 const IndexType num_gpu_devices,
63 DataType* trace,
64 DataType* error,
65 DataType** samples,
66 IndexType* processed_samples_indices,
67 IndexType* num_samples_used,
68 IndexType* num_outliers,
69 FlagType* converged,
70 double& alg_wall_time);
71
72 private:
73
74 // _c stochastic lanczos quadrature
77 DataType* parameters,
78 const IndexType num_inquiries,
79 const Function* matrix_function,
80 const FlagType gram,
81 const DataType exponent,
82 const FlagType orthogonalize,
83 const IndexType lanczos_degree,
84 const DataType lanczos_tol,
85 RandomNumberGenerator& random_number_generator,
86 DataType* random_vector,
87 FlagType* converged,
88 DataType* trace_estimate);
89};
90
91#endif // _CU_TRACE_ESTIMATOR_CU_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 _cu_stochastic_lanczos_quadrature(cuLinearOperator< 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 cu_trace_estimator(cuLinearOperator< 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, const IndexType num_gpu_devices, DataType *trace, DataType *error, DataType **samples, IndexType *processed_samples_indices, IndexType *num_samples_used, IndexType *num_outliers, FlagType *converged, double &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