# This code is part of Qiskit.## (C) Copyright IBM 2017, 2020## This code is licensed under the Apache License, Version 2.0. You may# obtain a copy of this license in the LICENSE.txt file in the root directory# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.## Any modifications or derivative works of this code must retain this# copyright notice, and modified files need to carry a notice indicating# that they have been altered from the originals.# Part of the QEC framework"""Module for Plane"""frommathimportcos,sinimportnumpyasnpfromqiskit_qec.geometry.two_manifoldimportTwoManifold
[docs]classPlane(TwoManifold):"""Represents a R2 plane two manifold"""# pylint: disable=useless-super-delegationdef__init__(self):super().__init__()
[docs]@staticmethoddefison(point):"""Check that point is on the plane"""# Qick check that point is on thereturnpoint.shape==(2,)andlen(point)==2
[docs]@staticmethoddefrotate(theta,vector):"""Rotate `vector` around `theta`"""theta=np.deg2rad(theta)rot=Plane.rot_matrix(theta)returnnp.dot(rot,vector)
[docs]@staticmethoddefrot_matrix(theta):"""Create rotation matrix that rotates by theta"""returnnp.array([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]])