(self, f)
return new
Return a copy of self with the function `f` applied elementwise.
Return a copy of self with the function `f` applied elementwise.
Return a copy of self with the function f applied elementwise .
def apply(self, f):
        """
        Return a copy of self with the function `f` applied elementwise.
        """
        new = self.ctx.matrix(self.__rows, self.__cols)
        for i in xrange(self.__rows):
            for j in xrange(self.__cols):
                new[i,j] = f(self[i,j])
        return new
def apply ( self , f ) : new = self . ctx . matrix ( self . __rows , self . __cols ) for i in xrange ( self . __rows ) : for j in xrange ( self . __cols ) : new [ i , j ] = f ( self [ i , j ] ) return new