Skip to contents

Calculates the autovariance function (ACF) using Discrete Fourier Transformation.

Usage

dft_acf(x)

Arguments

x

A cx_vec.

Value

A vec containing the ACF.

Details

This implementation is 2x as slow as Rs. Two issues: 1. memory resize and 2. unoptimized fft algorithm in arma. Consider piping back into R and rewrapping the object. (Decrease of about 10 microseconds.)

Examples

x=rnorm(100)
dft_acf(x)
#>                 [,1]
#>   [1,]  0.8397747797
#>   [2,] -0.0402636222
#>   [3,]  0.0213377281
#>   [4,]  0.0339837784
#>   [5,] -0.0918522258
#>   [6,]  0.0102781322
#>   [7,]  0.0119992894
#>   [8,] -0.0483038732
#>   [9,]  0.0693727451
#>  [10,] -0.0454877814
#>  [11,] -0.0472664084
#>  [12,]  0.0183906341
#>  [13,]  0.0892177948
#>  [14,] -0.0504530021
#>  [15,] -0.0503613761
#>  [16,]  0.0137122574
#>  [17,]  0.0497659892
#>  [18,]  0.0949811617
#>  [19,]  0.0047940843
#>  [20,]  0.0033684987
#>  [21,] -0.0605544478
#>  [22,] -0.0572418137
#>  [23,] -0.0653829859
#>  [24,]  0.1261029958
#>  [25,] -0.1144160189
#>  [26,]  0.1024604322
#>  [27,] -0.0084616254
#>  [28,] -0.0620390070
#>  [29,]  0.0044146762
#>  [30,]  0.0358930108
#>  [31,] -0.1011546751
#>  [32,] -0.0209195782
#>  [33,] -0.0879577642
#>  [34,]  0.0724972872
#>  [35,] -0.0187019089
#>  [36,]  0.0422282768
#>  [37,]  0.0021103922
#>  [38,] -0.0165243147
#>  [39,]  0.0403693347
#>  [40,] -0.0625927829
#>  [41,]  0.0629736165
#>  [42,]  0.0935651876
#>  [43,] -0.0176528574
#>  [44,] -0.1220131606
#>  [45,] -0.0526310736
#>  [46,]  0.0006009063
#>  [47,] -0.0474513321
#>  [48,] -0.0645884027
#>  [49,] -0.0300365409
#>  [50,] -0.0931601539
#>  [51,]  0.0568324850
#>  [52,]  0.0201073901
#>  [53,]  0.0810484325
#>  [54,]  0.0002984006
#>  [55,]  0.0237272081
#>  [56,] -0.0995262517
#>  [57,]  0.0577734304
#>  [58,]  0.0011168426
#>  [59,]  0.0242794724
#>  [60,]  0.0998537933
#>  [61,] -0.0130786481
#>  [62,] -0.0217763435
#>  [63,]  0.0105047968
#>  [64,] -0.0118730346
#>  [65,]  0.0403377706
#>  [66,] -0.0258990233
#>  [67,] -0.0459452724
#>  [68,]  0.0899289477
#>  [69,] -0.0199982998
#>  [70,] -0.0127751702
#>  [71,]  0.0347508391
#>  [72,] -0.0229481397
#>  [73,] -0.0688012568
#>  [74,] -0.0012568255
#>  [75,]  0.0306197758
#>  [76,]  0.0493905281
#>  [77,]  0.0229038979
#>  [78,]  0.0254256131
#>  [79,] -0.0121494563
#>  [80,] -0.0070909001
#>  [81,] -0.0639516187
#>  [82,] -0.0382123688
#>  [83,]  0.0159479537
#>  [84,] -0.0296363850
#>  [85,] -0.0334531825
#>  [86,]  0.0023481931
#>  [87,] -0.0186127402
#>  [88,]  0.0081522074
#>  [89,] -0.0395517712
#>  [90,] -0.0156805549
#>  [91,]  0.0334203847
#>  [92,] -0.0207182915
#>  [93,]  0.0152013088
#>  [94,]  0.0124150923
#>  [95,] -0.0190358584
#>  [96,] -0.0098107071
#>  [97,] -0.0070293656
#>  [98,] -0.0124886149
#>  [99,] -0.0131703710
#> [100,] -0.0057547166