def test_fat_rectangular_matrices_with_square_padding_with_lapack_driver(nrow): r"""Test Symmetric Procrustes with random wide matrices and non-default lapack driver.""" # generate random rectangular matrices ncol = np.random.randint(nrow + 1, nrow + 10) array_a, array_b = np.random.random((nrow, ncol)), np.random.random( (nrow, ncol)) # minimize objective function to find transformation matrix _, desired_func = minimize_one_transformation(array_a, array_b, ncol) res = symmetric(array_a, array_b, pad=True, lapack_driver="gesdd") # check results (solution is not uniqueness) assert_almost_equal(np.abs(res.error - desired_func), 0.0, decimal=5) assert_equal(res.s, None)
def test_random_tall_rectangular_matrices(ncol): r"""Test Symmetric Procrustes with random tall matrices.""" # generate random floats in [0.0, 1.0) interval nrow = np.random.randint(ncol, ncol + 10) array_a, array_b = np.random.random((nrow, ncol)), np.random.random( (nrow, ncol)) # minimize objective function to find transformation matrix desired, desired_func = minimize_one_transformation(array_a, array_b, ncol) # compute transformation & check results res = symmetric(array_a, array_b, unpad_col=True, unpad_row=True) assert_equal(res.s, None) assert_almost_equal(np.abs(res.error - desired_func), 0.0, decimal=5) assert_almost_equal(np.abs(res.t - desired), 0.0, decimal=3)