Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable piece-wise-constant functions (#3645)
* Initial draft of time dependent hamiltonian * Allow creation of TDHamiltonian by multiplication of fn and Observable * Import TDHamiltonian as qml.ops.TDHamiltonian * Remove top-level import due to circular imports * Reorganize H_drift and H_ts * Add docstrings * Fix addition bug for Tensor and Observable * Update docstring * Rename TDHamiltonian to ParametrizedHamiltonian * Rename file parametrized_hamiltonian.py * Calling H(params, t) returns Operator instead of matrix * Remove inheritance from Observable * Change variable names and docstring comments to reflect switch from Time-Dependent to Parametrized * Docstring example * Move from qubit module to math_op module * Fix bug when calling ParametrizedHamiltonian if H_fixed is None * Update __add__ method * Add tests * Update tests_passing_pylint * update tests for pylint * Switch from isfunction to callable in Observable.__mul__ * Return 0 instead of None if _get_terms is empty * Apply docstring suggestions from code review Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com> Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com> * Clean up based on code review suggestions * Remove assumption that ops are Observables * Switch from pH.H_fixed to pH.H_fixed() * Support addition as Operator+ParametrizedHamiltonian * Support creating ParametrizedHamiltonian via qml.ops.dot * Test for qutrit ParametrizedHamiltonian * Add wires argument to __call__ * Incorporate code review suggestions * Add pwc_from_array * Add pwc_from_function * Examples in docstrings * Change call signature on pwc_from_array to (dt, index) * Change call signature on pwc_from_smooth to (dt, num_bins) * Deal with jax.numpy import * Update pennylane/operation.py * Remove unintentional edits * Remove unintended changes * Switch arg from dt to t * Move from math to pulse module * Return 0 outside of time interval * Fix bug where first bin is twice as large as subsequent bins and extends to before t1 * Add tests * Clarifying change in docstring * Reorganize tests * Update tests * changelog * Update tests * Rename t in pwc to timespan to differentiate from t in (params, t) from the resulting callable * Rename t in pwc to timespan to differentiate from t in (params, t) from the resulting callable * Reinstate import tests * Update docstring * Mark as xfail for now * Update tests * test codecov * clean up * Apply suggestions from code review * Apply suggestions from code review * Move files pt1 * Update example * Fix import statement * Use jnp.concatenate instead of appending to list Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com> Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>
- Loading branch information