欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
OpenCV vs. Armadillo vs. Eigen on Linux revisited | Nghia Ho

This is a quick revisit to my recent post comparing 3 different libraries with matrix support. As suggested by one of the comments to the last post, I’ve turned off any debugging option that each library may have. In practice you would have them on most of the time for safety reasons, but for this test I thought it would be interesting to see it turned off.

Armadillo and Eigen uses the define ARMA_NO_DEBUG and NDEBUG respectively to turn off error checking. I could not find an immediate way to do the same thing in OpenCV, unless I  edit the source code, but chose not to. So keep that in that mind. I also modified the number of iterations for each of the 5 operation performed to be slightly more accurate. Fast operations like add, multiply, transpose and invert have more iterations performed to get a better average, compared to SVD, which is quite slow.

On with the results …

Add

Performing C = A + B

Raw data

Results in msOpenCVArmadilloEigen
4×40.000930.000080.00007
8×80.000390.000060.00015
16×160.000660.000300.00059
32×320.001390.001480.00194
64×640.006540.006190.00712
128×1280.024540.027380.03225
256×2560.091440.113150.10920
512×5120.479970.576680.47382

Normalised

Speed up over slowestOpenCVArmadilloEigen
4×41.00x12.12x14.35x
8×81.00x6.53x2.63x
16×161.00x2.19x1.13x
32×321.39x1.31x1.00x
64×641.09x1.15x1.00x
128×1281.31x1.18x1.00x
256×2561.24x1.00x1.04x
512×5121.20x1.00x1.22x

Multiply

Performing C = A * B

Raw data

Results in msOpenCVArmadilloEigen
4×40.001150.000170.00086
8×80.001950.000780.00261
16×160.003210.002610.00678
32×320.018650.019470.02130
64×640.153660.330800.07835
128×1281.870081.727190.35859
256×25615.767243.702122.70168
512×512119.0938224.0840922.73524

Normalised

Speed up over slowestOpenCVArmadilloEigen
4×41.00x6.74x1.34x
8×81.34x3.34x1.00x
16×162.11x2.60x1.00x
32×321.14x1.09x1.00x
64×642.15x1.00x4.22x
128×1281.00x1.08x5.22x
256×2561.00x4.26x5.84x
512×5121.00x4.94x5.24x

Transpose

Performing C = A^T

Raw data

Results in msOpenCVArmadilloEigen
4×40.000670.000040.00003
8×80.000290.000060.00008
16×160.000340.000280.00028
32×320.000710.000680.00110
64×640.004370.005920.00500
128×1280.015520.065370.03486
256×2560.088280.408130.20032
512×5120.524551.514520.77584

Normalised

Speed up over slowestOpenCVArmadilloEigen
4×41.00x17.61x26.76x
8×81.00x4.85x3.49x
16×161.00x1.20x1.21x
32×321.56x1.61x1.00x
64×641.35x1.00x1.18x
128×1284.21x1.00x1.88x
256×2564.62x1.00x2.04x
512×5122.89x1.00x1.95x

Inversion

Performing C = A^-1

Raw data

Results in msOpenCVArmadilloEigen
4×40.002050.000460.00271
8×80.002200.004170.00274
16×160.009890.012550.01094
32×320.061010.051460.05023
64×640.412860.257690.27921
128×1283.603473.760521.88089
256×25633.7250223.1021811.62692
512×512285.03784126.70175162.74253

Normalised

Speed up over slowestOpenCVArmadilloEigen
4×41.32x5.85x1.00x
8×81.90x1.00x1.52x
16×161.27x1.00x1.15x
32×321.00x1.19x1.21x
64×641.00x1.60x1.48x
128×1281.04x1.00x2.00x
256×2561.00x1.46x2.90x
512×5121.00x2.25x1.75x

SVD

Performing full SVD, [U,S,V] = SVD(A)

Raw data

Results in msOpenCVArmadilloEigen
4×40.012200.220800.01620
8×80.017600.057600.03340
16×160.107000.165600.25540
32×320.514800.702301.13900
64×643.637803.435206.63350
128×12827.0430023.0160064.27500
256×256240.11000210.70600675.84100
512×5121727.440001586.664006934.32300

Normalised

Discussion

Overall, the average running time has decreased for all the operations, which is a good start. Even OpenCV has lower running time, maybe the NDEBUG has an affect, since it’s a standardised define.

Speed up over slowestOpenCVArmadilloEigen
4×418.10x1.00x13.63x
8×83.27x1.00x1.72x
16×162.39x1.54x1.00x
32×322.21x1.62x1.00x
64×641.82x1.93x1.00x
128×1282.38x2.79x1.00x
256×2562.81x3.21x1.00x
512×5124.01x4.37x1.00x

Discussion

Overall, average running time has decreased for all operations, which is a good sign. Even OpenCV, maybe the NDEBUG has an affect, since it’s a standardised define.

The results from the addition test show all 3 libraries giving more or less the same result. This is probably not a surprise since adding matrix is a very straight forward O(N) task.

The multiply test is a bit more interesting. For matrix 64×64 or larger, there is a noticeable gap between the libraries. Eigen is very fast, with Armadillo coming in second for matrix 256×256 or greater. I’m guessing for larger matrices Eigen and Armadillo leverages the extra CPU core, because I did see all the CPU cores utilised briefly during benchmarking.

The transpose test involve shuffling memory around. This test is affected by the CPU’s caching mechanism. OpenCV does a good job as the matrix size increases.

The inversion test is a bit of a mixed bag. OpenCV seems to be the slowest out of the two.

The SVD test is interesting. Seems like there is a clear range where OpenCV and Armadillo are faster. Eigen lags behind by quite a bit as the matrix size increases.

Conclusion

In practice, if you just want a matrix library and nothing more then Armadillo or Eigen is probably the way to go. If you want something that is very portable with minimal effort then choose Eigen, because the entire library is header based, no library linking required. If you want the fastest matrix code possible then you can be adventurous and try combining the best of each library.

Download

test_matrix_lib.cpp

Code compiled with:

g++ test_matrix_lib.cpp -o test_matrix_lib -lopencv_core -larmadillo -lgomp -fopenmp -march=native -O3 -DARMA_NO_DEBUG -DNDEBUG
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
奇異矩陣、奇異值分解、SVD分解_小米地帶
[轉載]R語(yǔ)言矩陣運算
高翔Slambook第七講代碼解讀(3d-3d位姿估計)
Qt使用Eigen矩陣庫
C語(yǔ)言矩陣運算庫大起底
C++ Eigen庫計算矩陣特征值及特征向量
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久