docstr: Randomly generate a constant SPD LinearOperator.
docstr_tok: ["Randomly","generate","a","constant","SPD","LinearOperator","."]
code: def _random_constant_spd_linop(
      self,
      event_size,
      batch_shape=(),
      conditioning=1.2,
      dtype=np.float32,
  ):
      """Randomly generate a constant SPD LinearOperator."""
      # The larger conditioning is, the better posed the matrix is.
      # With conditioning = 1, it will be on the edge of singular, and likely
      # numerically singular if event_size is large enough.
      # Conditioning on the small side is best, since then the matrix is not so
      # diagonally dominant, and we therefore test use of transpositions better.
      assert conditioning >= 1
  
      scale_wishart = wishart.WishartLinearOperator(
          df=dtype(conditioning * event_size),
          scale=tf.linalg.LinearOperatorIdentity(
              event_size, dtype=dtype
          ),
          input_output_cholesky=False,
      )
      # Make sure to evaluate here. This ensures that the linear operator is a
      # constant rather than a random operator.
      matrix = self.evaluate(
          scale_wishart.sample(batch_shape, seed=test_util.test_seed())
      )
      return tf.linalg.LinearOperatorFullMatrix(
          matrix, is_positive_definite=True, is_self_adjoint=True
      )
  
file_path: probability/tensorflow_probability/python/experimental/distributions/mvn_precision_factor_linop_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import wishart
  from tensorflow_probability.python.experimental.distributions import mvn_precision_factor_linop
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_combinations
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.stats import sample_stats
label_desc: Use image node_id 1 for calling the MVNPrecisionFactorLinOpTest obj's underlying member method code with example usage: obj._random_constant_spd_linop(event_size, batch_shape, conditioning, dtype) and returns: tf