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

Functions for creating channel data structures. More...

Functions

KrausMap createInlineKrausMap (int numQb, int numOps, {{{ matrices }}})
 
KrausMap createInlineKrausMap (int numQubits, int numOperators, std::vector< std::vector< std::vector< qcomp > > > matrices)
 
SuperOp createInlineSuperOp (int numQb, {{ matrix }})
 
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() [1/2]

KrausMap createInlineKrausMap ( int numQb,
int numOps,
{{{ matrices }}}  )
Note
Documentation for this function or struct is under construction!
This entity is actually a macro.
See also

◆ createInlineKrausMap() [2/2]

KrausMap createInlineKrausMap ( int numQubits,
int numOperators,
std::vector< std::vector< std::vector< qcomp > > > matrices )
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.
See also

Referenced by TEST_CASE().

◆ createInlineSuperOp() [1/2]

SuperOp createInlineSuperOp ( int numQb,
{{ matrix }}  )
Note
Documentation for this function or struct is under construction!
This entity is actually a macro.
See also

◆ createInlineSuperOp() [2/2]

SuperOp createInlineSuperOp ( int numQubits,
std::vector< std::vector< qcomp > > matrix )
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.
See also

◆ createKrausMap()

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

Definition at line 176 of file channels.cpp.

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

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!
See also

Definition at line 162 of file channels.cpp.

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

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