开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++ 2012
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
Tifflib,Armadillo:C++ linear algebra library
问题(Question):
平行处理循环 内的变量独立处理
喂入的资料(Input):
txt文字档 amd 16bit TIFF影像
预期的正确结果(Expected Output):
错误结果(Wrong Output):
出现R6010 abort() has been called
程式码(Code):(请善用置底文网页, 记得排版)
void test(double &X, double &Y, double &Z,double parameter[6]){
...略...
mat B(4,3); //design matrix
mat Un; // unknows,XYZ的修正量
mat C(4,1);
mat V;
mat InN; //Inv(BTPB)
mat BTPB, BTPC;
X = 0.0;
Y = 0.0;
Z = 0.0;
for(uint8 iter=0;iter<20;iter++){ //iterative caculation
.
.
.
略
.
.
.
BTPB.fill(0);
BTPC.fill(0);
BTPB = trans(B)*B;
BTPC = trans(B)*C;
Un = inv(BTPB)*BTPC;
InN = inv(BTPB);
X = X+Un(0,0); //bug点应该是在这
Y = Y+Un(1,0);
Z = Z+Un(2,0);
if(fabs(Un)<pow(10,-5)){iter = 100;} //停止循环门槛
}
}
main{
//