Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-203

SSA Eigenvalue Pair Count

Problem

Count how many oscillatory pairs the SSA spectrum suggests. Given singular values and a relative tolerance, count values greater than tolerance * max(singular_values) and return that count divided by 2 using integer division, since oscillations appear as eigenvalue pairs.

Return 0 for an empty list or a non-positive maximum.

Hint

A pair of similar leading singular values usually indicates one oscillation.

Test cases

case 1
in: [[5,4,3,2,1],0.1]
expected: 2
case 2
in: [[5,1,1],0.2]
expected: 0
case 3
in: [[1,1,1,1],0]
expected: 2
case 4
in: [[],0.1]
expected: 0
Starter codePython
def ssa_eigenvalue_pair_count(singular_values, tolerance):
    # Your code here
    pass

4 test cases · run your code against them in the editor