 
 ;; ======================== Engines ===========================================
 
-(deftype DoubleVectorEngine [cublas-handle modl]
+(deftype DoubleVectorEngine [cublas-handle modl hstream]
   BlockEngine
   (equals-block [_ x y]
-    (vector-equals modl ^CUBlockVector x ^CUBlockVector y))
+    (vector-equals modl hstream ^CUBlockVector x ^CUBlockVector y))
   Blas
   (swap [_ x y]
     (vector-method cublas-handle JCublas2/cublasDswap ^CUBlockVector x ^CUBlockVector y)

    y)
  BlasPlus
  (subcopy [_ x y kx lx ky]
    (vector-subcopy modl ^CUBlockVector x ^CUBlockVector y kx lx ky)
    y)
  (sum [_ x]
    (vector-sum modl ^CUBlockVector x))
  (imax [_ x]
    (throw (UnsupportedOperationException. "TODO.")))
  (imin [this x]
    (throw (UnsupportedOperationException. "TODO.")))
  (set-all [_ alpha x]
    (vector-set modl (double alpha) ^CUBlockVector x)
    x)
  (axpby [_ alpha x beta y]
    (vector-axpby modl (double alpha) x (double beta) y)
    y))

(deftype FloatVectorEngine [cublas-handle modl]
  BlockEngine
  (equals-block [_ x y]
    (vector-equals modl ^CUBlockVector x ^CUBlockVector y))
  Blas
  (swap [_ x y]
    (vector-method cublas-handle JCublas2/cublasSswap ^CUBlockVector x ^CUBlockVector y)

    c)
  BlasPlus
  (set-all [_ alpha a]
    (ge-set modl hstream (float alpha) a)
    a)
  (axpby [_ alpha a beta b]
    (ge-am cublas-handle JCublas2/cublasSgeam (float alpha) ^CUGEMatrix a (float beta) ^CUGEMatrix b)
    b))

(deftype DoubleTREngine [cublas-handle modl hstream]
  BlockEngine
  (equals-block [_ a b]
    (tr-equals modl hstream a b))
  Blas
  (swap [_ a b]
    (tr-map modl hstream "tr_swap" a b)
    a)
  (copy [_ a b]
    (tr-map modl hstream "tr_copy" a b)
    b)
  (scal [_ alpha a]
    (tr-set-scal modl hstream "tr_scal" (double alpha) a)
    a)
  (axpy [_ alpha a b]
    (tr-axpby modl hstream (double alpha) ^CUTRMatrix a (double 1.0) b)
    b)
  (mv [this alpha a x beta y]
    (tr-mv a))
