<< Support Functions Support Functions lowdisc_bitand >>

Low Discrepancy Toolbox >> Low Discrepancy Toolbox > Support Functions > lowdisc_bary

lowdisc_bary

Returns the digits of a number given the basis.

Calling Sequence

digits = lowdisc_bary ( n )
digits = lowdisc_bary ( n , basis )
digits = lowdisc_bary ( n , basis , order )

Parameters

n :

a 1 x 1 matrix of floating point integers, the integer to decompose

basis :

a 1 x 1 matrix of floating point integers, the basis. Default basis = 2.

order :

a string, the order of the digits. If order="littleendian", then the least significant digits are at the end. If order="bigendian", then the biggest significant digits are at the begining. Default is order="littleendian".

digits :

a n x 1 matrix of floating point integers, the digits of the decomposition. The i-th digit satisfies 0<= digit(i) <= b - 1

Description

Returns the list of digits of the decomposition of n in base b, i.e. decompose n as n = d0 b^jmax + d1 b^{jmax-1} + ... + d{jmax+1} b^0. The order is little endian order, i.e. the first digit is associated with b^jmax, and the last digit is associated with b^0.

This function is not vectorized, that is, it converts only one integer at a time.

Examples

lowdisc_bary ( 4 , 2 )                  // [1 0 0]'
lowdisc_bary ( 4 , 2 , "bigendian" )    // [0 0 1]'
lowdisc_bary ( 4 , 2 )                  // [1 0 0]'
lowdisc_bary ( 4 , 2 , "littleendian" ) // [1 0 0]'
lowdisc_bary ( 4 , 2 , "bigendian" )    // [0 0 1]'

Authors

Bibliography

"Monte-Carlo methods in Financial Engineering", Paul Glasserman

<< Support Functions Support Functions lowdisc_bitand >>