Commit 3a880d1c15d8014eec9d403db73911f7dce73309

Authored by David Mayerich
1 parent ec722ff9

fixed PCA and BIP conversion bugs

Showing 2 changed files with 6 additions and 2 deletions   Show diff stats
@@ -1289,11 +1289,15 @@ public: @@ -1289,11 +1289,15 @@ public:
1289 stat = cublasSetVector((int)B, sizeof(double), s, 1, s_dev, 1); //copy the spectrum from the host to the device 1289 stat = cublasSetVector((int)B, sizeof(double), s, 1, s_dev, 1); //copy the spectrum from the host to the device
1290 stat = cublasDaxpy(handle, (int)B, &axpy_alpha, center_dev, 1, s_dev, 1); //subtract the center (average) 1290 stat = cublasDaxpy(handle, (int)B, &axpy_alpha, center_dev, 1, s_dev, 1); //subtract the center (average)
1291 stat = cublasDgemv(handle,CUBLAS_OP_N,(int)M,(int)B,&axpy_alpha2,basis_dev,(int)M,s_dev,1,&axpy_beta,A_dev,1); //performs the matrix-vector multiplication 1291 stat = cublasDgemv(handle,CUBLAS_OP_N,(int)M,(int)B,&axpy_alpha2,basis_dev,(int)M,s_dev,1,&axpy_beta,A_dev,1); //performs the matrix-vector multiplication
1292 - stat = cublasGetVector((int)B, sizeof(double), A_dev, 1, A, 1); //copy the projected pixel to the host (from GPU to CPU) 1292 + stat = cublasGetVector((int)M, sizeof(double), A_dev, 1, A, 1); //copy the projected pixel to the host (from GPU to CPU)
  1293 +
  1294 + //stat = cublasGetVector((int)B, sizeof(double), s_dev, 1, A, 1); //copy the projected pixel to the host (from GPU to CPU)
1293 1295
1294 //std::copy<double*, T*>(A, A + M, temp); 1296 //std::copy<double*, T*>(A, A + M, temp);
1295 for(i = 0; i < M; i++) temp[i] = (T)A[i]; //casting projected pixel from double to whatever T is 1297 for(i = 0; i < M; i++) temp[i] = (T)A[i]; //casting projected pixel from double to whatever T is
1296 } 1298 }
  1299 + else
  1300 + memset(temp, 0, sizeof(T) * M);
1297 1301
1298 target.write(reinterpret_cast<const char*>(temp), sizeof(T) * M); //write the projected vector 1302 target.write(reinterpret_cast<const char*>(temp), sizeof(T) * M); //write the projected vector
1299 if(PROGRESS) progress = (double)(xy+1) / XY * 100; //record the current progress 1303 if(PROGRESS) progress = (double)(xy+1) / XY * 100; //record the current progress
@@ -543,7 +543,7 @@ public: @@ -543,7 +543,7 @@ public:
543 } 543 }
544 544
545 b = !b; //swap the double-buffer 545 b = !b; //swap the double-buffer
546 - pt_total += binary<T>::permute(dst[b], src[b], X(), N[b], Z(), 0, 2, 1); //permute the batch to a BIL file 546 + pt_total += binary<T>::permute(dst[b], src[b], X(), N[b], Z(), 2, 0, 1); //permute the batch to a BIL file
547 wt_total += writeblock(&target, dst[b], N[b] * slice_bytes); //write the permuted data to the output file 547 wt_total += writeblock(&target, dst[b], N[b] * slice_bytes); //write the permuted data to the output file
548 y_proc += N[b]; //increment the counter of processed pixels 548 y_proc += N[b]; //increment the counter of processed pixels
549 if(PROGRESS) progress = (double)( y_proc + 1 ) / Y() * 100; //increment the progress counter based on the number of processed pixels 549 if(PROGRESS) progress = (double)( y_proc + 1 ) / Y() * 100; //increment the progress counter based on the number of processed pixels