Observable
Functions for defining observables (cost functions) used to compute expectation values.
Module Reference
Predefined Observable Functions.
See also: quop_mpi.ansatz.set_observables().
- quop_mpi.observable.array(partition_table, MPI_COMM, array)
Define observables with a NumPy ndarray.
An Observables Function. The
arrayargument must be passed toquop_mpi.ansatz.set_observables()in a FunctionDict .- Parameters:
- partition_tablelist[int]
1-D array describing the global partitioning scheme,
quop_mpi.ansatzattribute- MPI_COMMIntracomm
MPI communicator,
quop_mpi.ansatzattribute- arraylist[float] or ndarray[float]
a 1-D real array containing system size observable values
- Returns:
- ndarray[float64]
local_iobservable values with global index offsetlocal_i_offset(seequop_mpi.ansatz())
- quop_mpi.observable.csv(partition_table, MPI_COMM, *args, **kwargs)
Load observables from a
*.csvusing pandas.An Observables Function. The
filenameargument must be passed toquop_mpi.ansatz.set_observables()in a FunctionDict. Additional keyword arguments in theFunctionDictare passed to the pandas.read_csv method.- Parameters:
- partition_tablelist[int]
1-D array describing the global partitioning scheme,
quop_mpi.ansatzattribute- MPI_COMMIntracomm
MPI communicator,
quop_mpi.ansatzattribute- filenamestr
path to a
*csvfile
- Returns:
- ndarray[float64]
local_iobservable values with global index offsetlocal_i_offset(seequop_mpi.ansatz())
- quop_mpi.observable.hdf5(partition_table, MPI_COMM, filename, dataset_name, **kwargs)
Load observables from a
*.h5file using HDF5 for Python.An Observables Function. The
filenameanddataset_namearguments must be passed toquop_mpi.ansatz.set_observables()in a FunctionDict. Additional positional and keyword arguments in theFunctionDictare passed to the h5py.File method.- Parameters:
- partition_tablelist[int]
1-D array describing the global partitioning scheme,
quop_mpi.ansatzattribute- MPI_COMMIntracomm
MPI communicator,
quop_mpi.ansatzattribute- filenamestr
path to a
*.h5file- dataset_namestr
path to the dataset in
filenamecontaining an ndarray[float64] of system size observables.
- Returns:
- ndarray[float64]
local_iobservable values with global index offsetlocal_i_offset(seequop_mpi.ansatz())
- quop_mpi.observable.serial(partition_table, MPI_COMM, function, *args, **kwargs)
Generate observables using a serial python function.
- An Observables Function. The
functionargument must be passed to quop_mpi.ansatz.set_observables()in a FunctionDict. Additional- positional and keyword arguments in the
FunctionDictare passed to function.
- Parameters:
- partition_tablelist[int]
- 1-D array describing the global partitioning scheme,
quop_mpi.ansatzattribute
- MPI_COMMIntracomm
MPI communicator,
quop_mpi.ansatzattribute- functionCallable
- Python function returning a 1-D real array of system size
observable values
- Returns:
- ndarray[float64]
local_iobservable values with global index offsetlocal_i_offset(seequop_mpi.ansatz())
- An Observables Function. The
Random Observables
Functions for generating random observables, useful for testing.
Observable operator functions using random diagonal matrices.
- quop_mpi.observable.rand.uniform(system_size, partition_table, seed, MPI_COMM, low=0, high=1)
Generate random observables from a uniform distribution.
An Observables Function. The
lowandhigharguments can be passed toquop_mpi.ansatz.set_observables()in a FunctionDict.- Parameters:
- system_sizeint
the size of the simulated system, class:quop_mpi.ansatz attribute
- partition_tablelist[int]
1-D array describing the global partitioning scheme,
quop_mpi.ansatzattribute- seedint
sets the seed of the random number generator,
quop_mpi.ansatzattribute- MPI_COMMIntracomm
MPI intracommunicator,
quop_mpi.ansatzattribute- lowfloat, optional
lower bound of the generated observable values (inclusive), by default
0- highfloat, optional
upper bound of the genereated observable values (exclusive), by default
1
- Returns:
- np.ndarray[float64]
local_iobservable values with global index offsetlocal_i_offset(seequop_mpi.ansatz())