title: How to use both "double" functions and "single" functions from Intel MKL (cblas)
body: <p>The C interface to blas (I am using Intel MKL) has different functions for  operating on input data of the single datatype and the double datatype.  For example, <code>cblas_dgemm</code> vs. <code>cblas_sgemm</code>.  </p>
  
  <p>I wrote a program that uses these functions extensively.  I would like the user to have the option of using single precision or double precision for their calculations.  This simply means that every place where it says dgemm should be sgemm (and so forth for other functions).  I do not want to copy all the code and replace all sgemm for dgemm.  How can I most elegantly provide both functionalities to the user without having two copies of the same code?</p>
  
  <p>One potential solution would be replace all instances of cblas_dgemm with cblas_gemm, and use macros to #define cblas_gemm as either cblas_dgemm or cblas_sgemm depending on a g++ compiler flag <code>-DDATATYPE_SINGLE</code> or <code>-DDATATYPE_DOUBLE</code>.  Then, there would be two different executables, with the same code base.  Is this the best solution?</p>