def _transform_iall(degree, bias, XP, X, multiply, final):
    """Computes the polynomial features"""
    if bias:
        XP[:, (0)] = 1
        pos = 1
    else:
        pos = 0
    n = X.shape[1]
    for d in range(0, degree):
        if d == 0:
            XP[:, pos:pos + n] = X
            index = list(range(pos, pos + n))
            pos += n
            index.append(pos)
        else:
            new_index = []
            end = index[-1]
            for i in range(0, n):
                a = index[i]
                new_index.append(pos)
                new_pos = pos + end - a
                multiply(XP[:, a:end], X[:, i:i + 1], XP[:, pos:new_pos])
                pos = new_pos
            new_index.append(pos)
            index = new_index
    return final(XP)
