Last updated: 2023-03-16.
tf_quant_finance.math.qmc.scramble_generating_matrices#
Scrambles a generating matrix.
tf_quant_finance.math.qmc.scramble_generating_matrices(
generating_matrices, scrambling_matrices, num_digits, validate_args=False,
dtype=None, name=None
)
Examples#
import tf_quant_finance as tff
# Example: Scrambling the 2D Sobol generating matrices.
dim = 2
num_results = 1000
num_digits = 10
seed = (2, 3)
tff.math.qmc.scramble_generating_matrices(
tff.math.qmc.sobol_generating_matrices(dim, num_results, num_digits),
tff.math.qmc.random_scrambling_matrices(dim, num_digits, seed=seed),
num_digits)
# ==> tf.Tensor([
# [586, 505, 224, 102, 34, 31, 13, 6, 2, 1],
# [872, 695, 945, 531, 852, 663, 898, 568, 875, 693],
# ], shape=(2, 10), dtype=int32)
Args:#
generating_matrices: Positive scalarTensorof integers.scrambling_matrices: Positive ScalarTensorof integers with the sameshapeasgenerating_matrices.num_digits: Positive scalarTensorof integers with rank 0. The base-2 precision of the points which can be sampled fromgenerating_matrices.validate_args: Pythonboolindicating whether to validate arguments. Default value:False.dtype: Optionaldtype. Thedtypeof the outputTensor(eitherint32orint64). Default value:Nonewhich maps togenerating_matrices.dtype.name: Pythonstrname prefixed to ops created by this function. Default value:Nonewhich maps toscramble_generating_matrices.
Returns:#
A Tensor with the same shape and dtype as generating_matrices.