jianxiongxiao / SFMedu

SFMedu: A Matlab-based Structure-from-Motion System for Education
202 stars 59 forks source link

dense matching error #5

Open gethubwy opened 5 years ago

gethubwy commented 5 years ago

hi, Thank you for this excellent SFM example. I download the code and run it in matlab (R2018a),then I find that the error at "dense matching",I don't know why,please help me.thanks @jianxiongxiao image

the error message blews: SFMedu: Structrue From Motion for Education Purpose Version 2 @ 2014 Written by Jianxiong Xiao (MIT License) Warning: cannot find the focal length from the EXIF intrinsics: 719.5459 0 0 0 719.5459 0 0 0 1.0000

44 inliers / 44 SIFT matches = 100.00% 0 0 44 0 initial error = 3.940072 error = 1.206862

44 inliers / 44 SIFT matches = 100.00% 44 0 0 0 initial error = 1.132917 error = 0.459162

43 inliers / 43 SIFT matches = 100.00% 0 0 43 0 initial error = 1.935915 error = 0.424029

26 inliers / 27 SIFT matches = 96.30% 0 26 0 0 initial error = 1.049759 error = 0.340980

merging graphs.... initial error = 38.955285 error = 1.053030 remove 3 outliers outof 44 points with view angle less than 2.000000 degrees remove 3 outliers outof 41 points with view angle less than 2.000000 degrees remove 1 outliers outof 36 points with view angle less than 2.000000 degrees remove 1 outliers outof 35 points with view angle less than 2.000000 degrees initial error = 1.098139 error = 1.022036 initial error = 32.236354 error = 0.924223 remove 1 outliers outof 34 points with view angle less than 2.000000 degrees remove 6 outliers outof 40 points with view angle less than 2.000000 degrees initial error = 0.949075 error = 0.936788 initial error = 21.719241 error = 0.893142 remove 1 outliers outof 34 points with view angle less than 2.000000 degrees remove 1 outliers outof 24 points with view angle less than 2.000000 degrees remove 1 outliers outof 23 points with view angle less than 2.000000 degrees initial error = 0.903544 error = 0.902567 dense matching ...


      Access violation detected at 周一 2月 18 02:32:15 2019 +0800

Configuration: Crash Decoding : Disabled - No sandbox or build area path Crash Mode : continue (default) Default Encoding : GBK Deployed : false Graphics Driver : Unknown hardware Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) UHD Graphics 630 Version 24.20.100.6291 (2018-8-27) Java Version : Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode MATLAB Architecture : win64 MATLAB Entitlement ID : 5390899 MATLAB Root : C:\Program Files\MATLAB\R2018b MATLAB Version : 9.5.0.944444 (R2018b) OpenGL : hardware Operating System : Microsoft Windows 10 专业版 Process ID : 4712 Processor ID : x86 Family 6 Model 158 Stepping 10, GenuineIntel Session Key : 948c47ab-38ac-4896-8b9d-0eb924ff08b9 Window System : Version 10.0 (Build 17763)

Fault Count: 1

Abnormal termination

Register State (from fault): RAX = 0000c6e3ad101e25 RBX = ffffffffe338ec90 RCX = ffffffffe338ec90 RDX = 0000000000000000 RSP = 00000000043f8c30 RBP = 00000000043f8e30 RSI = 0000000000000003 RDI = 0000000000000000

R8 = 0000000000000000 R9 = 00000000043f9b80 R10 = 000000000000001e R11 = 00000000043f8d68 R12 = 0000000000000000 R13 = 0000000006467430 R14 = 0000000000000003 R15 = 00000000043f8e30

RIP = 00007ff8433819a5 EFL = 00010202

CS = 0033 FS = 0053 GS = 002b

