@@ -6,7 +6,7 @@ Gate::Gate(){
6
6
quietmode=false ;
7
7
}
8
8
9
- Gate::Gate (std::vector<int > nlevels_, std::vector<int > nessential_, double time_, std::vector<double > gate_rot_freq_, LindbladType lindbladtype_, bool quietmode_){
9
+ Gate::Gate (const std::vector<int >& nlevels_, const std::vector<int >& nessential_, double time_, const std::vector<double >& gate_rot_freq_, LindbladType lindbladtype_, bool quietmode_){
10
10
11
11
MPI_Comm_rank (PETSC_COMM_WORLD, &mpirank_petsc);
12
12
MPI_Comm_rank (MPI_COMM_WORLD, &mpirank_world);
@@ -283,7 +283,7 @@ void Gate::applyGate(const Vec state, Vec VrhoV){
283
283
}
284
284
285
285
286
- XGate::XGate (std::vector<int > nlevels, std::vector<int > nessential, double time, std::vector<double > gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
286
+ XGate::XGate (const std::vector<int >& nlevels, const std::vector<int >& nessential, double time, const std::vector<double >& gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
287
287
288
288
assert (dim_ess == 2 );
289
289
@@ -302,7 +302,7 @@ XGate::XGate(std::vector<int> nlevels, std::vector<int> nessential, double time,
302
302
303
303
XGate::~XGate () {}
304
304
305
- YGate::YGate (std::vector<int > nlevels, std::vector<int > nessential, double time, std::vector<double > gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
305
+ YGate::YGate (const std::vector<int >& nlevels, const std::vector<int >& nessential, double time, const std::vector<double >& gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
306
306
307
307
assert (dim_ess == 2 );
308
308
@@ -320,7 +320,7 @@ YGate::YGate(std::vector<int> nlevels, std::vector<int> nessential, double time,
320
320
}
321
321
YGate::~YGate () {}
322
322
323
- ZGate::ZGate (std::vector<int > nlevels, std::vector<int > nessential, double time, std::vector<double > gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
323
+ ZGate::ZGate (const std::vector<int >& nlevels, const std::vector<int >& nessential, double time, const std::vector<double >& gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
324
324
325
325
assert (dim_ess == 2 );
326
326
@@ -339,7 +339,7 @@ ZGate::ZGate(std::vector<int> nlevels, std::vector<int> nessential, double time,
339
339
340
340
ZGate::~ZGate () {}
341
341
342
- HadamardGate::HadamardGate (std::vector<int > nlevels, std::vector<int > nessential, double time, std::vector<double > gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
342
+ HadamardGate::HadamardGate (const std::vector<int >& nlevels, const std::vector<int >& nessential, double time, const std::vector<double >& gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential, time, gate_rot_freq, lindbladtype_, quietmode) {
343
343
344
344
assert (dim_ess == 2 );
345
345
@@ -362,7 +362,7 @@ HadamardGate::~HadamardGate() {}
362
362
363
363
364
364
365
- CNOT::CNOT (std::vector<int > nlevels, std::vector<int > nessential, double time, std::vector<double > gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential,time, gate_rot_freq, lindbladtype_, quietmode) {
365
+ CNOT::CNOT (const std::vector<int >& nlevels, const std::vector<int >& nessential, double time, const std::vector<double >& gate_rot_freq, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels, nessential,time, gate_rot_freq, lindbladtype_, quietmode) {
366
366
367
367
assert (dim_ess == 4 );
368
368
@@ -387,7 +387,7 @@ CNOT::CNOT(std::vector<int> nlevels, std::vector<int> nessential, double time, s
387
387
CNOT::~CNOT (){}
388
388
389
389
390
- SWAP::SWAP (std::vector<int > nlevels_, std::vector<int > nessential_, double time_, std::vector<double > gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
390
+ SWAP::SWAP (const std::vector<int >& nlevels_, const std::vector<int >& nessential_, double time_, const std::vector<double >& gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
391
391
assert (dim_ess == 4 );
392
392
393
393
/* Fill lab-frame swap gate in essential dimension system V_re = Re(V), V_im = Im(V) = 0 */
@@ -408,7 +408,7 @@ SWAP::SWAP(std::vector<int> nlevels_, std::vector<int> nessential_, double time_
408
408
409
409
SWAP::~SWAP (){}
410
410
411
- SWAP_0Q::SWAP_0Q (std::vector<int > nlevels_, std::vector<int > nessential_, double time_, std::vector<double > gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
411
+ SWAP_0Q::SWAP_0Q (const std::vector<int >& nlevels_, const std::vector<int >& nessential_, double time_, const std::vector<double >& gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
412
412
int Q = nlevels.size (); // Number of total oscillators
413
413
414
414
/* Fill lab-frame swap 0<->Q-1 gate in essential dimension system V_re = Re(V), V_im = Im(V) = 0 */
@@ -448,7 +448,7 @@ SWAP_0Q::SWAP_0Q(std::vector<int> nlevels_, std::vector<int> nessential_, double
448
448
SWAP_0Q::~SWAP_0Q (){}
449
449
450
450
451
- CQNOT::CQNOT (std::vector<int > nlevels_, std::vector<int > nessential_, double time_, std::vector<double > gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
451
+ CQNOT::CQNOT (const std::vector<int >& nlevels_, const std::vector<int >& nessential_, double time_, const std::vector<double >& gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
452
452
453
453
/* Fill lab-frame CQNOT gate in essential dimension system V_re = Re(V), V_im = Im(V) = 0 */
454
454
/* V = [1 0 0 ...
@@ -477,7 +477,7 @@ CQNOT::CQNOT(std::vector<int> nlevels_, std::vector<int> nessential_, double tim
477
477
CQNOT::~CQNOT (){}
478
478
479
479
480
- QFT::QFT (std::vector<int > nlevels_, std::vector<int > nessential_, double time_, std::vector<double > gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
480
+ QFT::QFT (const std::vector<int >& nlevels_, const std::vector<int >& nessential_, double time_, const std::vector<double >& gate_rot_freq_, LindbladType lindbladtype_, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode) {
481
481
482
482
double sq = sqrt (dim_ess);
483
483
@@ -502,7 +502,7 @@ QFT::QFT(std::vector<int> nlevels_, std::vector<int> nessential_, double time_,
502
502
QFT::~QFT (){}
503
503
504
504
505
- FromFile::FromFile (std::vector<int > nlevels_, std::vector<int > nessential_, double time_, std::vector<double > gate_rot_freq_, LindbladType lindbladtype_, std::string filename, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode){
505
+ FromFile::FromFile (const std::vector<int >& nlevels_, const std::vector<int >& nessential_, double time_, const std::vector<double >& gate_rot_freq_, LindbladType lindbladtype_, const std::string& filename, bool quietmode) : Gate(nlevels_, nessential_, time_, gate_rot_freq_, lindbladtype_, quietmode){
506
506
507
507
// Read the gate from a file
508
508
int nelems = 2 *dim_ess*dim_ess;
@@ -543,7 +543,7 @@ FromFile::FromFile(std::vector<int> nlevels_, std::vector<int> nessential_, doub
543
543
FromFile::~FromFile (){}
544
544
545
545
546
- Gate* initTargetGate (std::vector<std::string> target_str, std::vector<int >nlevels, std::vector<int >nessential, double total_time, LindbladType lindbladtype, std::vector<double > gate_rot_freq, bool quietmode){
546
+ Gate* initTargetGate (const std::vector<std::string>& target_str, const std::vector<int >& nlevels, const std::vector<int >& nessential, double total_time, LindbladType lindbladtype, const std::vector<double >& gate_rot_freq, bool quietmode){
547
547
548
548
if ( target_str.size () < 2 ) {
549
549
printf (" ERROR: You want to optimize for a gate, but didn't specify which one. Check your config for 'optim_target'!\n " );
0 commit comments