Skip to content

Commit 53c6828

Browse files
added multiply projector functions
specifically: - multiplyQubitProjector - postMultiplyQubitProjector - multiplyMultiQubitProjector - postMultiplyMultiQubitProjector Also updated multiplication doc warnings
1 parent e0a0e96 commit 53c6828

File tree

6 files changed

+286
-52
lines changed

6 files changed

+286
-52
lines changed

quest/include/multiplication.h

Lines changed: 113 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ extern "C" {
9696
void multiplyCompMatr1(Qureg qureg, int target, CompMatr1 matrix);
9797

9898

99-
/** @notyettested
100-
*
101-
* Multiplies a general one-qubit dense @p matrix upon the specified @p target
99+
/** Multiplies a general one-qubit dense @p matrix upon the specified @p target
102100
* qubit of the density matrix @p qureg, from the right-hand side.
103101
*
104102
* @formulae
@@ -177,10 +175,8 @@ void multiplyCompMatr2(Qureg qureg, int target1, int target2, CompMatr2 matr);
177175

178176

179177
/// @notyetdoced
180-
/// @notyettested
181-
/// @notyetvalidated
182178
/// @see
183-
/// - postMultiplyCompMatr1
179+
/// - postMultiplyCompMatr1()
184180
void postMultiplyCompMatr2(Qureg qureg, int target1, int target2, CompMatr2 matrix);
185181

186182

@@ -217,10 +213,8 @@ void multiplyCompMatr(Qureg qureg, int* targets, int numTargets, CompMatr matrix
217213

218214

219215
/// @notyetdoced
220-
/// @notyettested
221-
/// @notyetvalidated
222216
/// @see
223-
/// - postMultiplyCompMatr1
217+
/// - postMultiplyCompMatr1()
224218
void postMultiplyCompMatr(Qureg qureg, int* targets, int numTargets, CompMatr matrix);
225219

226220

@@ -272,9 +266,8 @@ extern "C" {
272266
void multiplyDiagMatr1(Qureg qureg, int target, DiagMatr1 matr);
273267

274268

275-
/// @notyettested
276-
/// @notyetvalidated
277269
/// @notyetdoced
270+
/// @see postMultiplyCompMatr1()
278271
void postMultiplyDiagMatr1(Qureg qureg, int target, DiagMatr1 matrix);
279272

280273

@@ -305,9 +298,8 @@ extern "C" {
305298
void multiplyDiagMatr2(Qureg qureg, int target1, int target2, DiagMatr2 matr);
306299

307300

308-
/// @notyettested
309-
/// @notyetvalidated
310301
/// @notyetdoced
302+
/// @see postMultiplyCompMatr1()
311303
void postMultiplyDiagMatr2(Qureg qureg, int target1, int target2, DiagMatr2 matrix);
312304

313305

@@ -338,9 +330,8 @@ extern "C" {
338330
void multiplyDiagMatr(Qureg qureg, int* targets, int numTargets, DiagMatr matrix);
339331

340332

341-
/// @notyettested
342-
/// @notyetvalidated
343333
/// @notyetdoced
334+
/// @see postMultiplyCompMatr1()
344335
void postMultiplyDiagMatr(Qureg qureg, int* targets, int numTargets, DiagMatr matrix);
345336

346337

@@ -351,9 +342,10 @@ void postMultiplyDiagMatr(Qureg qureg, int* targets, int numTargets, DiagMatr ma
351342
void multiplyDiagMatrPower(Qureg qureg, int* targets, int numTargets, DiagMatr matrix, qcomp exponent);
352343

353344

354-
/// @notyettested
355-
/// @notyetvalidated
356345
/// @notyetdoced
346+
/// @see
347+
/// - postMultiplyCompMatr1()
348+
/// - applyDiagMatrPower()
357349
void postMultiplyDiagMatrPower(Qureg qureg, int* targets, int numTargets, DiagMatr matrix, qcomp exponent);
358350

359351

@@ -419,27 +411,31 @@ extern "C" {
419411
/// @notyetdoced
420412
/// @notyetvalidated
421413
/// @see
422-
/// - multiplyCompMatr1
414+
/// - multiplyCompMatr1()
423415
void multiplyFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matrix);
424416

425417

426418
/// @notyetdoced
427-
/// @notyettested
428419
/// @notyetvalidated
420+
/// @see
421+
/// - postMultiplyCompMatr1()
422+
/// - applyFullStateDiagMatr()
429423
void postMultiplyFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matrix);
430424

431425

432426
/// @notyetdoced
433427
/// @notyetvalidated
434428
/// @see
435-
/// - multiplyCompMatr1
436-
/// - applyDiagMatrPower
429+
/// - multiplyCompMatr1()
430+
/// - applyFullStateDiagMatr()
437431
void multiplyFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr matrix, qcomp exponent);
438432

439433

440434
/// @notyetdoced
441-
/// @notyettested
442435
/// @notyetvalidated
436+
/// @see
437+
/// - postMultiplyCompMatr1()
438+
/// - applyFullStateDiagMatr()
443439
void postMultiplyFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr matrix, qcomp exponent);
444440

445441

@@ -466,13 +462,16 @@ extern "C" {
466462

467463

468464
/// @notyetdoced
469-
/// @see multiplyCompMatr1()
465+
/// @see
466+
/// - multiplyCompMatr1()
467+
/// - applySwap()
470468
void multiplySwap(Qureg qureg, int qubit1, int qubit2);
471469

472470

473471
/// @notyetdoced
474-
/// @notyettested
475-
/// @notyetvalidated
472+
/// @see
473+
/// - multiplyCompMatr1()
474+
/// - applySwap()
476475
void postMultiplySwap(Qureg qureg, int qubit1, int qubit2);
477476

478477

@@ -499,38 +498,44 @@ extern "C" {
499498

500499

501500
/// @notyetdoced
502-
/// @notyettested
503-
/// @see multiplyCompMatr1()
501+
/// @see
502+
/// - multiplyCompMatr1()
503+
/// - applyPauliX()
504504
void multiplyPauliX(Qureg qureg, int target);
505505

506506

507507
/// @notyetdoced
508-
/// @notyettested
509-
/// @see multiplyCompMatr1()
508+
/// @see
509+
/// - multiplyCompMatr1()
510+
/// - applyPauliY()
510511
void multiplyPauliY(Qureg qureg, int target);
511512

512513

513514
/// @notyetdoced
514-
/// @notyettested
515-
/// @see multiplyCompMatr1()
515+
/// @see
516+
/// - multiplyCompMatr1()
517+
/// - applyPauliZ()
516518
void multiplyPauliZ(Qureg qureg, int target);
517519

518520

519521
/// @notyetdoced
520-
/// @notyettested
521-
/// @see postMultiplyCompMatr1()
522+
/// @see
523+
/// - postMultiplyCompMatr1()
524+
/// - applyPauliX()
522525
void postMultiplyPauliX(Qureg qureg, int target);
523526

524527

525528
/// @notyetdoced
526-
/// @notyettested
527-
/// @see postMultiplyCompMatr1()
529+
/// @see
530+
/// - postMultiplyCompMatr1()
531+
/// - applyPauliY()
528532
void postMultiplyPauliY(Qureg qureg, int target);
529533

530534

531535
/// @notyetdoced
532-
/// @notyettested
533-
/// @see postMultiplyCompMatr1()
536+
/// @see
537+
/// - postMultiplyCompMatr1()
538+
/// - applyPauliZ()
534539
void postMultiplyPauliZ(Qureg qureg, int target);
535540

536541

@@ -557,13 +562,16 @@ extern "C" {
557562

558563

559564
/// @notyetdoced
560-
/// @see multiplyCompMatr1()
565+
/// @see
566+
/// - multiplyCompMatr1()
567+
/// - applyPauliStr()
561568
void multiplyPauliStr(Qureg qureg, PauliStr str);
562569

563570

564571
/// @notyetdoced
565-
/// @notyettested
566-
/// @notyetvalidated
572+
/// @see
573+
/// - postMultiplyCompMatr1()
574+
/// - applyPauliStr()
567575
void postMultiplyPauliStr(Qureg qureg, PauliStr str);
568576

569577

@@ -597,8 +605,9 @@ void multiplyPauliGadget(Qureg qureg, PauliStr str, qreal angle);
597605

598606

599607
/// @notyetdoced
600-
/// @notyettested
601-
/// @notyetvalidated
608+
/// @see
609+
/// - postMultiplyCompMatr1()
610+
/// - applyPauliGadget()
602611
void postMultiplyPauliGadget(Qureg qureg, PauliStr str, qreal angle);
603612

604613

@@ -627,13 +636,14 @@ extern "C" {
627636
/// @notyetdoced
628637
/// @see
629638
/// - multiplyCompMatr1()
630-
/// - applyPhaseGadget
639+
/// - applyPhaseGadget()
631640
void multiplyPhaseGadget(Qureg qureg, int* targets, int numTargets, qreal angle);
632641

633642

634643
/// @notyetdoced
635-
/// @notyettested
636-
/// @notyetvalidated
644+
/// @see
645+
/// - postMultiplyCompMatr1()
646+
/// - applyPhaseGadget()
637647
void postMultiplyPhaseGadget(Qureg qureg, int* targets, int numTargets, qreal angle);
638648

639649

@@ -681,13 +691,17 @@ extern "C" {
681691

682692

683693
/// @notyetdoced
684-
/// @see multiplyCompMatr1()
694+
/// @see
695+
/// - multiplyCompMatr1()
696+
/// - applyMultiQubitNot()
685697
void multiplyMultiQubitNot(Qureg qureg, int* targets, int numTargets);
686698

687699

688700
/// @notyetdoced
689-
/// @notyettested
690701
/// @notyetvalidated
702+
/// @see
703+
/// - postMultiplyCompMatr1()
704+
/// - applyMultiQubitNot()
691705
void postMultiplyMultiQubitNot(Qureg qureg, int* targets, int numTargets);
692706

693707

@@ -699,15 +713,13 @@ void postMultiplyMultiQubitNot(Qureg qureg, int* targets, int numTargets);
699713
#ifdef __cplusplus
700714

701715

702-
/// @notyettested
703716
/// @notyetvalidated
704717
/// @notyetdoced
705718
/// @cppvectoroverload
706719
/// @see multiplyMultiQubitNot()
707720
void multiplyMultiQubitNot(Qureg qureg, std::vector<int> targets);
708721

709722

710-
/// @notyettested
711723
/// @notyetvalidated
712724
/// @notyetdoced
713725
/// @cppvectoroverload
@@ -721,6 +733,57 @@ void postMultiplyMultiQubitNot(Qureg qureg, std::vector<int> targets);
721733

722734

723735

736+
/**
737+
* @defgroup mult_projectors Projectors
738+
* @brief Functions for pre- or post-multiplying projectors upon density matrices.
739+
* @{
740+
*/
741+
742+
743+
#ifdef __cplusplus
744+
extern "C" {
745+
#endif
746+
747+
748+
/// @notyetdoced
749+
/// @notyetvalidated
750+
/// @see
751+
/// - multiplyCompMatr1()
752+
/// - applyQubitProjector()
753+
void multiplyQubitProjector(Qureg qureg, int qubit, int outcome);
754+
755+
756+
/// @notyetdoced
757+
/// @notyetvalidated
758+
/// @see
759+
/// - multiplyCompMatr1()
760+
/// - applyMultiQubitProjector()
761+
void multiplyMultiQubitProjector(Qureg qureg, int* qubits, int* outcomes, int numQubits);
762+
763+
764+
/// @notyetdoced
765+
/// @notyetvalidated
766+
/// @see
767+
/// - postMultiplyCompMatr1()
768+
/// - applyQubitProjector()
769+
void postMultiplyQubitProjector(Qureg qureg, int qubit, int outcome);
770+
771+
772+
/// @notyetdoced
773+
/// @notyetvalidated
774+
/// @see
775+
/// - postMultiplyCompMatr1()
776+
/// - applyMultiQubitProjector()
777+
void postMultiplyMultiQubitProjector(Qureg qureg, int* qubits, int* outcomes, int numQubits);
778+
779+
780+
// end de-mangler
781+
#ifdef __cplusplus
782+
}
783+
#endif
784+
785+
786+
724787
/**
725788
* @defgroup mult_paulistrsum PauliStrSum
726789
* @brief Functions for pre- or post-multiplying weighted sums of Pauli
@@ -741,8 +804,8 @@ void multiplyPauliStrSum(Qureg qureg, PauliStrSum sum, Qureg workspace);
741804

742805

743806
/// @notyetdoced
744-
/// @notyettested
745807
/// @notyetvalidated
808+
/// @see multiplyCompMatr1()
746809
void postMultiplyPauliStrSum(Qureg qureg, PauliStrSum sum, Qureg workspace);
747810

748811

0 commit comments

Comments
 (0)