{"record":{"id":"f2e238d89b88a79a","repo":"Yalantis/uCrop","slug":"cimg-appname-math-parser-cimg-s-s-s-t-f2e238","errorCode":null,"errorMessage":"[\" cimg_appname \"_math_parser] CImg<%s>::%s: %s: Type of first argument ('%s') do not match with third argument ('%s'), in expression '%s'.","messagePattern":"\\[\" cimg_appname \"_math_parser\\] CImg<(.+?)>::(.+?): (.+?): Type of first argument \\('(.+?)'\\) do not match with third argument \\('(.+?)'\\), in expression '(.+?)'\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":22656,"sourceCode":"                throw CImgArgumentException(\"[\" cimg_appname \"_math_parser] \"\n                                            \"CImg<%s>::%s: %s: Type of first argument ('%s') \"\n                                            \"do not match with second argument 'nb_colsS=%u', \"\n                                            \"in expression '%s'.\",\n                                            pixel_type(),_cimg_mp_calling_function,s_op,\n                                            s_type(arg1)._data,wS,s0);\n              }\n              if (wD*hD!=p2) {\n                _cimg_mp_strerr;\n                throw CImgArgumentException(\"[\" cimg_appname \"_math_parser] \"\n                                            \"CImg<%s>::%s: %s: Type of third argument ('%s') \"\n                                            \"do not match with fourth argument 'nb_colsD=%u', \"\n                                            \"in expression '%s'.\",\n                                            pixel_type(),_cimg_mp_calling_function,s_op,\n                                            s_type(arg3)._data,wD,s0);\n              }\n              if (hS!=hD) {\n                _cimg_mp_strerr;\n                throw CImgArgumentException(\"[\" cimg_appname \"_math_parser] \"\n                                            \"CImg<%s>::%s: %s: Type of first argument ('%s') \"\n                                            \"do not match with third argument ('%s'), \"\n                                            \"in expression '%s'.\",\n                                            pixel_type(),_cimg_mp_calling_function,s_op,\n                                            s_type(arg1)._data,s_type(arg3)._data,s0);\n              }\n              pos = vector(wS*wD);\n              CImg<ulongT>::vector((ulongT)mp_mproj,pos,arg1,wS,hS,arg3,wD,arg5,arg6,p3).move_to(code);\n              return_comp = true;\n              _cimg_mp_return(pos);\n            }\n\n            if (!std::strncmp(ss,\"mse(\",4)) { // Mean-squared error\n              _cimg_mp_op(\"Function 'mse()'\");\n              s1 = ss4; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;\n              arg1 = compile(ss4,s1,depth1,0,block_flags);\n              arg2 = compile(++s1,se1,depth1,0,block_flags);\n              _cimg_mp_check_type(arg2,2,is_scalar(arg1)?1:2,size(arg1));","sourceCodeStart":22638,"sourceCodeEnd":22674,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L22638-L22674","documentation":"For operations between a source and destination matrix, both must share the same number of rows (hS == hD). When the row counts differ (i.e. size(source)/nb_colsS != size(destination)/nb_colsD), the parser throws this mismatch error naming the first and third arguments.","triggerScenarios":"Two-matrix math-parser op where source and destination have different row counts, e.g. op(S,D,colsS,colsD) with size(S)/colsS != size(D)/colsD.","commonSituations":"Multiplying an m x n by a p x q matrix with p != m, forgetting to pad/crop the destination, or column-count typos that change the implied row count.","solutions":["Make size(S)/colsS equal size(D)/colsD by resizing one operand","Recheck both column-count arguments; wrong values change implied row counts","Print both vector sizes and column counts to verify row counts match","Restructure the expression so both operands derive from the same geometry"],"exampleFix":"// before: S is 3x4 (12), D is 4x3 (12) but rows 3 != 4\nop(S,D,4,3)\n// after\nop(S,D,4,4) // D resized to 3x4 (12 values) -> rows match","handlingStrategy":"validation","validationCode":"size(source)/colsS == size(dst)/colsD || error \"row counts differ\"","typeGuard":null,"tryCatchPattern":"try { run(expr) } catch (CImgArgumentException &e) { log(e.what()); }","preventionTips":["Derive both operands from the same geometry","Verify implied row counts of both matrices","Pad/crop operands to matching row counts"],"tags":["cimg","math-parser","dimension-mismatch"],"backgroundTag":"tensor-shape-mismatch","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}