class_docstr: Multivariate Geometric Brownian Motion.
  
  Represents a d-dimensional Ito process:
  
  ```None
    dX_i(t) = means_i * X_i(t) * dt + volatilities_i * X_i(t) * dW_i(t),
    1 <= i <= d
  ```
  
  where `W(t) = (W_1(t), .., W_d(t))` is a d-dimensional Brownian motion with
  a correlation matrix `corr_matrix`, `means` and `volatilities` are `Tensor`s
  that correspond to mean and volatility of a Geometric Brownian Motion `X_i`
  
  ## Example
  
  ```python
  import tensorflow as tf
  import tf_quant_finance as tff
  corr_matrix = [[1, 0.1], [0.1, 1]]
  process = tff.models.MultivariateGeometricBrownianMotion(
      dim=2,
      means=1, volatilities=[0.1, 0.2],
      corr_matrix=corr_matrix,
      dtype=tf.float64)
  times = [0.1, 0.2, 1.0]
  initial_state=[1.0, 2.0]
  # Use SOBOL sequence to draw trajectories
  samples_sobol = process.sample_paths(
      times=times,
      initial_state=initial_state,
      random_type=tff.math.random.RandomType.SOBOL,
      num_samples=100000)
  
  # You can also supply the random normal draws directly to the sampler
  normal_draws = tf.random.stateless_normal(
      [100000, 3, 2], seed=[4, 2], dtype=tf.float64)
  samples_custom = process.sample_paths(
      times=times,
      initial_state=initial_state,
      normal_draws=normal_draws)
  ```
class_docstr_tok: ["Multivariate","Geometric","Brownian","Motion",".","Represents","a","d-dimensional","Ito","process",":","``","`","None","dX_i","(","t",")","=","means_i","*","X_i","(","t",")","*","dt","+","volatilities_i","*","X_i","(","t",")","*","dW_i","(","t",")",",","1","<","=","i","<","=","d","``","`","where","`","W","(","t",")","=","(","W_1","(","t",")",",","..",",","W_d","(","t",")",")","`","is","a","d-dimensional","Brownian","motion","with","a","correlation","matrix","`","corr_matrix","`",",","`","means","`","and","`","volatilities","`","are","`","Tensor","`","s","that","correspond","to","mean","and","volatility","of","a","Geometric","Brownian","Motion","`","X_i","`","#","#","Example","``","`","python","import","tensorflow","as","tf","import","tf_quant_finance","as","tff","corr_matrix","=","[","[","1",",","0.1","]",",","[","0.1",",","1","]","]","process","=","tff.models.MultivariateGeometricBrownianMotion","(","dim=2",",","means=1",",","volatilities=","[","0.1",",","0.2","]",",","corr_matrix=corr_matrix",",","dtype=tf.float64",")","times","=","[","0.1",",","0.2",",","1.0","]","initial_state=","[","1.0",",","2.0","]","#","Use","SOBOL","sequence","to","draw","trajectories","samples_sobol","=","process.sample_paths","(","times=times",",","initial_state=initial_state",",","random_type=tff.math.random.RandomType.SOBOL",",","num_samples=100000",")","#","You","can","also","supply","the","random","normal","draws","directly","to","the","sampler","normal_draws","=","tf.random.stateless_normal","(","[","100000",",","3",",","2","]",",","seed=","[","4",",","2","]",",","dtype=tf.float64",")","samples_custom","=","process.sample_paths","(","times=times",",","initial_state=initial_state",",","normal_draws=normal_draws",")","``","`"]
docstr: Initializes the Multivariate Geometric Brownian Motion.
  
  Args:
    dim: A Python scalar. The dimensionality of the process
    means:  A real `Tensor` of shape broadcastable to `[dim]`.
      Corresponds to the vector of means of the GBM components `X_i`.
    Default value: 0.0.
    volatilities: A `Tensor` of the same `dtype` as `means` and of shape
      broadcastable to `[dim]`. Corresponds to the volatilities of the GBM
      components `X_i`.
      Default value: 1.0.
    corr_matrix: An optional `Tensor` of the same `dtype` as `means` and of
      shape `[dim, dim]`. Correlation of the GBM components `W_i`.
      Default value: `None` which maps to a process with
      independent GBM components `X_i`.
    dtype: The default dtype to use when converting values to `Tensor`s.
      Default value: `None` which means that default dtypes inferred by
        TensorFlow are used.
    name: Python string. The name to give to the ops created by this class.
      Default value: `None` which maps to the default name
      'multivariate_geometric_brownian_motion'.
  Raises:
    ValueError: If `corr_matrix` is supplied and is not of shape `[dim, dim]`
