   magma_sgeev(MagmaNoVec, jobvr, n, a_data, n, wr, wi, NULL, 1, vr_data, ldvr, &wkopt, -1, &info);
 
   int lwork = (int) wkopt;
-  float *work_data = th_magma_smalloc_pinned(lwork);
+  float *work_data = th_magma_malloc_pinned<float>(lwork);
 
   magma_sgeev(MagmaNoVec, jobvr, n, a_data, n, wr, wi, NULL, 1, vr_data, ldvr, work_data, lwork, &info);
 

  float *input_data = THCudaTensor_data(state, input);

  // eigen values and workspace
  float *w = th_magma_smalloc_pinned(n);
  float *wA = th_magma_smalloc_pinned(lda);

  // compute optimal size of work array
  int info;

  int liwork;
  magma_ssyevd_gpu(jobz, uplo, n, input_data, lda, w, wA, n, &lwork, -1, &liwork, -1, &info);

  float *work = th_magma_malloc_pinned<float>((size_t)lwork);
  int *iwork = th_magma_malloc_pinned<int>(liwork);

  // compute eigenvalues and, optionally, eigenvectors
  magma_ssyevd_gpu(jobz, uplo, n, input_data, lda, w, wA, n, work, (int) lwork, iwork, liwork, &info);
