I have some trouble building an exponential matrix using the latest version of Qiskit that supports Parameters. I am also interested in learning how to use custom loss functions (if this is even possible).
So I am coming from the following direction: I want to build a VQC using this layout
I only want to implement this circuit using these M_Class gates, M_img class I dont need. M_class are of form : $\mathrm{e}^{A(\theta)}$
In particular it is defined by the sum of small 4x4 matrices: $$A = \exp\left(-\frac{\mathrm{i}}{2}\sum_{\rho,\gamma\in[0, 1, 2, 3]}\theta_{\rho,\gamma}\hat{\sigma}^\rho\otimes\hat{\sigma}^\gamma\right)$$
with the matrices being $\hat{\sigma}^0=\mathbf{I}$, $\hat{\sigma}^0=\hat{\sigma}^x$, $\hat{\sigma}^2=\hat{\sigma}^y$ and $\hat{\sigma}^3=\hat{\sigma}^z$.
So my idea was to use a this feature map
qc = QuantumCircuit(num_qbits)
qc.reset(range(num_qbits))
featuremap = qc
then build the Unitary Matrix that encodes M_class in order to build the ansatz that resembles the first graphic. My problem is finding a way to build a parametrized exp matrix. The only way building such a matrix I know use
evol_gate = PauliEvolutionGate(A, time=5, synthesis=SuzukiTrotter(reps=2))
but as far as I understand this aproach does not support Paramter, which can be trained later... My general idea was to program Hermit operator M_class and to built a circuit out of it as ansatz and in the end using something like this
vqc = VQC(
sampler=sampler,
feature_map=feature_map,
ansatz=ansatz,
optimizer=optimizer,
callback=callback_graph,
)
# clear objective value history
objective_func_vals = []
vqc.fit(train_features, train_labels)
Hope someone can help :))