docstr_tok: ["Initializes","the","Multivariate","Geometric","Brownian","Motion",".","Args",":","dim",":","A","Python","scalar",".","The","dimensionality","of","the","process","means",":","A","real","`","Tensor","`","of","shape","broadcastable","to","`","[","dim","]","`",".","Corresponds","to","the","vector","of","means","of","the","GBM","components","`","X_i","`",".","Default","value",":","0.0.","volatilities",":","A","`","Tensor","`","of","the","same","`","dtype","`","as","`","means","`","and","of","shape","broadcastable","to","`","[","dim","]","`",".","Corresponds","to","the","volatilities","of","the","GBM","components","`","X_i","`",".","Default","value",":","1.0.","corr_matrix",":","An","optional","`","Tensor","`","of","the","same","`","dtype","`","as","`","means","`","and","of","shape","`","[","dim",",","dim","]","`",".","Correlation","of","the","GBM","components","`","W_i","`",".","Default","value",":","`","None","`","which","maps","to","a","process","with","independent","GBM","components","`","X_i","`",".","dtype",":","The","default","dtype","to","use","when","converting","values","to","`","Tensor","`","s",".","Default","value",":","`","None","`","which","means","that","default","dtypes","inferred","by","TensorFlow","are","used",".","name",":","Python","string",".","The","name","to","give","to","the","ops","created","by","this","class",".","Default","value",":","`","None","`","which","maps","to","the","default","name","'multivariate_geometric_brownian_motion","'",".","Raises",":","ValueError",":","If","`","corr_matrix","`","is","supplied","and","is","not","of","shape","`","[","dim",",","dim","]","`"]
code: def __init__(
      self,
      dim,
      means=0.0,
      volatilities=1.0,
      corr_matrix=None,
      dtype=None,
      name=None,
  ):
      """Initializes the Multivariate Geometric Brownian Motion.
  
      Args:
        dim: A Python scalar. The dimensionality of the process
        means:  A real `Tensor` of shape broadcastable to `[dim]`.
          Corresponds to the vector of means of the GBM components `X_i`.
        Default value: 0.0.
        volatilities: A `Tensor` of the same `dtype` as `means` and of shape
          broadcastable to `[dim]`. Corresponds to the volatilities of the GBM
          components `X_i`.
          Default value: 1.0.
        corr_matrix: An optional `Tensor` of the same `dtype` as `means` and of
          shape `[dim, dim]`. Correlation of the GBM components `W_i`.
          Default value: `None` which maps to a process with
          independent GBM components `X_i`.
        dtype: The default dtype to use when converting values to `Tensor`s.
          Default value: `None` which means that default dtypes inferred by
            TensorFlow are used.
        name: Python string. The name to give to the ops created by this class.
          Default value: `None` which maps to the default name
          'multivariate_geometric_brownian_motion'.
      Raises:
        ValueError: If `corr_matrix` is supplied and is not of shape `[dim, dim]`
      """
      self._name = name or "multivariate_geometric_brownian_motion"
      with tf.name_scope(self._name):
          self._means = tf.convert_to_tensor(
              means, dtype=dtype, name="means"
          )
          self._dtype = self._means.dtype
          self._vols = tf.convert_to_tensor(
              volatilities, dtype=self._dtype, name="volatilities"
          )
          self._dim = dim
          if corr_matrix is None:
              self._corr_matrix = None
          else:
              self._corr_matrix = tf.convert_to_tensor(
                  corr_matrix, dtype=self._dtype, name="corr_matrix"
              )
              if self._corr_matrix.shape.as_list() != [dim, dim]:
                  raise ValueError(
                      "`corr_matrix` must be of shape [{0}, {0}] but is "
                      "of shape {1}".format(
                          dim, self._corr_matrix.shape.as_list()
                      )
                  )
  
file_path: tf-quant-finance/tf_quant_finance/models/geometric_brownian_motion/multivariate_geometric_brownian_motion.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import utils
  from tf_quant_finance.math.pde import fd_solvers
  from tf_quant_finance.models import ito_process
  from tf_quant_finance.models import utils
label_desc: Use image node_id 1 to create a new MultivariateGeometricBrownianMotion object from inherited base classes: ito_process with example: obj = MultivariateGeometricBrownianMotion(dim, means, volatilities, corr_matrix, dtype, name)