Stack Trace (from fault): [ 0] 0x00007ff8433819a5 D:\SFM\SFMedu-master\SFMedu-master\denseMatch\priority_queue_1.0\pq_push.mexw64+00006565 [ 1] 0x00000000fc635524 bin\win64\libmex.dll+00349476 MexRetrieveVersion+00003348 [ 2] 0x00000000fc63571c bin\win64\libmex.dll+00349980 MexRetrieveVersion+00003852 [ 3] 0x00000000fc635884 bin\win64\libmex.dll+00350340 MexRetrieveVersion+00004212 [ 4] 0x00000000fc619059 bin\win64\libmex.dll+00233561 mexUnlock_800+00025273 [ 5] 0x0000000016f2e007 bin\win64\pgo\m_dispatcher.dll+00057351 Mfh_file::dispatch_fh_impl+00001111 [ 6] 0x0000000016f2da9e bin\win64\pgo\m_dispatcher.dll+00055966 Mfh_file::dispatch_fh+00000062 [ 7] 0x0000000017d44ead bin\win64\pgo\m_lxe.dll+00347821 [ 8] 0x0000000017ede9b6 bin\win64\pgo\m_lxe.dll+02025910 MathWorks::lxe::ShutdownLxeEngine+00004034 [ 9] 0x0000000017e3fd3c bin\win64\pgo\m_lxe.dll+01375548 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00493568 [ 10] 0x0000000017e4091c bin\win64\pgo\m_lxe.dll+01378588 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00496608 [ 11] 0x0000000017e41c92 bin\win64\pgo\m_lxe.dll+01383570 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00501590 [ 12] 0x0000000017e428f8 bin\win64\pgo\m_lxe.dll+01386744 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00504764 [ 13] 0x0000000017e41ddf bin\win64\pgo\m_lxe.dll+01383903 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00501923 [ 14] 0x0000000017e41ede bin\win64\pgo\m_lxe.dll+01384158 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00502178 [ 15] 0x0000000017d49a7d bin\win64\pgo\m_lxe.dll+00367229 [ 16] 0x0000000017d5b265 bin\win64\pgo\m_lxe.dll+00438885 [ 17] 0x0000000017d5a88c bin\win64\pgo\m_lxe.dll+00436364 [ 18] 0x0000000017d58779 bin\win64\pgo\m_lxe.dll+00427897 [ 19] 0x0000000017d590eb bin\win64\pgo\m_lxe.dll+00430315 [ 20] 0x0000000017d58a49 bin\win64\pgo\m_lxe.dll+00428617 [ 21] 0x0000000016f2e007 bin\win64\pgo\m_dispatcher.dll+00057351 Mfh_file::dispatch_fh_impl+00001111 [ 22] 0x0000000016f2da9e bin\win64\pgo\m_dispatcher.dll+00055966 Mfh_file::dispatch_fh+00000062 [ 23] 0x0000000017d44ead bin\win64\pgo\m_lxe.dll+00347821 [ 24] 0x0000000017ede9b6 bin\win64\pgo\m_lxe.dll+02025910 MathWorks::lxe::ShutdownLxeEngine+00004034 [ 25] 0x0000000017e3fd3c bin\win64\pgo\m_lxe.dll+01375548 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00493568 [ 26] 0x0000000017e4091c bin\win64\pgo\m_lxe.dll+01378588 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00496608 [ 27] 0x0000000017e41c92 bin\win64\pgo\m_lxe.dll+01383570 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00501590 [ 28] 0x0000000017e428f8 bin\win64\pgo\m_lxe.dll+01386744 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00504764 [ 29] 0x0000000017e41ddf bin\win64\pgo\m_lxe.dll+01383903 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00501923 [ 30] 0x0000000017e41ede bin\win64\pgo\m_lxe.dll+01384158 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00502178 [ 31] 0x0000000017d49a7d bin\win64\pgo\m_lxe.dll+00367229 [ 32] 0x0000000017d5b265 bin\win64\pgo\m_lxe.dll+00438885 [ 33] 0x0000000017d5a88c bin\win64\pgo\m_lxe.dll+00436364 [ 34] 0x0000000017d542a1 bin\win64\pgo\m_lxe.dll+00410273 [ 35] 0x0000000017d539c6 bin\win64\pgo\m_lxe.dll+00408006 [ 36] 0x0000000017d53ace bin\win64\pgo\m_lxe.dll+00408270 [ 37] 0x0000000017f33780 bin\win64\pgo\m_lxe.dll+02373504 mwboost::archive::detail::oserializer<mwboost::archive::xml_oarchive,MathWorks::lxe::CodeClearEvent>::oserializer<mwboost::archive::xml_oarchive,MathWorks::lxe::CodeClearEvent>+00012824 [ 38] 0x0000000017f3372e bin\win64\pgo\m_lxe.dll+02373422 mwboost::archive::detail::oserializer<mwboost::archive::xml_oarchive,MathWorks::lxe::CodeClearEvent>::oserializer<mwboost::archive::xml_oarchive,MathWorks::lxe::CodeClearEvent>+00012742 [ 39] 0x0000000017e134fd bin\win64\pgo\m_lxe.dll+01193213 mwboost::archive::detail::iserializer<mwboost::archive::binaryTerm_iarchive,MathWorks::lxe::function_descriptor>::load_object_data+00311233 [ 40] 0x0000000017a769e7 bin\win64\pgo\m_interpreter.dll+00354791 inEvalCmdWithLocalReturn+00000063 [ 41] 0x00000000fb610388 bin\win64\libmwbridge.dll+00131976 mnParser+00001304 [ 42] 0x0000000016d23618 bin\win64\mcr.dll+00341528 mcr::runtime::setInterpreterThreadSingletonToCurrent+00020808 [ 43] 0x0000000016d2414d bin\win64\mcr.dll+00344397 mcr::runtime::setInterpreterThreadSingletonToCurrent+00023677 [ 44] 0x0000000016ceb1ba bin\win64\mcr.dll+00111034 mcrOptions::set_use_license_manager+00075498 [ 45] 0x0000000016d06e74 bin\win64\mcr.dll+00224884 mcrOptions::set_use_license_manager+00189348 [ 46] 0x00000000fd02cfee bin\win64\iqm.dll+00643054 iqm::PackagedTaskPlugin::execute+00000894 [ 47] 0x00000000fd02ce63 bin\win64\iqm.dll+00642659 iqm::PackagedTaskPlugin::execute+00000499 [ 48] 0x00000000fcffcc07 bin\win64\iqm.dll+00445447 iqm::Iqm::setupIqmFcnPtrs+00076215 [ 49] 0x00000000fcffcc59 bin\win64\iqm.dll+00445529 iqm::Iqm::setupIqmFcnPtrs+00076297 [ 50] 0x00000000fcffca16 bin\win64\iqm.dll+00444950 iqm::Iqm::setupIqmFcnPtrs+00075718 [ 51] 0x00000000fcfd9748 bin\win64\iqm.dll+00300872 iqm::Iqm::deliver+00005880 [ 52] 0x00000000fcfd8eef bin\win64\iqm.dll+00298735 iqm::Iqm::deliver+00003743 [ 53] 0x00000000fcfdac0d bin\win64\iqm.dll+00306189 iqm::Iqm::deliver+00011197 [ 54] 0x0000000100203775 bin\win64\libmwservices.dll+02176885 services::system_events::PpeDispatchHook::dispatchOne+00036213 [ 55] 0x0000000100212a63 bin\win64\libmwservices.dll+02239075 sysq::addProcessPendingEventsUnitTestHook+00006035 [ 56] 0x0000000100214310 bin\win64\libmwservices.dll+02245392 sysq::getCondition+00004208 [ 57] 0x000000010021596d bin\win64\libmwservices.dll+02251117 svWS_ProcessPendingEvents+00000221 [ 58] 0x0000000016d27724 bin\win64\mcr.dll+00358180 mcr::runtime::setInterpreterThreadSingletonToCurrent+00037460 [ 59] 0x0000000016d27f16 bin\win64\mcr.dll+00360214 mcr::runtime::setInterpreterThreadSingletonToCurrent+00039494 [ 60] 0x0000000016d1cabf bin\win64\mcr.dll+00314047 mcr_process_events+00001007 [ 61] 0x0000000016c2d040 bin\win64\MVMLocal.dll+00380992 mvm_server::inproc::LocalFactory::terminate+00177312 [ 62] 0x00000000fa9d9480 bin\win64\mvm.dll+01741952 mvm::detail::SessionImpl::initWithOptions+00000592 [ 63] 0x00000000fa9da170 bin\win64\mvm.dll+01745264 mvm::detail::SessionImpl::runMain+00000128 [ 64] 0x00000000fa9da395 bin\win64\mvm.dll+01745813 mvm::detail::SessionImpl::runMatlabDesktop+00000261 [ 65] 0x0000000140007036 C:\Program Files\MATLAB\R2018b\bin\win64\matlab.exe+00028726 mwboost::serialization::singleton_module::unlock+00000966 [ 66] 0x0000000140007f13 C:\Program Files\MATLAB\R2018b\bin\win64\matlab.exe+00032531 mwboost::serialization::singleton_module::unlock+00004771 [ 67] 0x00007ff84e8281f4 C:\WINDOWS\System32\KERNEL32.DLL+00098804 BaseThreadInitThunk+00000020 [ 68] 0x00007ff850d8a251 C:\WINDOWS\SYSTEM32\ntdll.dll+00434769 RtlUserThreadStart+00000033

