imate
C++/CUDA Reference
|
A static class to compute the trace of implicit matrix functions using stochastic Lanczos quadrature method. This class acts as a templated namespace, where the member methods is public and static. The internal private member functions are also static. More...
#include <convergence_tools.h>
Static Public Member Functions | |
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 below the given tolerance. More... | |
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 the removal of the outliers. More... | |
A static class to compute the trace of implicit matrix functions using stochastic Lanczos quadrature method. This class acts as a templated namespace, where the member methods is public and static. The internal private member functions are also static.
Definition at line 36 of file convergence_tools.h.
|
static |
Averages the estimates of trace. Removes outliers and reevaluates the error to take into account for the removal of the outliers.
[in] | confidence_level | The confidence level of the error, which is a number between 0 and 1 . This affects the scale of error . |
[in] | outlier_significance_level | One minus the confidence level of the uncertainty band of the outlier. This is a number between 0 and 1 . Confidence level of outleir and significance level of outlier are commlement of each other. |
[in] | num_inquiries | The number of batches of parameters. This function computes num_inquiries values of trace corresponding to different batch of parameters of the linear operator A . Hence, the number of output trace is num_inquiries . Hence, it is the number of columns of the output array samples . |
[in] | max_num_samples | The number of times that the trace estimation is repeated. The output trace value is the average of the samples. Hence, this is the number of rows of the output array samples . Larger number of samples leads to a better trace estimation. The computational const linearly increases with number of samples. |
[in] | num_samples_used | 1D array of the size of the number of columns of samples . Each element indicates how many iterations were used till convergence is reached for each column of the samples . The number of iterations should be a number between min_num_samples and max_num_samples . |
[in] | processed_samples_indices | A 1D array indicating the processing order of rows of the samples . In paralleli processing, this order of processing the rows of samples is not necessarly sequential. |
[out] | samples | 2D array of all estimated trace samples. The shape of this array is (max_num_samples*num_inquiries). The average of the rows is also given in trace array. |
[out] | num_outliers | 1D array with the size of number of columns of samples . Each element indicates how many rows of the samples array were outliers and were removed during averaging rows of samples . |
[out] | trace | The output trace of size num_inquiries . These values are the average of the rows of samples array. |
[out] | error | The error of estimation of trace, which is the standard deviation of the rows of samples array. The size of this array is num_inquiries . |
Definition at line 256 of file convergence_tools.cpp.
References erf_inv().
Referenced by cTraceEstimator< DataType >::c_trace_estimator(), and cuTraceEstimator< DataType >::cu_trace_estimator().
|
static |
Checks if the standard deviation of the set of the cumulative averages of trace estimators converged below the given tolerance.
The convergence criterion for each trace inquiry is if:
standard_deviation < max(rtol * average[i], atol) where \c rtol and \c atol are relative and absolute tolerances, respectively. If this criterion is satisfied for *all* trace inquiries, this function returns \c 1, otherwise \c 0.
[in] | samples | A 2D array of the estimated trace. This array has the shape (max_num_samples,num_inquiries). Each column of this array is the estimated trace values for a different trace inquiry. The rows are Monte-Carlo samples of the estimation of trace. The cumulative average of the rows are expected to converge. Note that because of parallel processing, the rows of this array are not filled sequentially. The list of filled rows are stored in processed_samples_indices . |
[in] | min_num_samples | Minimum number of sample iterations. |
[in] | num_inquiries | Number of columns of samples array. |
[in] | processed_samples_indices | A 1D array indicating the processing order of rows of the samples . In parallel processing, this order of processing the rows of samples is not necessarly sequential. |
[in] | num_processed_samples | A counter that keeps track of how many samples were processed so far in the iterations. |
[in] | confidence_level | The confidence level of the error, which is a number between 0 and 1 . This affects the scale of error . |
[in] | error_atol | Absolute tolerance criterion to be compared with the standard deviation of the cumulative averages. If error_atol is zero, it is ignored, and only rtol is used. |
[in] | error_rtol | Relative tolerance criterion to be compared with the standard deviation of the cumulative averages. If error_rtol is zero, it is ignored, and only error_atol is used. |
[out] | error | The error of estimation of trace, which is the standard deviation of the rows of samples array. The size of this array is num_inquiries . |
[out] | num_samples_used | 1D array of the size of the number of columns of samples . Each element indicates how many iterations were used till convergence is reached for each column of the samples . The number of iterations should be a number between min_num_samples and max_num_samples . |
[out] | converged | 1D array of the size of the number of columns of samples . Each element indicates which column of samples has converged to the tolerance criteria. Normally, if the num_samples_used is less than max_num_samples , it indicates that the convergence has reached. the rows of samples array. The size of this array is num_inquiries . |
1
indicates successful convergence within the given tolerances was met. Convergence is achieved when all elements of convergence
array are below convergence_atol
or convergence_rtol
times trace
.0
indicates the convergence criterion was not met for at least one of the trace inquiries. Definition at line 95 of file convergence_tools.cpp.
References erf_inv().
Referenced by cTraceEstimator< DataType >::c_trace_estimator(), and cuTraceEstimator< DataType >::cu_trace_estimator().