Chai Xiangyu | Research, Develop, Projects, Blogs Algorithm Armadillo使用介绍(十一):conv

Armadillo使用介绍(十一):conv

conv

用途:conv函数用于一维卷积。
类型:普通函数
隶属:Signal & Image Processing

  • 1D convolution of vectors A and B
  • The orientation of the result vector is the same as the orientation of A (ie. either column or row vector)
  • The shape argument is optional; it is one of:
    “full” = return the full convolution (default setting), with the size equal to A.n_elem + B.n_elem - 1
    “same” = return the central part of the convolution, with the same size as vector A
  • The convolution operation is also equivalent to FIR filtering

示例代码如下:

vec A(256, fill::randu);

vec B(16, fill::randu);

vec C = conv(A, B);

vec D = conv(A, B, "same");

运行结果:

Armadillo version: 9.900.1 (Nocturnal Misbehaviour)
A:
   0.0013
   0.1933
   0.5850
   0.3503
   0.8228
   0.1741
   0.7105
   0.3040
   0.0914
   0.1473
   0.9885
   0.1191
   0.0089
   0.5317
   0.6018
   0.1662
   0.4508
   0.0571
   0.7833
   0.5199
   0.8760
   0.9559
   0.5393
   0.4621
   0.8622
   0.7797
   0.9968
   0.6115
   0.2662
   0.8401
   0.3759
   0.6772
   0.0088
   0.2759
   0.5879
   0.8376
   0.4849
   0.7437
   0.4580
   0.7444
   0.5990
   0.7350
   0.5724
   0.1516
   0.4252
   0.5171
   0.7515
   0.1690
   0.4919
   0.6998
   0.1475
   0.1416
   0.6929
   0.4265
   0.9666
   0.1533
   0.8217
   0.1914
   0.8172
   0.1556
   0.7320
   0.2796
   0.6822
   0.7219
   0.1230
   0.8347
   0.5170
   0.4262
   0.9493
   0.5495
   0.4717
   0.8470
   0.4561
   0.9829
   0.7392
   0.1960
   0.8394
   0.5009
   0.0275
   0.5726
   0.5313
   0.8430
   0.6576
   0.8421
   0.1099
   0.3141
   0.2861
   0.1403
   0.8346
   0.6002
   0.2527
   0.0016
   0.8062
   0.2106
   0.5532
   0.1138
   0.7522
   0.5434
   0.4367
   0.6962
   0.4367
   0.5779
   0.6287
   0.5041
   0.6958
   0.1900
   0.1784
   0.4575
   0.0975
   0.0944
   0.9315
   0.8946
   0.2273
   0.4107
   0.6281
   0.4516
   0.5978
   0.8548
   0.6248
   0.5657
   0.1843
   0.5551
   0.2429
   0.6047
   0.5846
   0.4944
   0.7407
   0.6204
   0.8045
   0.5760
   0.9115
   0.7277
   0.6678
   0.3150
   0.3058
   0.1086
   0.8512
   0.1549
   0.0793
   0.6410
   0.5451
   0.4090
   0.4656
   0.1527
   0.7380
   0.8267
   0.8733
   0.3001
   0.1272
   0.7850
   0.6096
   0.0723
   0.6538
   0.1048
   0.2271
   0.9200
   0.6628
   0.4925
   0.4968
   0.5093
   0.6882
   0.6063
   0.0059
   0.1006
   0.8632
   0.7473
   0.3801
   0.5528
   0.9557
   0.1766
   0.1316
   0.9517
   0.0278
   0.0559
   0.1316
   0.8643
   0.7216
   0.0147
   0.7079
   0.2176
   0.1689
   0.3410
   0.3676
   0.8024
   0.5265
   0.7982
   0.1448
   0.4024
   0.1366
   0.0662
   0.5733
   0.5480
   0.3113
   0.8080
   0.2843
   0.8952
   0.7438
   0.3611
   0.2285
   0.2294
   0.5424
   0.0538
   0.5247
   0.0947
   0.8915
   0.1465
   0.9316
   0.0471
   0.3364
   0.3986
   0.9462
   0.5342
   0.6935
   0.2592
   0.5256
   0.3987
   0.5855
   0.6840
   0.4355
   0.0072
   0.6016
   0.5767
   0.2223
   0.0043
   0.0823
   0.8551
   0.8111
   0.6915
   0.5301
   0.1428
   0.7279
   0.0311
   0.6445
   0.0855
   0.9479
   0.2750
   0.9818
   0.2923
   0.3675
   0.2186
   0.2406
   0.9023
   0.9026
   0.0801
   0.1718
   0.7759
   0.2106
   0.0038
   0.1141
   0.3112
   0.0386
   0.1893
   0.1535
   0.8854
   0.1957
   0.6456
