Exemple #1
0
 def matrix_pair(self, rng, size, size_inner):
     factor_matrix = rng.standard_normal((size, size_inner))
     inner_symmetric_matrix = rng.standard_normal((size_inner, size_inner))
     inner_symmetric_matrix = inner_symmetric_matrix + inner_symmetric_matrix.T
     symmetric_matrix = rng.standard_normal((size, size))
     symmetric_matrix = symmetric_matrix + symmetric_matrix.T
     return (
         matrices.SymmetricLowRankUpdateMatrix(
             matrices.DenseRectangularMatrix(factor_matrix),
             matrices.DenseSymmetricMatrix(symmetric_matrix),
             matrices.DenseSymmetricMatrix(inner_symmetric_matrix),
         ),
         symmetric_matrix
         + factor_matrix @ (inner_symmetric_matrix @ factor_matrix.T),
     )
Exemple #2
0
 def __init__(self):
     matrix_pairs = {}
     rng = np.random.RandomState(SEED)
     for sz in SIZES:
         array = rng.standard_normal((sz, sz))
         array = array + array.T
         matrix_pairs[sz] = (matrices.DenseSymmetricMatrix(array), array)
     super().__init__(matrix_pairs, rng)
Exemple #3
0
 def matrix_pair(self, rng, size, n_block):
     arrays = [rng.standard_normal((size, size)) for _ in range(n_block)]
     arrays = [arr + arr.T for arr in arrays]
     return (
         matrices.SymmetricBlockDiagonalMatrix(
             matrices.DenseSymmetricMatrix(arr) for arr in arrays
         ),
         sla.block_diag(*arrays),
     )
Exemple #4
0
 def __init__(self):
     matrix_pairs = {}
     rng = np.random.RandomState(SEED)
     for outer_dim in SIZES:
         for inner_dim in [max(1, outer_dim // 2), max(1, outer_dim - 1)]:
             factor_matrix = rng.standard_normal((outer_dim, inner_dim))
             inner_symmetric_matrix = rng.standard_normal(
                 (inner_dim, inner_dim))
             inner_symmetric_matrix = (inner_symmetric_matrix +
                                       inner_symmetric_matrix.T)
             symmetric_matrix = rng.standard_normal((outer_dim, outer_dim))
             symmetric_matrix = symmetric_matrix + symmetric_matrix.T
             matrix_pairs[(inner_dim, outer_dim)] = (
                 matrices.SymmetricLowRankUpdateMatrix(
                     matrices.DenseRectangularMatrix(factor_matrix),
                     matrices.DenseSymmetricMatrix(symmetric_matrix),
                     matrices.DenseSymmetricMatrix(inner_symmetric_matrix)),
                 symmetric_matrix +
                 factor_matrix @ (inner_symmetric_matrix @ factor_matrix.T))
     super().__init__(matrix_pairs, rng)
Exemple #5
0
 def __init__(self):
     matrix_pairs = {}
     rng = np.random.RandomState(SEED)
     for s in SIZES:
         for n_block in [1, 2, 5]:
             arrays = [rng.standard_normal((s, s)) for _ in range(n_block)]
             arrays = [arr + arr.T for arr in arrays]
             matrix_pairs[(s, n_block)] = (
                 matrices.SymmetricBlockDiagonalMatrix(
                     matrices.DenseSymmetricMatrix(arr)
                     for arr in arrays), sla.block_diag(*arrays))
     super().__init__(matrix_pairs, rng)
Exemple #6
0
 def matrix_pair(self, rng, size):
     array = rng.standard_normal((size, size))
     array = array + array.T
     return matrices.DenseSymmetricMatrix(array), array