Problem with division

Issue #121 resolved
Benoit NENNIG created an issue

Hi,

When I use

B=A/2.

with A an aij matrix, I observe that B = 2*A. I got the same with

B=A.__div__(2)

I seems that petscmat.pxi call self.scale function for multiplication and division.

cdef Mat mat_imul(Mat self, other):
    if (isinstance(other, tuple) or
        isinstance(other, list)):
        L, R = other
        self.diagonalScale(L, R)
    else:
        self.scale(other)  # <---------there
    return self

cdef Mat mat_idiv(Mat self, other):
    if isinstance(other, (tuple, list)):
        L, R = other
        if isinstance(L, Vec):
            L = L.copy()
            L.reciprocal()
        if isinstance(R, Vec):
            R = R.copy()
            R.reciprocal()
        self.diagonalScale(L, R)
    else:
        self.scale(other) # <---------there
    return self

Best regards,

Benoit

Comments (2)

  1. Log in to comment