# Rgate and BSgate from U

**URL:** https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984
**Category:** PennyLane Strawberry Fields
**Created:** [June 17, 2022, 2:02am UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984 "2022-06-17T02:02:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Dr\_Paul\_GRIFFIN](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/dr_paul_griffin/32/638_2.png) [@Dr\_Paul\_GRIFFIN](https://discuss.pennylane.ai/u/Dr_Paul_GRIFFIN)
#### Post date: [June 17, 2022, 2:02am UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/1 "2022-06-17T02:02:14Z")

</div>

Hi, Can anyone point me to how to calculate the parameters for Rgates and BSgates based on a unitary matrix or an adjacency matrix for the borealis chip? Many thanks.

---

<div class="post-metadata">

### Author: ![Dr\_Paul\_GRIFFIN](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/dr_paul_griffin/32/638_2.png) [@Dr\_Paul\_GRIFFIN](https://discuss.pennylane.ai/u/Dr_Paul_GRIFFIN)
#### Post date: [June 17, 2022, 6:39am UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/2 "2022-06-17T06:39:54Z")

</div>

I found the GraphEmbed does this but I get the error - “CircuitError: This program contains 0 spatial modes, but the device ‘borealis’ only supports 1 modes.”

---

<div class="post-metadata">

### Author: ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)
#### Post date: [June 21, 2022, 5:50pm UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/3 "2022-06-21T17:50:39Z")

</div>

Hi @Dr_Paul_GRIFFIN,

Welcome to the forum! Sorry we took a few days to answer.

It’s great that you’re running circuits on Borealis! While Borealis is programmable, it has a very specific architecture so not any kind of circuit can be programmed on it. The best way we can help you is if you share your full code here. If you can’t copy-paste your code here please let me know and you can send it on a slack message or through another medium.

---

<div class="post-metadata">

### Author: ![Dr\_Paul\_GRIFFIN](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/dr_paul_griffin/32/638_2.png) [@Dr\_Paul\_GRIFFIN](https://discuss.pennylane.ai/u/Dr_Paul_GRIFFIN)
#### Post date: [June 22, 2022, 5:23am UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/4 "2022-06-22T05:23:58Z")

</div>

Hi Catalina, Many thanks for getting back to me. I’m trying to modify the Borealis demo code to use my own graphs. I have a graph and can create a unitary but neither GraphEmbed or Interferometer classes are supported for Borealis so I am at a loss on how to create the S, R and BS gates to run the circuit. I have uploaded my code so far and a graph to run on slack. Any pointers to how to calculate the gates and parameters need would be great, thanks.

---

<div class="post-metadata">

### Author: ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)
#### Post date: [June 22, 2022, 11:57pm UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/5 "2022-06-22T23:57:23Z")

</div>

Hi @Dr_Paul_GRIFFIN,

Thank you for sharing your code on Slack.  
As Isaac responded on Slack, only specific gates are supported on Borealis.

Unfortunately I haven’t seen that we have any function that does what you need. If you already had the rotation parameters and beamsplitter parameters you could use them on Borealis but I haven’t seen that you can go directly from the matrix to these parameters.

We do have some demos that are graph-related [here](https://strawberryfields.ai/photonics/applications.html), but we don’t use beamsplitters and rotations.

If you do find a way to do this please share it here!

---

<div class="post-metadata">

### Author: ![Dr\_Paul\_GRIFFIN](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/dr_paul_griffin/32/638_2.png) [@Dr\_Paul\_GRIFFIN](https://discuss.pennylane.ai/u/Dr_Paul_GRIFFIN)
#### Post date: [June 23, 2022, 3:07am UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/6 "2022-06-23T03:07:59Z")

</div>

Many thanks for the reply @CatalinaAlbornoz. I have given a reply to Isaac in Slack and will continue my learning for this fascinating area. I’ll certainly share my code when I figure it out.

---

<div class="post-metadata">

### Author: ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)
#### Post date: [June 23, 2022, 5:43pm UTC](https://discuss.pennylane.ai/t/rgate-and-bsgate-from-u/1984/7 "2022-06-23T17:43:13Z")

</div>

Great! Thank you @Dr_Paul_GRIFFIN!
