GithubHelp home page GithubHelp logo

mpsim's People

Contributors

grmlarose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mpsim's Issues

Add option to create an MPS with an initial wavefunction

Could add as an argument to MPS.__init__ or as a new method, e.g.,

class MPS:
    ...
    @staticmethod
    def from_wavefunction(wavefunction: np.ndarray, qudit_dimension: int = 2) -> `MPS`:
        """Returns an MPS representation of the input wavefunction.

        Args:
            wavefunction: Initial wavefunction to write in MPS form.
            qudit_dimension: Dimension of qudits. (Default value is 2 for qubits.)
        """
        # Reshape the wavefunction to be a tensor with n = log_(qudit_dimension) (len(wavefunction))

        # Apply SVD to split all edges

        # Put into a list of nodes and return the MPS

Support MPS with qudits

Current support only includes qubits. Generalization to d-level systems will involve, minimally:

  • Specification of the dimension in MPS.__init__.
  • Gates for qudits.

Tensor contraction + SVD should be largely the same, if not identical.

Update apply_one_qudit_gate for unitary/non-unitary operations

For non-unitary operations, SVD is required after the gate to orthonormalize the index.

Probably the best option is to add a method which orthonormalizes the index, then call this after the single-qudit gate contraction of the gate is non-unitary.

Add Matrix Product Operators for noisy simulation

An MPO on n qudits is just an MPS on 2n qudits. While this is the most straightforward generalization, it may not be the easiest in the long term. Considerations to evaluate this include

  • How to implement unitary channels (gates).
  • How to implement noise channels.

Add a software license

Having a license would help make the software more broadly useful and clarify when people can contribute / use this code.

Add support for different TensorNetwork backends

For example, tensorflow is not supported because, e.g., mpsim.gates.is_unitary assumes the node object has a .conj() method in the final line

return np.allclose(
    gate.conj().T @ gate, np.identity(gate.shape[0]), atol=1e-5
)

which is unique to the numpy backend. (This also explicitly uses numpy in other locations.)

To add support for different backends:

  1. Understand the best way to do this with tensornetwork.
  2. Add several tests for different backends.

Add MPS.expectation_of for expectation values

Potential signature.

class MPS:
  ...
  def expectation_of(operator: tn.Node, tensor_indices: Sequence[int]) -> np.real:
    """Returns the expectation value of the operator acting on the tensor indices."""

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.