Environment to perform calculations of equivariant vector bundles on homogeneous varieties
Equivariant_Vector_Bundles_On_Homogeneous_Varieties__0-2 / src / Equivariant_Vector_Bundles_On_Homogeneous_Varieties / Foundation / Structure.sage
1842 viewsLicense: GPL3
ubuntu2204
from typing import Iterator12class Structure ( object ) :34def __eq__ ( self , other:"Structure" ) -> bool :5"""Tests if two objects of the same class and if they coincide."""6if isinstance( other , self.__class__ ) :7if self.__repr__() == other.__repr__() : return True8else : return False9else : return False101112def __getitem__ ( self , Input:int or slice ) -> "Structure" or list[ "Structure" ] :13"""Returns a single datum or slices of data."""14if Input in ZZ :15Index = Input16if Index <= -len(self)-1 : return None17elif Index in [ -len(self) .. -1 ] : Index += len(self)18elif Index in [ 0 .. len(self) ] : pass19else : return None20Single_Part = self.Constituent_Parts()[Index]21return Single_Part2223elif isinstance( Input , slice ) :24Slice = Input25New_Constituent_Parts = self.Constituent_Parts()[Slice]26if len(New_Constituent_Parts) == 0 :27return None28elif len(New_Constituent_Parts) == 1 :29Single_Part = New_Constituent_Parts[0]30return Single_Part31else :32return self.__class__( New_Constituent_Parts )3334else :35raise ValueError('The variable ``Input`` is inappropriate.')363738def __ne__ ( self , other:"Structure" ) -> bool :39"""Tests if two objects do not coincide."""40return not self == other414243def Is_Irreducible ( self ) -> bool :44"""Tests if ``self`` is irreducible/ simple."""45return len(self) == 1464748def Is_Not_Trivial ( self ) -> bool :49"""Tests if ``self`` is not trivial."""50return not self.Is_Trivial()515253def Is_Reducible ( self ) -> bool :54"""Tests if ``self`` is reducible/ non-simple, i.e. it is trivial/ zero or consists of multiple summands/ components."""55return not self.Is_Irreducible()565758# Synonyms for the method ``Is_Irreducible``59def Is_Simple ( self ) -> bool :60"""Tests if ``self`` is irreducible/ simple, i.e. consists only of a single summand/ component."""61return self.Is_Irreducible()626364def Is_Trivial ( self ) -> bool :65"""Tests if ``self`` has no components."""66return len(self) == 067686970class Irreducible_Structure ( Structure ) :7172def __iter__ ( self ) -> Iterator[ "Irreducible_Structure" ] :73"""Returns an iterator of ``self``."""74yield self757677def __len__ ( self ) -> int :78"""Returns the number of components of ``self``."""79return 1808182def Constituent_Parts ( self ) -> list[ "Irreducible_Structure" ] :83"""Returns ``self`` in a list ."""84return [ self ]858687def Irreducible_Components ( self ) -> Iterator[ "Irreducible_Structure" ] :88"""Returns ``self``."""89yield self90919293class Direct_Sum_Of_Structures ( Structure ) :9495def __eq__ ( self , other:"Direct_Sum_Of_Structures" ) -> bool :96"""Tests if two objects of the class ``Direct_Sum_Of_Structures`` coincide."""97if type( other ) == self.__class__ :98if len( other ) == len( self ) :99100Remaining_Summands = other.Summands()101for Summand in self.Summands() :102try : Remaining_Summands.remove( Summand )103except : return False104105if len( Remaining_Summands ) == 0 : return True106107else : return False108else : return False109else : return False110111112def __iter__ ( self ) -> Iterator[ Structure ] :113"""Returns an iterator of ``self``."""114for Summand in self.Summands() :115yield Summand116117118def __len__ ( self ) -> int :119"""Returns the number of components of ``self``."""120return len( self.Summands() )121122123def Constituent_Parts ( self ) -> list[ Structure ] :124"""Returns the summands of ``self`` as list."""125return self.Summands()126127128def Irreducible_Components ( self ) -> Iterator[ Irreducible_Structure ] :129"""Returns the irreducible components of ``self`` as list."""130for Summand in self.Summands() :131for Irreducible_Component in Summand.Irreducible_Components() :132yield Irreducible_Component133134135def Summands ( self ) -> list[ Structure ] :136"""Returns the attribute ``_Summands``."""137return self._Summands138139140141class Extension_Of_Structures ( Structure ) :142143def __iter__ ( self ) -> Iterator[ Structure ] :144"""Returns an iterator of ``self``."""145for Part in self.Constituent_Parts() :146yield Part147148149def __len__ ( self ) -> int :150"""Returns the number of constituent parts of ``self``."""151return 2152153154def Constituent_Parts ( self ) -> "Extension_Of_Structures" :155"""Returns the summands of ``self`` as list."""156return [ self ]157158159def Irreducible_Components ( self ) -> Iterator[ Irreducible_Structure ] :160"""Returns the attribute ``_Components``."""161for Component in [ self.Quotient() , self.Subobject() ] :162for Irreducible_Component in Component.Irreducible_Components() :163yield Irreducible_Component164165166def Quotient ( self ) -> Structure :167"""Returns the attribute ``_Quotient``."""168return self._Quotient169170171def Subobject ( self ) -> Structure :172"""Returns the attribute ``_Subobject``."""173return self._Subobject174175176177178