The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches
Constructors

Functions for creating channel data structures. More...

Functions

KrausMap createInlineKrausMap (int numQubits, int numOperators, std::vector< std::vector< std::vector< qcomp > > > matrices)
 
SuperOp createInlineSuperOp (int numQubits, std::vector< std::vector< qcomp > > matrix)
 
KrausMap createKrausMap (int numQubits, int numOperators)
 
SuperOp createSuperOp (int numQubits)
 

Detailed Description

Functions for creating channel data structures.

Function Documentation

◆ createInlineKrausMap()

KrausMap createInlineKrausMap ( int numQubits,
int numOperators,
std::vector< std::vector< std::vector< qcomp > > > matrices )
Note
Documentation for this function or struct is under construction!

Referenced by TEST_CASE().

◆ createInlineSuperOp()

SuperOp createInlineSuperOp ( int numQubits,
std::vector< std::vector< qcomp > > matrix )
Note
Documentation for this function or struct is under construction!

◆ createKrausMap()

KrausMap createKrausMap ( int numQubits,
int numOperators )
Note
Documentation for this function or struct is under construction!

Definition at line 172 of file channels.cpp.

172 {
173 validate_envIsInit(__func__);
174 validate_newKrausMapParams(numQubits, numOperators, __func__);
175
176 // validation ensures this never overflows
177 qindex numRows = powerOf2(numQubits);
178
179 KrausMap out = {
180 .numQubits = numQubits,
181 .numMatrices = numOperators,
182 .numRows = numRows,
183
184 .matrices = cpu_allocMatrixList(numRows, numOperators), // is or contains nullptr if failed
185 .superop = allocSuperOp(numQubits), // heap fields are or contain nullptr if failed
186
187 .isApproxCPTP = util_allocEpsilonSensitiveHeapFlag(), // nullptr if failed
188 };
189
190 // free memory before throwing validation error to avoid memory leaks
191 freeAllMemoryIfAnyAllocsFailed(out); // sets out.matrices=nullptr if failed
192 validate_newKrausMapAllocs(out, __func__);
193
194 // mark CPTP as unknown; it will be lazily evaluated whene a function asserts CPTP-ness
195 util_setFlagToUnknown(out.isApproxCPTP);
196
197 return out;
198}

Referenced by TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ createSuperOp()

SuperOp createSuperOp ( int numQubits)
Note
Documentation for this function or struct is under construction!

Definition at line 158 of file channels.cpp.

158 {
159 validate_envIsInit(__func__);
160 validate_newSuperOpParams(numQubits, __func__);
161
162 SuperOp out = allocSuperOp(numQubits); // fields may be or contain nullptr if failed
163
164 // free all memory before we throw validation errors to avoid leaks
165 freeAllMemoryIfAnyAllocsFailed(out);
166 validate_newSuperOpAllocs(out, __func__);
167
168 return out;
169}

Referenced by TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().