{"record":{"id":"5a69e775acff9f0a","repo":"Yalantis/uCrop","slug":"cimg-appname-math-parser-cimg-s-s-s-t-5a69e7","errorCode":null,"errorMessage":"[\" cimg_appname \"_math_parser] CImg<%s>::%s: %s: Type of first argument ('%s') do not match with second argument 'nb_colsS=%u', in expression '%s'.","messagePattern":"\\[\" cimg_appname \"_math_parser\\] CImg<(.+?)>::(.+?): (.+?): Type of first argument \\('(.+?)'\\) do not match with second argument 'nb_colsS=%u', in expression '(.+?)'\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":22638,"sourceCode":"              }\n              _cimg_mp_check_type(arg1,1,2,0);\n              _cimg_mp_check_const_scalar(arg2,2,3);\n              _cimg_mp_check_type(arg3,3,2,0);\n              _cimg_mp_check_const_scalar(arg4,4,3);\n              _cimg_mp_check_type(arg5,5,1,0);\n              _cimg_mp_check_type(arg6,6,1,0);\n              _cimg_mp_check_type(p3,7,1,0);\n              p1 = size(arg1);\n              p2 = size(arg3);\n              const unsigned int\n                wS = (unsigned int)mem[arg2],\n                wD = (unsigned int)mem[arg4],\n                hS = p1/wS,\n                hD = p2/wD;\n\n              if (wS*hS!=p1) {\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 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] \"","sourceCodeStart":22620,"sourceCodeEnd":22656,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L22620-L22656","documentation":"In a source/destination matrix-style operation, the first argument (source) must have size nb_colsS * nb_rowsS. When wS*hS != p1, the source column count 'nb_colsS' does not divide the source vector size, so the parser rejects the expression as a dimension mismatch.","triggerScenarios":"Calling a two-matrix math-parser op (e.g. a solve/transpose-style op taking S and D with explicit column counts) where nb_colsS does not divide size(arg1).","commonSituations":"Wrong column count constant in G'MIC formulas, source vector produced by a previous op with unexpected length, or mixing square and rectangular matrices.","solutions":["Verify size(source) % nb_colsS == 0 and adjust the column count","Print the source vector size before the op to confirm its length","Reshape or unroll the source to match the expected rows x cols layout","Check that the correct argument slot is being used (first arg is the source)"],"exampleFix":"// before: source has 12 values, nb_colsS=5\nsolve(S,D,5)\n// after\nsolve(S,D,4) // 12 = 3 rows * 4 cols","handlingStrategy":"validation","validationCode":"size(source) % nb_colsS == 0 || error \"source size not divisible by nb_colsS\"","typeGuard":null,"tryCatchPattern":"try { run(expr) } catch (CImgArgumentException &e) { log(e.what()); }","preventionTips":["Check source length mod nb_colsS before the op","Confirm which argument slot holds the source","Test with known-size vectors first"],"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"}