B:
   0.9091
   0.9213
   0.1508
   0.5695
   0.9430
   0.5786
   0.2553
   0.3503
   0.7952
   0.0703
   0.5907
   0.1977
   0.6443
   0.6043
   0.4413
   0.3965
C:
   0.0012
   0.1769
   0.7101
   0.8873
   1.2703
   1.4854
   1.7938
   2.1444
   1.7661
   1.7571
   2.8044
   2.5578
   1.9188
   2.2350
   3.8802
   2.7669
   2.9627
   3.1577
   3.8220
   3.4011
   3.5408
   4.0236
   4.1757
   3.9416
   4.5852
   4.7820
   5.1713
   4.6817
   5.0271
   5.1147
   5.1975
   5.0501
   4.7720
   4.7721
   5.2644
   5.0937
   4.6981
   4.8401
   4.9184
   5.4867
   4.6445
   5.0565
   4.7270
   4.4557
   4.1643
   4.4683
   4.3752
   4.2173
   4.0366
   5.0476
   4.4173
   3.5157
   4.2808
   4.3718
   4.4732
   3.6408
   4.1538
   4.1189
   4.0501
   4.0399
   4.0429
   4.0724
   4.2595
   3.9630
   4.2891
   3.6887
   5.1367
   4.0654
   4.9462
   4.6124
   4.6667
   4.7216
   4.7542
   5.3165
   4.9616
   4.9953
   5.0308
   5.3105
   4.6404
   4.3458
   4.9759
   5.3531
   4.6972
   5.1073
   5.0139
   4.3356
   4.6888
   4.1837
   4.1174
   4.5649
   3.5408
   3.4751
   3.7665
   4.2761
   3.5429
   3.5590
   4.1369
   3.8499
   3.4463
   3.2932
   4.1865
   3.7933
   4.4052
   3.8475
   4.4819
   3.7614
   3.7042
   4.0190
   3.5985
   3.3389
   3.7644
   4.6914
   3.8784
   3.3116
   4.5002
   4.3804
   3.8032
   4.2292
   4.5362
   4.1472
   3.7049
   4.0504
   4.1979
   4.1953
   4.4963
   4.4899
   4.4642
   4.6299
   4.6764
   5.0968
   4.9946
   5.6097
   5.0588
   4.7630
   4.5852
   4.2582
   4.8728
   4.3666
   3.9381
   4.1971
   4.8910
   4.1215
   4.0072
   3.9467
   4.5022
   4.2088
   4.3621
   3.7647
   3.4710
   4.3233
   4.4224
   3.4463
   3.7946
   4.0509
   3.8700
   3.8102
   4.3700
   4.2492
   4.1193
   4.5949
   4.7191
   4.0612
   3.8334
   3.4564
   4.2585
   4.5301
   3.4619
   3.8486
   5.0459
   4.7163
   3.6173
   4.4750
   4.5850
   3.2325
   3.1418
   3.9721
   4.2076
   2.9006
   3.6634
   4.4958
   3.3186
   3.3204
   3.1064
   3.9718
   3.3832
   3.3879
   3.7361
   3.0813
   3.7836
   3.1507
   3.4311
   3.7250
   2.9084
   3.6424
   3.3613
   4.1506
   4.2860
   4.2542
   3.9165
   3.6712
   3.8691
   3.2741
   2.8713
   3.6415
   3.6297
   3.8733
   3.7647
   3.8150
   3.7414
   3.5235
   4.3645
   3.5336
   3.8944
   3.2960
   4.3481
   3.5342
   4.2054
   4.0698
   4.4595
   3.6384
   3.9578
   4.2051
   3.8929
   3.1462
   3.5636
   4.1482
   4.0717
   3.5623
   3.8914
   3.8875
   4.2337
   3.6712
   3.3787
   3.6359
   3.7165
   3.9342
   3.6998
   3.8782
   4.1428
   3.8065
   4.4282
   3.8447
   4.8854
   3.2111
   3.6183
   3.9625
   4.3953
   2.9344
   3.0682
   3.8912
   2.9828
   2.2922
   2.3513
   3.2548
   3.0304
   2.9091
   2.7856
   2.4907
   2.0028
   1.9016
   1.4296
   1.4223
   0.8368
   1.4083
   0.6897
   1.1821
   0.9315
   0.9858
   0.8275
   0.3625
   0.2560
