8월, 2021의 게시물 표시

Measuring execution time with C++ (>= 11) standard library

(recent change : 2021-08-14) Test Environment :  Windows 10 21H1 / MSVC C++ 14 Introduction What chrono(C++ >= 11) makes better than time.h(C) ? - More functionality - More precise - More convenient. Clock Types in Chrono As I know, chrono only provides three types of clock which originated from boost library. Different type of clocks is implement in chrono of boost . The clock types included in chrono are :  (a) system_clock : (may not be monotonic) system-wide real time wall clock.     - Could be adjusted at any time by the OS. (e.g. NTP sync. or user's action)     - Based on UTC time-zone. (b)  steady_clock : (monotonic) time between ticks are constant, not related with system_clock's time,  every time point increases monotonically. (c)  high_resolution_clock  : (may be an alias of above) clock with smallest tick period. You may already see other articles, that measuring accurate, high resolution time using OS-dependent (e.g.  QueryPerformanceCounter ) timer. But actu

'Index type not supported yet' error when doing QR factorization using Eigen and SuiteSparseQR

이미지
Environment Windows 10 21H1 / MSVC C++ 14 / eigen 3.3.7 / suitesparse  5.3.0 Error Specification Assertion failed: false && "Index type not supported yet", file C:\vcpkg\installed\x64-windows\include\eigen3\Eigen\src/CholmodSupport/CholmodSupport.h, line 93 Solution Just comment eigen_assert on line 93 of CholmodSupport.h. Test Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #include <Eigen/Sparse> #include <Eigen/SPQRSupport> #include <Eigen/SparseCholesky> #include <Eigen/OrderingMethods> #include <vector> #include <iostream> typedef Eigen :: SparseMatrix < double > SparseColMat; int main ( int argc, char ** argv) { SparseColMat m( 4 , 3 ); m.coeffRef( 0 , 0 ) = -1 ; m.coeffRef( 0 , 1 ) = -1 ; m.coeffRef( 0 , 2 ) = 1 ; m.coeffRef( 1 , 0 ) = 1 ; m.coeffRef( 1 , 1 ) = 3 ; m.coeffRef( 1 , 2 ) = 3 ; m.coeffRef( 2 , 0 ) = -1 ; m.coeffRef( 2 , 1 ) =