I am solving the pennylane coding challenge, and I’m stuck with this problem. This is what my code looks like for the said problem.

```
np.random.seed(1967)
def get_matrix(params):
"""
Args:
- params (array): The four parameters of the model.
Returns:
- (matrix): The associated matrix to these parameters.
"""
alpha, beta, gamma, phi = params
sigma_x = np.array([[0, 1], [1, 0]])
sigma_y = np.array([[0, -1j], [1j, 0]])
sigma_z = np.array([[1, 0], [0, -1]])
# Calculate the individual rotation matrices
rz_gamma = np.array([[np.exp(-1j * gamma / 2), 0], [0, np.exp(1j * gamma / 2)]])
rx_beta = np.array([[np.cos(beta / 2), -1j * np.sin(beta / 2)],
[-1j * np.sin(beta / 2), np.cos(beta / 2)]])
rz_alpha = np.array([[np.exp(-1j * alpha / 2), 0], [0, np.exp(1j * alpha / 2)]])
# Combine the rotation matrices in the specified order
unitary_matrix = np.exp(1j * phi) * rz_gamma @ rx_beta @ rz_alpha
return unitary_matrix
# Put your code here #
# Return the matrix
def error(U, params):
"""
This function determines the similarity between your generated matrix and
the target unitary.
Args:
- U (np.array): Goal matrix that we want to approach.
- params (array): The four parameters of the model.
Returns:
- (float): Error associated with the quality of the solution.
"""
matrix = get_matrix(params)
# Put your code here #
error_value = np.linalg.norm(U - matrix)
return error_value
# Return the error
```

Now, I have two issue with it,

The result this code gives are the parameters, instead it should give the matrix as the result. See the Image

You can see the expected output is the matrix, but my solution output are the `params`

I tested the code on my local device, and It gives correct result.

It’s the issue with the pennylane result checking, it’s checking the matrix with the parameters.