Open vytautas-a opened 4 months ago
How does it translate to PyQ?
How does it translate to PyQ?
I think this is exactly what @vytautas-a is working on atm by implementing time-dependent solvers in PyQ.
From the expression side, it would require only a shortcut constructor.
def time_parameter(name: str) -> Expression:
return Expression.symbol(name, time_parameter=True)
But it will not affect how the expressions handle that symbol.
From the platform side, we can add flags to the Alloc
type in the Qadence IR similar to QuInstruct
.
Then, a type symbol could be passed to the model as Alloc(1, trainable=True, time_parameter=True)
.
Regarding the operation, in addition to the prefix dyn_
in the operation's name (dyn_evo
and dyn_qubit
are the current suggestions), we can add a flag like time_dependent=True
to t.
Current implementation of time-dependent block in
qadence
is using all the usual blocks to build the generator forHamEvo
with two additional twists. First, the parameter that denotes time is aParameter
instance with an additional flagis_time=True
. Currently it can be created usingTimeParameter
helper function in a similar way toFeatureParameter
andVariationalParameter
:Second, the composite block acting as the generator has a property
is_time_dependent=True
(implemented inAbstractBlock
class):Basically, that's all that distinguishes an arbitrary block from a time-dependent one.