(self, scalar)
return M
Scalar element-wise multiplication
Scalar element-wise multiplication
Scalar element - wise multiplication
def scalar_multiply(self, scalar):
        "Scalar element-wise multiplication"
        M = self.zeros(*self.shape)
        if scalar:
            for i in self._smat:
                v = scalar*self._smat[i]
                if v:
                    M._smat[i] = v
                else:
                    M._smat.pop(i, None)
        return M
def scalar_multiply ( self , scalar ) : M = self . zeros ( * self . shape ) if scalar : for i in self . _smat : v = scalar * self . _smat [ i ] if v : M . _smat [ i ] = v else : M . _smat . pop ( i , None ) return M