class_docstr: Covariance of a random matrix probability expression.
  
  Examples
  ========
  
  >>> from sympy.stats import CrossCovarianceMatrix
  >>> from sympy.stats.rv import RandomMatrixSymbol
  >>> from sympy import symbols, MatrixSymbol
  >>> k = symbols("k")
  >>> A, B = MatrixSymbol("A", k, k), MatrixSymbol("B", k, k)
  >>> C, D = MatrixSymbol("C", k, k), MatrixSymbol("D", k, k)
  >>> X, Y = RandomMatrixSymbol("X", k, 1), RandomMatrixSymbol("Y", k, 1)
  >>> Z, W = RandomMatrixSymbol("Z", k, 1), RandomMatrixSymbol("W", k, 1)
  >>> CrossCovarianceMatrix(X, Y)
  CrossCovarianceMatrix(X, Y)
  >>> CrossCovarianceMatrix(X, Y).shape
  (k, k)
  
  To expand the covariance in its expression, use ``expand()``:
  
  >>> CrossCovarianceMatrix(X + Y, Z).expand()
  CrossCovarianceMatrix(X, Z) + CrossCovarianceMatrix(Y, Z)
  >>> CrossCovarianceMatrix(A*X, Y).expand()
  A*CrossCovarianceMatrix(X, Y)
  >>> CrossCovarianceMatrix(A*X, B.T*Y).expand()
  A*CrossCovarianceMatrix(X, Y)*B
  >>> CrossCovarianceMatrix(A*X + B*Y, C.T*Z + D.T*W).expand()
  A*CrossCovarianceMatrix(X, W)*D + A*CrossCovarianceMatrix(X, Z)*C + B*CrossCovarianceMatrix(Y, W)*D + B*CrossCovarianceMatrix(Y, Z)*C
class_docstr_tok: ["Covariance","of","a","random","matrix","probability","expression",".","Examples","========",">",">",">","from","sympy.stats","import","CrossCovarianceMatrix",">",">",">","from","sympy.stats.rv","import","RandomMatrixSymbol",">",">",">","from","sympy","import","symbols",",","MatrixSymbol",">",">",">","k","=","symbols","(","``","k","''",")",">",">",">","A",",","B","=","MatrixSymbol","(","``","A","''",",","k",",","k",")",",","MatrixSymbol","(","``","B","''",",","k",",","k",")",">",">",">","C",",","D","=","MatrixSymbol","(","``","C","''",",","k",",","k",")",",","MatrixSymbol","(","``","D","''",",","k",",","k",")",">",">",">","X",",","Y","=","RandomMatrixSymbol","(","``","X","''",",","k",",","1",")",",","RandomMatrixSymbol","(","``","Y","''",",","k",",","1",")",">",">",">","Z",",","W","=","RandomMatrixSymbol","(","``","Z","''",",","k",",","1",")",",","RandomMatrixSymbol","(","``","W","''",",","k",",","1",")",">",">",">","CrossCovarianceMatrix","(","X",",","Y",")","CrossCovarianceMatrix","(","X",",","Y",")",">",">",">","CrossCovarianceMatrix","(","X",",","Y",")",".shape","(","k",",","k",")","To","expand","the","covariance","in","its","expression",",","use","``","expand","(",")","``",":",">",">",">","CrossCovarianceMatrix","(","X","+","Y",",","Z",")",".expand","(",")","CrossCovarianceMatrix","(","X",",","Z",")","+","CrossCovarianceMatrix","(","Y",",","Z",")",">",">",">","CrossCovarianceMatrix","(","A","*","X",",","Y",")",".expand","(",")","A","*","CrossCovarianceMatrix","(","X",",","Y",")",">",">",">","CrossCovarianceMatrix","(","A","*","X",",","B.T","*","Y",")",".expand","(",")","A","*","CrossCovarianceMatrix","(","X",",","Y",")","*","B",">",">",">","CrossCovarianceMatrix","(","A","*","X","+","B","*","Y",",","C.T","*","Z","+","D.T","*","W",")",".expand","(",")","A","*","CrossCovarianceMatrix","(","X",",","W",")","*","D","+","A","*","CrossCovarianceMatrix","(","X",",","Z",")","*","C","+","B","*","CrossCovarianceMatrix","(","Y",",","W",")","*","D","+","B","*","CrossCovarianceMatrix","(","Y",",","Z",")","*","C"]
code: def __new__(cls, arg1, arg2, condition=None):
      arg1 = _sympify(arg1)
      arg2 = _sympify(arg2)
  
      if (
          (1 not in arg1.shape)
          or (1 not in arg2.shape)
          or (arg1.shape[1] != arg2.shape[1])
      ):
          raise ShapeError("Expression is not a vector")
  
      shape = (
          (arg1.shape[0], arg2.shape[0])
          if arg1.shape[1] == 1 and arg2.shape[1] == 1
          else (1, 1)
      )
  
      if condition:
          obj = Expr.__new__(cls, arg1, arg2, condition)
      else:
          obj = Expr.__new__(cls, arg1, arg2)
  
      obj._shape = shape
      obj._condition = condition
      return obj
  
imports: import itertools
  from sympy.core.add import Add
  from sympy.core.expr import Expr
  from sympy.core.function import expand
  from sympy.core.mul import Mul
  from sympy.core.singleton import S
  from sympy.matrices.exceptions import ShapeError
  from sympy.matrices.expressions.matexpr import MatrixExpr
  from sympy.matrices.expressions.matmul import MatMul
  from sympy.matrices.expressions.special import ZeroMatrix
  from sympy.stats.rv import RandomSymbol, is_random
  from sympy.core.sympify import _sympify
  from sympy.stats.symbolic_probability import Variance, Covariance, Expectation
label_desc: Use image node_id 1 for calling the CrossCovarianceMatrix obj's underlying member method code with example usage: obj.__new__(cls, arg1, arg2, condition) and returns: obj