def assign(self, val):
    """Assign val to self, where val can be a scalar or a EigenMatrix
    with the same dimensions as self. """

    if isinstance(val, EigenMatrix):
      err_code = _eigenmat.copy_on_device(val.p_mat, self.p_mat)
    elif isinstance(val, (int, float)):
      err_code = _eigenmat.assign_scalar(self.p_mat, ct.c_float(val))
    else:
      raise ValueError, "Assigned value must be of type EigenMatrix, int, or float."
      
    if err_code:
      raise generate_exception(err_code)

    return self
Assign val to self, where val can be a scalar or a EigenMatrix
    with the same dimensions as self. 
eigenmat/eigenmat.py