MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / set_capacity

Method set_capacity

Core/QuantumMachine/OriginClassicalSystem.cpp:53–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void OriginCMem::set_capacity(size_t capacity_num)
54{
55 auto cur_cap = vecBit.size();
56
57 if (capacity_num < cur_cap)
58 {
59 vecBit.erase(vecBit.begin() + capacity_num, vecBit.end());
60 }
61 else if(capacity_num > cur_cap)
62 {
63 for (size_t i = 0; i < capacity_num; ++i)
64 {
65 auto _New_CBit =
66 CBitFactory::GetFactoryInstance().
67 CreateCBitFromName("c" + obj2str(i));
68 vecBit.push_back(_New_CBit);
69 }
70 }
71 else
72 {
73 //do nothing
74 }
75}
76
77CBit* OriginCMem::get_cbit_by_addr(size_t caddr)
78{

Callers

nothing calls this directly

Calls 7

obj2strFunction · 0.85
CreateCBitFromNameMethod · 0.80
sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected