'Upcast matrix to a floating point format (if necessary)'

def asfptype(self):

    fp_types = ['f', 'd', 'F', 'D']
    if (self.dtype.char in fp_types):
        return self
    else:
        for fp_type in fp_types:
            if (self.dtype <= np.dtype(fp_type)):
                return self.astype(fp_type)
        raise TypeError(('cannot    upcast    [%s]    to    a    floating    point    format' % self.dtype.name))
