Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Implement constructor function for alternating layer ansatz #565

Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
678bb9e
20240821.1 added the eblock entanglmer and the digital ALT functions
ducthanh1991 Aug 21, 2024
271bef4
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Aug 23, 2024
16eea4c
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Aug 23, 2024
5bb29e9
20240823.1 delete unecessary display
ducthanh1991 Aug 23, 2024
47a3c11
Merge branch 'feature/digital_alternating_layer_ansatz_function' of h…
ducthanh1991 Aug 23, 2024
9fa438f
20240825.1 first implementation of precommit suggestion
ducthanh1991 Aug 25, 2024
c8ea3a9
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Aug 27, 2024
9e3cdf1
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Aug 27, 2024
0d2fc79
20240827.1 added code documentation
ducthanh1991 Aug 27, 2024
2c60e31
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Aug 27, 2024
06d96c9
200827.2 added the factory function for ALT
ducthanh1991 Aug 27, 2024
799a37c
20240828.2 corrected alt function typo
ducthanh1991 Aug 28, 2024
7c00a22
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Aug 31, 2024
6c59ab2
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Sep 4, 2024
076ffc0
added test
ducthanh1991 Sep 4, 2024
1f3676f
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Sep 6, 2024
556ca18
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Sep 6, 2024
1ef8dfb
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Sep 8, 2024
1284210
corrected typo in docstrings of alt function
ducthanh1991 Sep 9, 2024
8bd433e
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Sep 16, 2024
a6ce131
20240918.1 removed repeating piece of code in the entangle_block_digi…
ducthanh1991 Sep 18, 2024
e65ec14
Merge branch 'pasqal-io:main' into feature/digital_alternating_layer_…
ducthanh1991 Sep 19, 2024
433478b
20240919.1 implemented suggestion of change
ducthanh1991 Sep 19, 2024
370f616
forgot linting
ducthanh1991 Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
20240825.1 first implementation of precommit suggestion
ducthanh1991 committed Aug 25, 2024
commit 9fa438f452b621eea2aacf9ae9c7bd2c165f815a
30 changes: 25 additions & 5 deletions qadence/constructors/ansatze.py
Original file line number Diff line number Diff line change
@@ -349,7 +349,12 @@ def _entanglers_block_digital(
if not d%2:
ents.append(
kron(
_entangler(control=support[i+j],target=support[i+j+1],param_str=param_prefix + f"_ent_{next(iterator)}",op=entangler)
_entangler(
control=support[i+j],
target=support[i+j+1],
param_str=param_prefix + f"_ent_{next(iterator)}",
op=entangler
)

for i in range(0,n_qubits,m_block_qubits)
for j in range(0,m_block_qubits,2)
@@ -360,7 +365,12 @@ def _entanglers_block_digital(
if m_block_qubits > 2:
ents.append(
kron(
_entangler(control=support[i+j],target=support[i+j+1],param_str=param_prefix + f"_ent_{next(iterator)}",op=entangler)
_entangler(
control=support[i+j],
target=support[i+j+1],
param_str=param_prefix + f"_ent_{next(iterator)}",
op=entangler
)

for i in range(0,n_qubits,m_block_qubits)
for j in range(1,m_block_qubits,2)
@@ -372,7 +382,12 @@ def _entanglers_block_digital(
elif d%2:
ents.append(
kron(
_entangler(control=support[ i +j],target=support[i+j+1],param_str=param_prefix + f"_ent_{next(iterator)}",op=entangler)
_entangler(
control=support[ i +j],
target=support[i+j+1],
param_str=param_prefix + f"_ent_{next(iterator)}",
op=entangler
)

for i in range(-m_block_qubits//2,n_qubits,m_block_qubits)
for j in range(0,m_block_qubits,2)
@@ -383,7 +398,12 @@ def _entanglers_block_digital(
if m_block_qubits > 2:
chMoussa marked this conversation as resolved.
Show resolved Hide resolved
ents.append(
kron(
_entangler(control=support[ i+j],target=support[ i+j+1],param_str=param_prefix + f"_ent_{next(iterator)}",op=entangler)
_entangler(
control=support[ i+j],
target=support[ i+j+1],
param_str=param_prefix + f"_ent_{next(iterator)}",
op=entangler
)

for i in range(-m_block_qubits//2,n_qubits,m_block_qubits)
for j in range(1,m_block_qubits,2)
@@ -406,7 +426,7 @@ def alt_digital(

param_prefix:str='theta',

operations : list[Type(AbstractBlock)]=[RX,RY,RZ],
operations : list[type[AbstractBlock]]=[RX,RY],
entangler: Type[DigitalEntanglers]=CNOT,