<!--
This file is generated by a tool. Do not edit directly.
For open-source contributions the docs will be updated automatically.
-->

*Last updated: 2023-03-16.*

<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf_quant_finance.math.qmc.sobol_generating_matrices" />
<meta itemprop="path" content="Stable" />
</div>

# tf_quant_finance.math.qmc.sobol_generating_matrices

<!-- Insert buttons and diff -->

<table class="tfo-notebook-buttons tfo-api" align="left">
</table>

<a target="_blank" href="https://github.com/paolodelia99/tf-quant-finance/blob/main/tf_quant_finance/math/qmc/sobol.py">View source</a>



Returns Sobol generating matrices.

```python
tf_quant_finance.math.qmc.sobol_generating_matrices(
    dim, num_results, num_digits, validate_args=False, dtype=None, name=None
)
```



<!-- Placeholder for "Used in" -->

#### Examples

```python
import tf_quant_finance as tff

# Example: Creating the 4D Sobol generating matrices.

dim = 4
num_results = 500
num_digits = 9

tff.math.qmc.sobol_generating_matrices(dim, num_results, num_digits)
# ==> tf.Tensor([
#             [256, 128,  64,  32,  16,   8,   4,   2,   1],
#             [256, 384, 320, 480, 272, 408, 340, 510, 257],
#             [256, 384, 192, 288, 464, 184, 284, 394, 209],
#             [256, 384,  64, 160, 496, 232, 324, 294, 433],
#         ], shape=(4, 9), dtype=int32)
```

#### Args:


* <b>`dim`</b>: Positive scalar `Tensor` of integers with rank 0. The event size of
  points which can be sampled from the resulting generating matrices.
* <b>`num_results`</b>: Positive scalar `Tensor` of integers with rank 0. The maximum
  number of points which can be sampled from the resulting generating
  matrices.
* <b>`num_digits`</b>: Positive scalar `Tensor` of integers with rank 0. The base-2
  precision of points which can be sampled from the resulting generating
  matrices.
* <b>`validate_args`</b>: Python `bool` indicating whether to validate arguments.
  Default value: `False`.
* <b>`dtype`</b>: Optional `dtype`. The `dtype` of the output `Tensor` (either a signed
  or unsigned integer `dtype`).
  Default value: `None` which maps to `int32`.
* <b>`name`</b>: Python `str` name prefixed to ops created by this function.
  Default value: `None` which maps to `sobol_generating_matrices`.


#### Returns:

A scalar `Tensor` with shape `(dim, log_num_results)` where
`log_num_results = ceil(log2(num_results))`.
