Example #1
0
    def __add__(self, other):
        if is_number(other):
            fcmap = self.fc_dct.copy()
            fcmap[(0, 0, 0)] = self.fc_dct[(0, 0, 0)] + other
            cuspidal = other == 0 and self._is_cuspidal
            return QexpLevel1(fcmap, self.prec, self.base_ring,
                              is_cuspidal=cuspidal)

        prec = common_prec([self, other])
        bsring = _common_base_ring(self.base_ring, other.base_ring)
        cuspidal = self._is_cuspidal and other._is_cuspidal
        ms = self.fc_dct
        mo = other.fc_dct
        fcmap = _add_fourier(ms, mo, prec, cuspidal)
        return QexpLevel1(fcmap, prec, base_ring=bsring,
                          is_cuspidal=cuspidal)
Example #2
0
    def __add__(self, other):
        if is_number(other):
            fcmap = self.fc_dct.copy()
            fcmap[(0, 0, 0)] = self.fc_dct[(0, 0, 0)] + other
            if other == 0:
                return ModFormQexpLevel1(self.wt, fcmap, self.prec,
                                         self.base_ring,
                                         is_cuspidal=self._is_cuspidal)
            else:
                return QexpLevel1(fcmap, self.prec, self.base_ring)

        if is_hol_mod_form(other) and self.wt == other.wt:
            prec = common_prec([self, other])
            bsring = _common_base_ring(self.base_ring, other.base_ring)
            ms = self.fc_dct
            mo = other.fc_dct
            cuspidal = self._is_cuspidal and other._is_cuspidal
            fcmap = _add_fourier(ms, mo, prec, cuspidal=cuspidal,
                                 hol=True)
            return ModFormQexpLevel1(self.wt, fcmap, prec, bsring,
                                     is_cuspidal=cuspidal,
                                     given_reduced_tuples_only=True)
        else:
            return QexpLevel1.__add__(self, other)