開發平台(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{
//