@@ -52,7 +52,7 @@ URL: https://www.nsf.gov/pubs/2005/nsf05057/nmbs/nmbs.pdf
5252recurrence quantifications", in: Webber, C.L. & N. Marwan (eds.), *Recurrence
5353Quantification Analysis. Theory and Best Practices*, Springer, pp. 3-43 (2015).
5454"""
55- function recurrencerate (R:: ARM ; theiler:: Integer = deftheiler (R), kwargs... ):: Float64
55+ function recurrencerate (R:: Union{ ARM,SparseMatrixCSC} ; theiler:: Integer = deftheiler (R), kwargs... ):: Float64
5656 (theiler < 0 ) && throw (ErrorException (
5757 " Theiler window length must be greater than or equal to 0" ))
5858 if theiler == 0
6969# Calculate the denominator for the recurrence rate
7070_rrdenominator (R:: ARM ; theiler= 0 , kwargs... ) = length (R)
7171
72+ function _rrdenominator (R:: SparseMatrixCSC ; theiler= 0 , kwargs... )
73+
74+ (theiler == 0 ) && (return length (R))
75+ k = size (R,1 ) - theiler
76+ return k* (k+ 1 )
77+ end
78+
7279function _rrdenominator (R:: M ; theiler= 0 , kwargs... ) where
7380 M<: Union{RecurrenceMatrix,JointRecurrenceMatrix}
7481
@@ -153,7 +160,7 @@ is the number of lines of length equal to ``l``.
153160points inside the Theiler window (see [`rqa`](@ref) for the
154161default values and usage of the keyword argument `theiler`).
155162"""
156- function determinism (R:: ARM ; kwargs... )
163+ function determinism (R:: Union{ ARM,SparseMatrixCSC} ; kwargs... )
157164 npoints = recurrencerate (R; kwargs... )* _rrdenominator (R; kwargs... )
158165 return _determinism (diagonalhistogram (R; kwargs... ), npoints)
159166end
171178Calculate the divergence of the recurrence matrix `R`
172179(actually the inverse of [`dl_max`](@ref)).
173180"""
174- divergence (R:: ARM ; kwargs... ) = ( 1.0 / dl_max (R; kwargs... ) )
175-
181+ divergence (R:: Union{ARM,SparseMatrixCSC} ; kwargs... ) = ( 1.0 / dl_max (R; kwargs... ) )
176182
177183"""
178184 trend(R[; border=10, theiler])
@@ -217,10 +223,10 @@ Dynamical Systems", in: Riley MA & Van Orden GC, *Tutorials in Contemporary
217223Nonlinear Methods for the Behavioral Sciences*, 2005, 26-94.
218224https://www.nsf.gov/pubs/2005/nsf05057/nmbs/nmbs.pdf
219225"""
220- trend (R:: ARM ; theiler= deftheiler (R), kwargs... ) =
226+ trend (R:: Union{ ARM,SparseMatrixCSC} ; theiler= deftheiler (R), kwargs... ) =
221227 _trend (tau_recurrence (R); theiler= theiler, kwargs... )
222-
223- function tau_recurrence (R:: ARM )
228+
229+ function tau_recurrence (R:: Union{ ARM,SparseMatrixCSC} )
224230 n = minimum (size (R))
225231 rv = rowvals (R)
226232 rr_τ = zeros (n)
@@ -290,7 +296,7 @@ is the number of lines of length equal to ``v``.
290296points inside the Theiler window (see [`rqa`](@ref) for the
291297default values and usage of the keyword argument `theiler`).
292298"""
293- function laminarity (R:: ARM ; kwargs... )
299+ function laminarity (R:: Union{ ARM,SparseMatrixCSC} ; kwargs... )
294300 npoints = recurrencerate (R)* _rrdenominator (R; kwargs... )
295301 return _laminarity (verticalhistograms (R; kwargs... )[1 ], npoints)
296302end
@@ -308,8 +314,7 @@ default values and usage of the keyword argument `theiler`).
308314The trapping time is the average of the vertical line structures and thus equal
309315to [`vl_average`](@ref).
310316"""
311- trappingtime (R:: ARM ; kwargs... ) = vl_average (R; kwargs... )
312-
317+ trappingtime (R:: Union{ARM,SparseMatrixCSC} ; kwargs... ) = vl_average (R; kwargs... )
313318# ##########################################################################################
314319# 3. Based on recurrence times
315320# ##########################################################################################
@@ -327,8 +332,7 @@ default values and usage of the keyword argument `theiler`).
327332
328333Equivalent to [`rt_average`](@ref).
329334"""
330- meanrecurrencetime (R:: ARM ; kwargs... ) = rt_average (R; kwargs... )
331-
335+ meanrecurrencetime (R:: Union{ARM,SparseMatrixCSC} ; kwargs... ) = rt_average (R; kwargs... )
332336
333337"""
334338 nmprt(R[; lmin=2, theiler])
@@ -349,8 +353,7 @@ of recurrence times [1].
349353[DOI:10.1103/physreve.75.036222](https://doi.org/10.1103/physreve.75.036222)
350354
351355"""
352- nmprt (R:: ARM ; kwargs) = maximum (verticalhistograms (R; kwargs... )[2 ])
353-
356+ nmprt (R:: Union{ARM,SparseMatrixCSC} , kwargs... ) = maximum (verticalhistograms (R;theiler= deftheiler (R), kwargs... )[2 ])
354357# ##########################################################################################
355358# 4. All in one
356359# ##########################################################################################
0 commit comments