def dfmatmul()

in spotify_confidence/analysis/confidence_utils.py [0:0]


def dfmatmul(x, y, outer=True):
    x = np.atleast_2d(x)
    y = np.atleast_2d(y)
    if x.shape[0] < x.shape[1]:
        x = x.transpose()
    if y.shape[0] < y.shape[1]:
        y = y.transpose()

    if outer:
        out = np.matmul(x, np.transpose(y))
    else:
        out = np.matmul(np.transpose(x), y)

    if out.size == 1:
        out = out.item()
    return out