From 3a880d1c15d8014eec9d403db73911f7dce73309 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 14 Sep 2016 18:19:42 -0500 Subject: [PATCH] fixed PCA and BIP conversion bugs --- stim/envi/bip.h | 6 +++++- stim/envi/bsq.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stim/envi/bip.h b/stim/envi/bip.h index 703aa32..19bc1bd 100644 --- a/stim/envi/bip.h +++ b/stim/envi/bip.h @@ -1289,11 +1289,15 @@ public: stat = cublasSetVector((int)B, sizeof(double), s, 1, s_dev, 1); //copy the spectrum from the host to the device stat = cublasDaxpy(handle, (int)B, &axpy_alpha, center_dev, 1, s_dev, 1); //subtract the center (average) 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 - stat = cublasGetVector((int)B, sizeof(double), A_dev, 1, A, 1); //copy the projected pixel to the host (from GPU to CPU) + stat = cublasGetVector((int)M, sizeof(double), A_dev, 1, A, 1); //copy the projected pixel to the host (from GPU to CPU) + + //stat = cublasGetVector((int)B, sizeof(double), s_dev, 1, A, 1); //copy the projected pixel to the host (from GPU to CPU) //std::copy(A, A + M, temp); for(i = 0; i < M; i++) temp[i] = (T)A[i]; //casting projected pixel from double to whatever T is } + else + memset(temp, 0, sizeof(T) * M); target.write(reinterpret_cast(temp), sizeof(T) * M); //write the projected vector if(PROGRESS) progress = (double)(xy+1) / XY * 100; //record the current progress diff --git a/stim/envi/bsq.h b/stim/envi/bsq.h index f1911ae..6d894b0 100644 --- a/stim/envi/bsq.h +++ b/stim/envi/bsq.h @@ -543,7 +543,7 @@ public: } b = !b; //swap the double-buffer - pt_total += binary::permute(dst[b], src[b], X(), N[b], Z(), 0, 2, 1); //permute the batch to a BIL file + pt_total += binary::permute(dst[b], src[b], X(), N[b], Z(), 2, 0, 1); //permute the batch to a BIL file wt_total += writeblock(&target, dst[b], N[b] * slice_bytes); //write the permuted data to the output file y_proc += N[b]; //increment the counter of processed pixels if(PROGRESS) progress = (double)( y_proc + 1 ) / Y() * 100; //increment the progress counter based on the number of processed pixels -- libgit2 0.21.4