D:
   1.7661
   1.7571
   2.8044
   2.5578
   1.9188
   2.2350
   3.8802
   2.7669
   2.9627
   3.1577
   3.8220
   3.4011
   3.5408
   4.0236
   4.1757
   3.9416
   4.5852
   4.7820
   5.1713
   4.6817
   5.0271
   5.1147
   5.1975
   5.0501
   4.7720
   4.7721
   5.2644
   5.0937
   4.6981
   4.8401
   4.9184
   5.4867
   4.6445
   5.0565
   4.7270
   4.4557
   4.1643
   4.4683
   4.3752
   4.2173
   4.0366
   5.0476
   4.4173
   3.5157
   4.2808
   4.3718
   4.4732
   3.6408
   4.1538
   4.1189
   4.0501
   4.0399
   4.0429
   4.0724
   4.2595
   3.9630
   4.2891
   3.6887
   5.1367
   4.0654
   4.9462
   4.6124
   4.6667
   4.7216
   4.7542
   5.3165
   4.9616
   4.9953
   5.0308
   5.3105
   4.6404
   4.3458
   4.9759
   5.3531
   4.6972
   5.1073
   5.0139
   4.3356
   4.6888
   4.1837
   4.1174
   4.5649
   3.5408
   3.4751
   3.7665
   4.2761
   3.5429
   3.5590
   4.1369
   3.8499
   3.4463
   3.2932
   4.1865
   3.7933
   4.4052
   3.8475
   4.4819
   3.7614
   3.7042
   4.0190
   3.5985
   3.3389
   3.7644
   4.6914
   3.8784
   3.3116
   4.5002
   4.3804
   3.8032
   4.2292
   4.5362
   4.1472
   3.7049
   4.0504
   4.1979
   4.1953
   4.4963
   4.4899
   4.4642
   4.6299
   4.6764
   5.0968
   4.9946
   5.6097
   5.0588
   4.7630
   4.5852
   4.2582
   4.8728
   4.3666
   3.9381
   4.1971
   4.8910
   4.1215
   4.0072
   3.9467
   4.5022
   4.2088
   4.3621
   3.7647
   3.4710
   4.3233
   4.4224
   3.4463
   3.7946
   4.0509
   3.8700
   3.8102
   4.3700
   4.2492
   4.1193
   4.5949
   4.7191
   4.0612
   3.8334
   3.4564
   4.2585
   4.5301
   3.4619
   3.8486
   5.0459
   4.7163
   3.6173
   4.4750
   4.5850
   3.2325
   3.1418
   3.9721
   4.2076
   2.9006
   3.6634
   4.4958
   3.3186
   3.3204
   3.1064
   3.9718
   3.3832
   3.3879
   3.7361
   3.0813
   3.7836
   3.1507
   3.4311
   3.7250
   2.9084
   3.6424
   3.3613
   4.1506
   4.2860
   4.2542
   3.9165
   3.6712
   3.8691
   3.2741
   2.8713
   3.6415
   3.6297
   3.8733
   3.7647
   3.8150
   3.7414
   3.5235
   4.3645
   3.5336
   3.8944
   3.2960
   4.3481
   3.5342
   4.2054
   4.0698
   4.4595
   3.6384
   3.9578
   4.2051
   3.8929
   3.1462
   3.5636
   4.1482
   4.0717
   3.5623
   3.8914
   3.8875
   4.2337
   3.6712
   3.3787
   3.6359
   3.7165
   3.9342
   3.6998
   3.8782
   4.1428
   3.8065
   4.4282
   3.8447
   4.8854
   3.2111
   3.6183
   3.9625
   4.3953
   2.9344
   3.0682
   3.8912
   2.9828
   2.2922
   2.3513
   3.2548
   3.0304
   2.9091
   2.7856
   2.4907
   2.0028
   1.9016
   1.4296
   1.4223
   0.8368
   1.4083
请按任意键继续. . .

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Related Post