 #include "float.h"
 
 
-// Converts a double to a float and stores the result back in the dst pointer.
+// Converts a double to a float and stores the result back in the dest pointer.
 // The float is downcast, discarding the least significant bits in the double.
 //
 // This is useful because CUDA prefers floats for its computations, while
 // Matlab defaults to doubles.
-void double_to_float(float* dst, double* src, const int n) {
+void double_to_float(float* dest, double* source, const int n) {
 	for (int i = 0; i < n; ++i)
-		dst[i] = (float) src[i];
-}
-
+		dest[i] = (float) source[i];
+}
 
 
 // Convert an unsigned char (or a uint8 in Matlab's type name scheme) to a
-// float and store the result to dst. The char is converted to the nearest
+// float and store the result to dest. The char is converted to the nearest
 // float. For example, 8 becomes 8.0. 
-void uint8_to_float(float* dst, unsigned char* src, const int n) {
+void uint8_to_float(float* dest, unsigned char* source, const int n) {
 	for (int i = 0; i < n; ++i)
-		dst[i] = (float) src[i];
-}
-
-
+		dest[i] = (float) source[i];
+}
 
 
 // Performs integer division, but rounds up if the division is not exact.

}




// Returns a * sc, where a is a complex-valued float and sc is a scalar.
// This device kernel can only runs on a CUDA device.
__device__ cufftComplex complexScale32(cufftComplex a, float sc)
{
	cufftComplex tempResult;
	tempResult.x = a.x*sc;
	tempResult.y = a.y*sc;

//     --> reconstructed_image
//   
//   filter reconstructed_image with a gradient filter ("steerable derivative")
//     --> "gradient_magnitude_gpu" (steerable filter magnitude)
//   inverting reconstructed_image so that objects are bright and background
//     is dark -> dark_field_image
//   compute a focus metric, sim = gradient_magnitude_gpu * dark_field_image
//
//   compare the value of the focus metric for this z slice against the prior
//     best focus metric, keeping track of which z slice maximimizes the focus
