功能:編寫的計算皮亞諾相關系數
開發語言:ruby
調用:correlate(x,y)
其中,x,y為需要計算相關度的向量
調用示例:
a = [3, 6, 9, 12, 15, 18, 21]
b = [1.1, 2.1, 3.4, 4.8, 5.6]
c = [1.9, 1.0, 3.9, 3.1, 6.9]
c1 = correlate(a,a) # 1.0
c2 = correlate(a,a.reverse) # -1.0
c3 = correlate(b,c) # 0.8221970228
puts c1#,c2,c3
標簽:
correlate
ruby
計算
12
上傳時間:
2013-12-18
上傳用戶:skfreeman
Problem B:Longest Ordered Subsequence
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 <= i1 < i2 < ... < iK <= N. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g., (1, 7), (3, 4, 8) and many others. All longest ordered subsequences are of length 4, e. g., (1, 3, 5, 8).
標簽:
Subsequence
sequence
Problem
Longest
上傳時間:
2016-12-08
上傳用戶:busterman