Maestro 0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
TensorContractor.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#ifndef __TENSOR_CONTRACTOR_H_
16#define __TENSOR_CONTRACTOR_H_ 1
17
18#include <memory>
19
20#include "../Utils/Tensor.h"
21#include "TensorNode.h"
22
23namespace TensorNetworks {
24
25class TensorNetwork;
26
34public:
35 using TensorsMap =
36 std::unordered_map<Eigen::Index, std::shared_ptr<TensorNode>>;
37
38 virtual TensorsMap
40 std::vector<Eigen::Index> &keys,
41 std::unordered_map<Eigen::Index, Eigen::Index> &keysKeys,
42 bool fillKeys = true, bool contract = true) = 0;
43
50 virtual double Contract(const TensorNetwork &network,
51 Types::qubit_t qubit) = 0;
52
53 virtual size_t GetMaxTensorRank() const = 0;
54
63 virtual void SetMultithreading(bool multithreading = true) = 0;
64
72 virtual bool GetMultithreading() const = 0;
73
79 virtual std::shared_ptr<ITensorContractor> Clone() const = 0;
80};
81
82} // namespace TensorNetworks
83
84#endif // __TENSOR_CONTRACTOR_H_
Tensor Contractor interface.
virtual void SetMultithreading(bool multithreading=true)=0
Enable/disable multithreading.
std::unordered_map< Eigen::Index, std::shared_ptr< TensorNode > > TensorsMap
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.
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:20