# This code is part of Qiskit.## (C) Copyright IBM 2025.## 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.# pylint: disable=invalid-name"""Subsystem class"""
[docs]classSubsystem:"""A Hilbert space with a name and a dimension."""def__init__(self,name:str,dim:int):"""Initialize with name and dimension. Args: name: Name of the subsystem. dim: Dimension of the subsystem. """self._name=nameself._dim=dim@propertydefname(self)->str:"""Name of subsystem."""returnself._name@propertydefdim(self)->int:"""Dimension of subsystem."""returnself._dimdef__str__(self)->str:returnself.namedef__repr__(self)->str:returnf"Subsystem(name={self.name}, dim={self.dim})"def__eq__(self,other:"Subsystem")->bool:ifnotisinstance(other,Subsystem):returnFalsereturnself.name==other.name