validateSpectraParams

C++ Function Reference

1 Signature

std::tuple< int, int > BigDataStatMeth::validateSpectraParams(int n, int k, int ncv)

2 Description

Validate and adjust Spectra parameters for convergence.

3 Parameters

  • n (int)
  • k (int)
  • ncv (int)

4 Returns

Type: std::tuple< int, int >

5 Details

Only call this for partial decomposition (k < n). Full decomposition (k >= n) must use SelfAdjointEigenSolver, not Spectra.

6 Caller Graph

Function dependencies

7 Source Code

File: inst/include/hdf5Algebra/matrixEigenDecomposition.hppLines 66-79

inline std::tuple<int, int> validateSpectraParams(int n, int k, int ncv) {
        if (k <= 0) k = std::min(n, 6);
        if (k >= n) k = n - 1;
        
        if (ncv <= 0)
            ncv = std::min(n, std::max(2 * k + 1, k + 2));
        
        ncv = std::max(ncv, k + 2);
        ncv = std::min(ncv, n);
        if (ncv - k < 2)
            ncv = std::min(n, k + 2);
        
        return std::make_tuple(k, ncv);
    }

8 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = validateSpectraParams(...);