@staticmethod
def _min_norm_2d(vecs: list, dps):
    '\n        Find the minimum norm solution as combination of two points\n        This is correct only in 2D\n        ie. min_c |\\sum c_i x_i|_2^2 st. \\sum c_i = 1 , 1 >= c_1 >= 0\n        for all i, c_i + c_j = 1.0 for some i, j\n        '
    dmin = 100000000.0
    sol = 0
    for i in range(len(vecs)):
        for j in range((i + 1), len(vecs)):
            if ((i, j) not in dps):
                dps[(i, j)] = 0.0
                for k in range(len(vecs[i])):
                    dps[(i, j)] += torch.dot(vecs[i][k].view((- 1)), vecs[j][k].view((- 1))).detach()
                dps[(j, i)] = dps[(i, j)]
            if ((i, i) not in dps):
                dps[(i, i)] = 0.0
                for k in range(len(vecs[i])):
                    dps[(i, i)] += torch.dot(vecs[i][k].view((- 1)), vecs[i][k].view((- 1))).detach()
            if ((j, j) not in dps):
                dps[(j, j)] = 0.0
                for k in range(len(vecs[i])):
                    dps[(j, j)] += torch.dot(vecs[j][k].view((- 1)), vecs[j][k].view((- 1))).detach()
            (c, d) = MGDASolver._min_norm_element_from2(dps[(i, i)], dps[(i, j)], dps[(j, j)])
            if (d < dmin):
                dmin = d
                sol = [(i, j), c, d]
    return (sol, dps)
Find the minimum norm solution as combination of two points
This is correct only in 2D
ie. min_c |\sum c_i x_i|_2^2 st. \sum c_i = 1 , 1 >= c_1 >= 0
for all i, c_i + c_j = 1.0 for some i, j
@staticmethod
def _min_norm_2d(vecs: list, dps):
    '\n        Find the minimum norm solution as combination of two points\n        This is correct only in 2D\n        ie. min_c |\\sum c_i x_i|_2^2 st. \\sum c_i = 1 , 1 >= c_1 >= 0\n        for all i, c_i + c_j = 1.0 for some i, j\n        '
    dmin = 100000000.0
    sol = 0
    for i in range(len(vecs)):
        for j in range((i + 1), len(vecs)):
            if ((i, j) not in dps):
                dps[(i, j)] = 0.0
                for k in range(len(vecs[i])):
                    dps[(i, j)] += torch.dot(vecs[i][k].view((- 1)), vecs[j][k].view((- 1))).detach()
                dps[(j, i)] = dps[(i, j)]
            if ((i, i) not in dps):
                dps[(i, i)] = 0.0
                for k in range(len(vecs[i])):
                    dps[(i, i)] += torch.dot(vecs[i][k].view((- 1)), vecs[i][k].view((- 1))).detach()
            if ((j, j) not in dps):
                dps[(j, j)] = 0.0
                for k in range(len(vecs[i])):
                    dps[(j, j)] += torch.dot(vecs[j][k].view((- 1)), vecs[j][k].view((- 1))).detach()
            (c, d) = MGDASolver._min_norm_element_from2(dps[(i, i)], dps[(i, j)], dps[(j, j)])
            if (d < dmin):
                dmin = d
                sol = [(i, j), c, d]
    return (sol, dps)