This error was detected while a MEX-file was running. If the MEX-file is not an official MathWorks function, please examine its source code for errors. Please consult the External Interfaces Guide for information on debugging MEX-files. This crash report has been saved to disk as C:\Users\WY\AppData\Local\Temp\matlab_crash_dump.4712-1

jackliang7107 commented 5 years ago

I am having the same problem. have you solved it yet ?

gethubwy commented 5 years ago

nope

------------------ 原始邮件 ------------------ 发件人: "jackliang7107"notifications@github.com; 发送时间: 2019年4月23日(星期二) 下午3:36 收件人: "jianxiongxiao/SFMedu"SFMedu@noreply.github.com; 抄送: "一一最棒"1531152547@qq.com; "Author"author@noreply.github.com; 主题: Re: [jianxiongxiao/SFMedu] dense matching error (#5)

I am having the same problem. have you solved it yet ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

huangyxi commented 4 years ago

I rebuilt priority_queue_1.0 by running pq_demo.m in MATLAB before running SFMedu2.m and solved this problem.

You may install MATLAB Support for MinGW-w64 C/C++ Compiler first, and replace mex -v CXXFLAGS='$CXXFLAGS -fpermissive' with mex in pq_demo.m. Suppose you are using Windows.

holy3kill commented 4 years ago

This crash is caused by priority_queue_1.0/pq_push.cpp, if you use vs2017 and Matlab R2019b, you should alter the source code like that:

void retrieve_heap( const mxArray* matptr, MaxHeap<double>* & heap){

    // retrieve pointer from the MX form

    double* pointer0 = mxGetPr(matptr);

    // check that I actually received something

    if( pointer0 == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");

    // convert it to "long" datatype (good for addresses)

    long pointer1 = static_cast<long> (pointer0[0]);

    // convert it to "KDTree"

     heap = reinterpret_cast<MaxHeap<double>*> (pointer1);

    // check that I actually received something

    if( heap == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");
}

Then run pq_demo.m and rebuild mex file, enjoy it. This crash tell us use static_cast and reinterpret_cast is better than C type conversion.........

Orz-Github commented 4 years ago

I rebuilt priority_queue_1.0 by running pq_demo.m in MATLAB before running SFMedu2.m and solved this problem.

You may install MATLAB Support for MinGW-w64 C/C++ Compiler first, and replace mex -v CXXFLAGS='$CXXFLAGS -fpermissive' with mex in pq_demo.m. Suppose you are using Windows.

请问出现了这样的错误,是怎么回事呢? 错误使用 mex C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp: In function 'void mexFunction(int, mxArray, int, const mxArray)': C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp:52:30: error: cast from 'MaxHeap*' to 'long int' loses precision [-fpermissive] pointer_to_tree[0] = (long) pq; ^

出错 pq_demo (line 9) mex pq_create.cpp;

Orz-Github commented 4 years ago

This crash is caused by priority_queue_1.0/pq_push.cpp, if you use vs2017 and Matlab R2019b, you should alter the source code like that:

void retrieve_heap( const mxArray* matptr, MaxHeap<double>* & heap){

    // retrieve pointer from the MX form

    double* pointer0 = mxGetPr(matptr);

    // check that I actually received something

    if( pointer0 == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");

    // convert it to "long" datatype (good for addresses)

    long pointer1 = static_cast<long> (pointer0[0]);

    // convert it to "KDTree"

     heap = reinterpret_cast<MaxHeap<double>*> (pointer1);

    // check that I actually received something

    if( heap == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");
}

Then run pq_demo.m and rebuild mex file, enjoy it. This crash tell us use static_cast and reinterpret_cast is better than C type conversion......... 请问出现这样的错误是什么原因呢?

错误使用 mex C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp: In function 'void mexFunction(int, mxArray, int, const mxArray)': C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp:52:30: error: cast from 'MaxHeap*' to 'long int' loses precision [-fpermissive] pointer_to_tree[0] = (long) pq; ^

出错 pq_demo (line 9) mex pq_create.cpp;

holy3kill commented 4 years ago

This crash is caused by priority_queue_1.0/pq_push.cpp, if you use vs2017 and Matlab R2019b, you should alter the source code like that:

void retrieve_heap( const mxArray* matptr, MaxHeap<double>* & heap){

    // retrieve pointer from the MX form

    double* pointer0 = mxGetPr(matptr);

    // check that I actually received something

    if( pointer0 == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");

    // convert it to "long" datatype (good for addresses)

    long pointer1 = static_cast<long> (pointer0[0]);

    // convert it to "KDTree"

     heap = reinterpret_cast<MaxHeap<double>*> (pointer1);

    // check that I actually received something

    if( heap == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");
}

Then run pq_demo.m and rebuild mex file, enjoy it. This crash tell us use static_cast and reinterpret_cast is better than C type conversion......... 请问出现这样的错误是什么原因呢?

错误使用 mex C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp: In function 'void mexFunction(int, mxArray, int, const mxArray)': C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp:52:30: error: cast from 'MaxHeap*' to 'long int' loses precision [-fpermissive] pointer_to_tree[0] = (long) pq; ^

出错 pq_demo (line 9) mex pq_create.cpp;

你用的什么编译器?我的可以通过编译的啊,如果不行的话你改为这样试试: long pointer1 = (long) (pointer0[0]);

zhangfuhao0082 commented 4 years ago

是因为使用VS编译器的原因,换成MinGW编译器,然后在 pq_demo.m里用 mex -v CXXFLAGS='$CXXFLAGS -fpermissive' 代替 mex,运行编译就可以,亲测可以解决。 谢谢楼上各位的解答

tranvanha1508 commented 3 years ago

This crash is caused by priority_queue_1.0/pq_push.cpp, if you use vs2017 and Matlab R2019b, you should alter the source code like that:

void retrieve_heap( const mxArray* matptr, MaxHeap<double>* & heap){

    // retrieve pointer from the MX form

    double* pointer0 = mxGetPr(matptr);

    // check that I actually received something

    if( pointer0 == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");

    // convert it to "long" datatype (good for addresses)

    long pointer1 = static_cast<long> (pointer0[0]);

    // convert it to "KDTree"

     heap = reinterpret_cast<MaxHeap<double>*> (pointer1);

    // check that I actually received something

    if( heap == NULL )

        mexErrMsgTxt("vararg{1} must be a valid priority queue pointer\n");
}

Then run pq_demo.m and rebuild mex file, enjoy it. This crash tell us use static_cast and reinterpret_cast is better than C type conversion......... 请问出现这样的错误是什么原因呢?

错误使用 mex C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp: In function 'void mexFunction(int, mxArray, int, const mxArray)': C:\Users\29085\Downloads\SFMedu-master\denseMatch\priority_queue_1.0\pq_create.cpp:52:30: error: cast from 'MaxHeap*' to 'long int' loses precision [-fpermissive] pointer_to_tree[0] = (long) pq; ^

出错 pq_demo (line 9) mex pq_create.cpp;

I am having the same problem. have you solved it yet ?

junqiwu02 commented 2 years ago

I think the problem is with loss of precision when storing a pointer in a long instead of long long (which might be due to the difference in running on 32 vs 64 bit systems but I'm not sure). I was able to solve the issue with the following steps (you can also check my fork of the repo for the working code):

Switch to MinGW64 Compiler for C++ (make sure you run mex -setup C++)

Replace line 52 in pq_create.cpp: pointer_to_tree[0] = (long) pq; with: pointer_to_tree[0] = (long long) pq;

Replace all instances of the following in pq_delete.cpp, pq_pop.cpp, pq_push.cpp, pq_size.cpp, and pq_top.cpp: long pointer1 = (long) pointer0[0]; with: long long pointer1 = (long long) pointer0[0];

guge2 commented 1 year ago

是因为使用VS编译器的原因,换成MinGW编译器,然后在 pq_demo.m里用 mex -v CXXFLAGS='$CXXFLAGS -fpermissive' 代替 mex,运行编译就可以,亲测可以解决。 谢谢楼上各位的解答

不行啊,编译器也换了,代码也改成reinterpret_cast,但是pq_push就是会导致matlab崩溃,绝望

guge2 commented 1 year ago

I think the problem is with loss of precision when storing a pointer in a long instead of long long (which might be due to the difference in running on 32 vs 64 bit systems but I'm not sure). I was able to solve the issue with the following steps (you can also check my fork of the repo for the working code):

Switch to MinGW64 Compiler for C++ (make sure you run mex -setup C++)

Replace line 52 in pq_create.cpp: pointer_to_tree[0] = (long) pq; with: pointer_to_tree[0] = (long long) pq;

Replace all instances of the following in pq_delete.cpp, pq_pop.cpp, pq_push.cpp, pq_size.cpp, and pq_top.cpp: long pointer1 = (long) pointer0[0]; with: long long pointer1 = (long long) pointer0[0];

可以可以,我从你的git仓库拉取的代码能够直接使用,谢谢!

LiuHongYun11 commented 1 month ago

I think the problem is with loss of precision when storing a pointer in a long instead of long long (which might be due to the difference in running on 32 vs 64 bit systems but I'm not sure). I was able to solve the issue with the following steps (you can also check my fork of the repo for the working code): Switch to MinGW64 Compiler for C++ (make sure you run mex -setup C++) Replace line 52 in pq_create.cpp: pointer_to_tree[0] = (long) pq; with: pointer_to_tree[0] = (long long) pq; Replace all instances of the following in pq_delete.cpp, pq_pop.cpp, pq_push.cpp, pq_size.cpp, and pq_top.cpp: long pointer1 = (long) pointer0[0]; with: long long pointer1 = (long long) pointer0[0];

可以可以,我从你的git仓库拉取的代码能够直接使用,谢谢!

您好,请问一下我刚下载的这个代码,如何解决这个问题?您可以分享一下吗