def _diagonal(n, value):
    # TODO this should be replaced by a proper numpy call
    value = float(value)

    def eltAtIx(ix):
        if n % ix == ix / n:
            return value
        else:
            return 0.0

    vals = [eltAtIx(ix) for ix in xrange(n * n)]

    tr = numpy.array(vals)
    tr = tr.reshape((n, n))

    return tr
dataset/ETHPy150Open ufora/ufora/packages/python/pyfora/algorithms/logistic/FullRankMajorizationSolver.py/_diagonal/swapped operands of `%`