Maestro 0.2.5
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
TensorContractor.h
Go to the documentation of this file.
1
14#pragma once
15
16#ifndef __TENSOR_CONTRACTOR_H_
17#define __TENSOR_CONTRACTOR_H_ 1
18
19#include <memory>
20
21#include "../Utils/Tensor.h"
22#include "TensorNode.h"
23
24namespace TensorNetworks {
25
26class TensorNetwork;
27
35 public:
36 using TensorsMap =
37 std::unordered_map<Eigen::Index, std::shared_ptr<TensorNode>>;
38
40 const TensorNetwork &network, Types::qubit_t qubit,
41 std::vector<Eigen::Index> &keys,
42 std::unordered_map<Eigen::Index, Eigen::Index> &keysKeys,
43 bool fillKeys = true, bool contract = true) = 0;
44
51 virtual double Contract(const TensorNetwork &network,
52 Types::qubit_t qubit) = 0;
53
54 virtual size_t GetMaxTensorRank() const = 0;
55
64 virtual void SetMultithreading(bool multithreading = true) = 0;
65
73 virtual bool GetMultithreading() const = 0;
74
80 virtual std::shared_ptr<ITensorContractor> Clone() const = 0;
81};
82
83} // namespace TensorNetworks
84
85#endif // __TENSOR_CONTRACTOR_H_
Tensor Contractor interface.
virtual void SetMultithreading(bool multithreading=true)=0
Enable/disable multithreading.
virtual TensorsMap InitializeTensors(const TensorNetwork &network, Types::qubit_t qubit, std::vector< Eigen::Index > &keys, std::unordered_map< Eigen::Index, Eigen::Index > &keysKeys, bool fillKeys=true, bool contract=true)=0
virtual double Contract(const TensorNetwork &network, Types::qubit_t qubit)=0
Contract the tensor network.
std::unordered_map< Eigen::Index, std::shared_ptr< TensorNode > > TensorsMap
virtual bool GetMultithreading() const =0
Get the multithreading flag.
virtual std::shared_ptr< ITensorContractor > Clone() const =0
Clone the tensor contractor.
virtual size_t GetMaxTensorRank() const =0
uint_fast64_t qubit_t
The type of a qubit.
Definition Types.h:21