Ejemplo n.º 1
0
    def sub(self, other, nb_cpu=1):
        """Subtract two RleDicts.

        Same as -, but sub takes nb_cpu argument."""

        return m.binary_operation("sub", self, other, nb_cpu)
Ejemplo n.º 2
0
    def mul(self, other, nb_cpu=1):
        """Multiply two RleDicts.

        Same as *, but mul takes nb_cpu argument."""

        return m.binary_operation("mul", self, other, nb_cpu)
Ejemplo n.º 3
0
    def div(self, other, nb_cpu=1):
        """Divide two RleDicts.

        Same as /, but div takes nb_cpu argument."""

        return m.binary_operation("div", self, other, nb_cpu)
Ejemplo n.º 4
0
    def add(self, other, nb_cpu=1):
        """Add two RleDicts.

        Same as +, but add takes nb_cpu argument."""

        return m.binary_operation("add", self, other, nb_cpu)
Ejemplo n.º 5
0
    def __truediv__(self, other):

        if isinstance(other, Number):
            return RleDict({cs: v / other for cs, v in self.items()})

        return m.binary_operation("div", self, other)
Ejemplo n.º 6
0
    def __sub__(self, other):

        if isinstance(other, Number):
            return RleDict({cs: v - other for cs, v in self.items()})

        return m.binary_operation("sub", self, other)