X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=test%2Frandomgen.py;h=8c5ebfcbbfa24dd4e99929940bb56424839fbf87;hb=2b44481f8a79cbab75ddc0f73eea813b66e17d62;hp=9fee2f749cbcf8037f2c64d41fe42e17731381a4;hpb=10dfe7d7edb69701dd8f4f955f3f325706d77e47;p=dunshire.git diff --git a/test/randomgen.py b/test/randomgen.py index 9fee2f7..8c5ebfc 100644 --- a/test/randomgen.py +++ b/test/randomgen.py @@ -407,16 +407,16 @@ def random_ll_orthant_game(): """ G = random_orthant_game() - L = random_diagonal_matrix(G._K.dimension()) + L = random_diagonal_matrix(G.dimension()) # Replace the totally-random ``L`` with random Lyapunov-like one. - G = SymmetricLinearGame(L, G._K, G._e1, G._e2) + G = SymmetricLinearGame(L, G.K(), G.e1(), G.e2()) while G.condition() > MAX_COND: # Try again until the condition number is satisfactory. G = random_orthant_game() - L = random_diagonal_matrix(G._K.dimension()) - G = SymmetricLinearGame(L, G._K, G._e1, G._e2) + L = random_diagonal_matrix(G.dimension()) + G = SymmetricLinearGame(L, G.K(), G.e1(), G.e2()) return G @@ -445,16 +445,16 @@ def random_ll_icecream_game(): """ G = random_icecream_game() - L = random_lyapunov_like_icecream(G._K.dimension()) + L = random_lyapunov_like_icecream(G.dimension()) # Replace the totally-random ``L`` with random Lyapunov-like one. - G = SymmetricLinearGame(L, G._K, G._e1, G._e2) + G = SymmetricLinearGame(L, G.K(), G.e1(), G.e2()) while G.condition() > MAX_COND: # Try again until the condition number is satisfactory. G = random_icecream_game() - L = random_lyapunov_like_icecream(G._K.dimension()) - G = SymmetricLinearGame(L, G._K, G._e1, G._e2) + L = random_lyapunov_like_icecream(G.dimension()) + G = SymmetricLinearGame(L, G.K(), G.e1(), G.e2()) return G @@ -485,16 +485,16 @@ def random_positive_orthant_game(): """ G = random_orthant_game() - L = random_nonnegative_matrix(G._K.dimension()) + L = random_nonnegative_matrix(G.dimension()) # Replace the totally-random ``L`` with the random nonnegative one. - G = SymmetricLinearGame(L, G._K, G._e1, G._e2) + G = SymmetricLinearGame(L, G.K(), G.e1(), G.e2()) while G.condition() > MAX_COND: # Try again until the condition number is satisfactory. G = random_orthant_game() - L = random_nonnegative_matrix(G._K.dimension()) - G = SymmetricLinearGame(L, G._K, G._e1, G._e2) + L = random_nonnegative_matrix(G.dimension()) + G = SymmetricLinearGame(L, G.K(), G.e1(), G.e2()) return G @@ -526,21 +526,21 @@ def random_nn_scaling(G): >>> (alpha, H) = random_nn_scaling(G) >>> alpha >= 0 True - >>> G._K == H._K + >>> G.K() == H.K() True - >>> norm(G._e1 - H._e1) < ABS_TOL + >>> norm(G.e1() - H.e1()) < ABS_TOL True - >>> norm(G._e2 - H._e2) < ABS_TOL + >>> norm(G.e2() - H.e2()) < ABS_TOL True """ alpha = random_nn_scalar() - H = SymmetricLinearGame(alpha*G._L.trans(), G._K, G._e1, G._e2) + H = SymmetricLinearGame(alpha*G.L().trans(), G.K(), G.e1(), G.e2()) while H.condition() > MAX_COND: # Loop until the condition number of H doesn't suck. alpha = random_nn_scalar() - H = SymmetricLinearGame(alpha*G._L.trans(), G._K, G._e1, G._e2) + H = SymmetricLinearGame(alpha*G.L().trans(), G.K(), G.e1(), G.e2()) return (alpha, H) @@ -571,23 +571,23 @@ def random_translation(G): >>> from dunshire.options import ABS_TOL >>> G = random_orthant_game() >>> (alpha, H) = random_translation(G) - >>> G._K == H._K + >>> G.K() == H.K() True - >>> norm(G._e1 - H._e1) < ABS_TOL + >>> norm(G.e1() - H.e1()) < ABS_TOL True - >>> norm(G._e2 - H._e2) < ABS_TOL + >>> norm(G.e2() - H.e2()) < ABS_TOL True """ alpha = random_scalar() - tensor_prod = G._e1 * G._e2.trans() - M = G._L + alpha*tensor_prod + tensor_prod = G.e1() * G.e2().trans() + M = G.L() + alpha*tensor_prod - H = SymmetricLinearGame(M.trans(), G._K, G._e1, G._e2) + H = SymmetricLinearGame(M.trans(), G.K(), G.e1(), G.e2()) while H.condition() > MAX_COND: # Loop until the condition number of H doesn't suck. alpha = random_scalar() - M = G._L + alpha*tensor_prod - H = SymmetricLinearGame(M.trans(), G._K, G._e1, G._e2) + M = G.L() + alpha*tensor_prod + H = SymmetricLinearGame(M.trans(), G.K(), G.e1(), G.e2()) return (alpha, H)