def dot(m1, m2, mult=1.0, target=None):
 if (not target):
  m = _cudamat.get_leading_dimension(m1.p_mat)
  n = _cudamat.get_nonleading_dimension(m2.p_mat)
  target = empty((m, n))
 err_code = _cudamat.dot(m1.p_mat, m2.p_mat, target.p_mat, ct.c_float(0.0), ct.c_float(mult))
 if err_code:
  raise generate_exception(err_code)
 return target

def dot ( m1 , m2 , mult = 1.0 , target = None ) : if ( not target ) : m = _cudamat . get_leading_dimension ( m1 . p_mat ) n = _cudamat . get_nonleading_dimension ( m2 . p_mat ) target = empty ( ( m , n ) ) err_code = _cudamat . dot ( m1 . p_mat , m2 . p_mat , target . p_mat , ct . c_float ( 0.0 ) , ct . c_float ( mult ) ) if err_code : raise generate_exception ( err_code ) return target
operation for efficiently calculating the dot product when one or all operands is sparse .