misc#

Miscellaneous helper functions and classes.

Functions#

get_nonconflicting_string()

Returns a string distinct from given strings.

print_sdf()

Prints a spark dataframe in a deterministic way.

arb_to_float()

Returns a float corresponding to x.

copy_if_mutable()

Returns a deep copy of argument if it is mutable.

get_nonconflicting_string(strs)#

Returns a string distinct from given strings.

Parameters

strs (List[str]) –

Return type

str

print_sdf(sdf)#

Prints a spark dataframe in a deterministic way.

Parameters

sdf (pyspark.sql.DataFrame) –

Return type

None

arb_to_float(x)#

Returns a float corresponding to x.

If x.lower() and x.upper() do not round the same float, this returns None.

Parameters

x (flint.arb) –

Return type

Optional[float]

copy_if_mutable(value)#

Returns a deep copy of argument if it is mutable.

Parameters

value (T) –

Return type

T

Classes#

RNGWrapper

Mimics python random interface for discrete gaussian sampling.

class RNGWrapper(rng)#

Mimics python random interface for discrete gaussian sampling.

Parameters

rng (numpy.random.Generator) –

__init__(rng)#

Constructor.

Parameters

rng (GeneratorGenerator) – NumPy random generator.

randrange(self, high)#

Returns a random integer between 0 (inclusive) and high (exclusive).

Parameters

high (int) – upper bound for random integer range.

Return type

int