#include <Network.hpp>
|
| void | Fromfile (const std::string &fname, const int &network_type=NtType.Regular) |
| | Construct Network from network file.
|
| |
| void | FromString (const std::vector< std::string > &contents, const int &network_type=NtType.Regular) |
| | Construct Network from a list of strings, where each string is the same as each line in network file.
|
| |
| | Network (const std::string &fname, const int &network_type=NtType.Regular) |
| |
| void | PutUniTensor (const std::string &name, const UniTensor &utensor, const bool &is_clone=true) |
| |
| void | PutUniTensor (const cytnx_uint64 &idx, const UniTensor &utensor, const bool &is_clone=true) |
| |
| void | PutUniTensors (const std::vector< std::string > &name, const std::vector< UniTensor > &utensors, const bool &is_clone=true) |
| |
| UniTensor | Launch (const bool &optimal=false) |
| |
| void | clear () |
| |
| Network | clone () |
| |
| void | PrintNet () |
| |
| void | Savefile (const std::string &fname) |
| |
|
| static Network | Contract (const std::vector< UniTensor > &tensors, const std::string &Tout, const std::vector< bool > &is_clone={}, const std::vector< std::string > &alias={}, const std::string &contract_order="") |
| |
◆ Network()
| cytnx::Network::Network |
( |
const std::string & |
fname, |
|
|
const int & |
network_type = NtType.Regular |
|
) |
| |
|
inline |
◆ clear()
| void cytnx::Network::clear |
( |
| ) |
|
|
inline |
◆ clone()
◆ Contract()
| static Network cytnx::Network::Contract |
( |
const std::vector< UniTensor > & |
tensors, |
|
|
const std::string & |
Tout, |
|
|
const std::vector< bool > & |
is_clone = {}, |
|
|
const std::vector< std::string > & |
alias = {}, |
|
|
const std::string & |
contract_order = "" |
|
) |
| |
|
inlinestatic |
◆ Fromfile()
| void cytnx::Network::Fromfile |
( |
const std::string & |
fname, |
|
|
const int & |
network_type = NtType.Regular |
|
) |
| |
|
inline |
Construct Network from network file.
- Parameters
-
| fname | The network file path |
| network_type | The type of network. This can be [NtType.Regular] or [NtType.Fermion.]. Currently, only Regular Network is support! |
note:
- each network file cannot have more than 1024 lines.
detail:
Format of a network file:
- each line defines a UniTensor, that takes the format '[name] : [Labels]'
- the name can be any alphabets A-Z, a-z
- There are two reserved name: 'TOUT' and 'ORDER' (all capital)
- One can use 'TOUT' line to specify the output UniTensor's bond order using labels
- The 'ORDER' line is used to specify the contraction order
About [Labels]:
- each label should seperate by a comma ","
- one ';' is needed and used to seperate Rowrank and column rank
About [ORDER]:
- The contraction order, it can be specify using the standard mathmetical bracket ruls.
- Without specify this line, the default contraction order will be from the first line to the last line
example network file:
A: 0;1,2
B: 0;3,4
C: 5;1,6
D: 5;7,8
TOUT: 2,3,4;6,7,8
ORDER: (A,B),(C,D)
example code for load the network file:
c++ API:
#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
cout << N << endl;
}
Definition Network.hpp:194
void Fromfile(const std::string &fname, const int &network_type=NtType.Regular)
Construct Network from network file.
Definition Network.hpp:251
Definition Accessor.hpp:12
output>
==== Network ====
[x] A : 0 ; 1 2
[x] B : 0 ; 3 4
[x] C : 5 ; 1 6
[x] D : 5 ; 7 8
TOUT : 2 3 4 ; 6 7 8
ORDER : (A,B),(C,D)
=================
python API
output>
==== Network ====
[x] A : 0 ; 1 2
[x] B : 0 ; 3 4
[x] C : 5 ; 1 6
[x] D : 5 ; 7 8
TOUT : 2 3 4 ; 6 7 8
ORDER : (A,B),(C,D)
=================
◆ FromString()
| void cytnx::Network::FromString |
( |
const std::vector< std::string > & |
contents, |
|
|
const int & |
network_type = NtType.Regular |
|
) |
| |
|
inline |
Construct Network from a list of strings, where each string is the same as each line in network file.
- Parameters
-
| contents | The network file descriptions |
| network_type | The type of network. This can be [NtType.Regular] or [NtType.Fermion.]. Currently, only Regular Network is support! |
note:
- contents cannot have more than 1024 lines/strings.
detail:
Format of each string follows the same policy as Fromfile.
example code for load the network file:
c++ API:
#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
"B: 0;3,4",
"C: 5;1,6",
"D: 5;7,8",
"TOUT: 2,3,4;6,7,8",
"ORDER: (A,B),(C,D)"
});
cout << N << endl;
}
void FromString(const std::vector< std::string > &contents, const int &network_type=NtType.Regular)
Construct Network from a list of strings, where each string is the same as each line in network file.
Definition Network.hpp:287
output>
==== Network ====
[x] A : 0 ; 1 2
[x] B : 0 ; 3 4
[x] C : 5 ; 1 6
[x] D : 5 ; 7 8
TOUT : 2 3 4 ; 6 7 8
ORDER : (A,B),(C,D)
=================
python API
import cytnx
N.FromString(["A: 0;1,2",\
"B: 0;3,4",\
"C: 5;1,6",\
"D: 5;7,8",\
"TOUT: 2,3,4;6,7,8",\
"ORDER: (A,B),(C,D)"\
])
print(N);
output>
==== Network ====
[x] A : 0 ; 1 2
[x] B : 0 ; 3 4
[x] C : 5 ; 1 6
[x] D : 5 ; 7 8
TOUT : 2 3 4 ; 6 7 8
ORDER : (A,B),(C,D)
=================
◆ Launch()
| UniTensor cytnx::Network::Launch |
( |
const bool & |
optimal = false | ) |
|
|
inline |
◆ PrintNet()
| void cytnx::Network::PrintNet |
( |
| ) |
|
|
inline |
◆ PutUniTensor() [1/2]
| void cytnx::Network::PutUniTensor |
( |
const cytnx_uint64 & |
idx, |
|
|
const UniTensor & |
utensor, |
|
|
const bool & |
is_clone = true |
|
) |
| |
|
inline |
◆ PutUniTensor() [2/2]
| void cytnx::Network::PutUniTensor |
( |
const std::string & |
name, |
|
|
const UniTensor & |
utensor, |
|
|
const bool & |
is_clone = true |
|
) |
| |
|
inline |
◆ PutUniTensors()
| void cytnx::Network::PutUniTensors |
( |
const std::vector< std::string > & |
name, |
|
|
const std::vector< UniTensor > & |
utensors, |
|
|
const bool & |
is_clone = true |
|
) |
| |
|
inline |
◆ Savefile()
| void cytnx::Network::Savefile |
( |
const std::string & |
fname | ) |
|
|
inline |
The documentation for this class was generated from the following file: