#############################################################################
##
## This file is part of GAP, a system for computational discrete algebra.
##
## SPDX-License-Identifier: GPL-2.0-or-later
##
## Copyright of GAP belongs to its developers, whose names are too numerous
## to list here. Please refer to the COPYRIGHT file for details.
##
############################################################################
##
## This file together with 'matobj2.gd' formally define the interface to
## those vector and matrix objects in GAP that are not represented
## by plain lists.
## In this file the categories are defined, it is read earlier in the
## GAP library reading process.
##
# This is an internal filter mostly meant for declarations of methods that
# are meant to apply to both VectorObj and MatrixObj implementations;
# and possibly even old-style vector and matrix objects. We need this
# because if we defined e.g. BaseDomain twice for IsVectorObj and for
# IsMatrixObj, then the first definition incurs a "hidden implication"
# which then later leads to "method matches more than one declaration" messages.
# The proper fix is to remove hidden implication
DeclareCategory( "IsVecOrMatObj", IsObject );
#############################################################################
##
## <#GAPDoc Label="IsVectorObj">
## <ManSection>
## <Filt Name="IsVectorObj" Arg='obj' Type="Category"/>
##
## <Description>
## The idea behind <E>vector objects</E> is that one wants to deal with
## objects like coefficient lists of fixed length over a given domain
## <M>R</M>, say, which can be added and can be multiplied from the left
## with elements from <M>R</M>.
## A vector object <M>v</M>, say, is always a copyable object
## (see <Ref Filt="IsCopyable"/>) in <Ref Filt="IsVector"/>,
## which knows the values of
## <Ref Attr="BaseDomain" Label="for a vector object"/>
## (with value <M>R</M>) and
## <Ref Attr="Length"/>,
## where <M>R</M> is a domain (see Chapter <Ref Chap="Domains"/>)
## that has methods for
## <Ref Attr="Zero"/>,
## <Ref Attr="One"/>,
## <Ref Oper="\in" Label="for a collection"/>,
## <Ref Attr="Characteristic"/>,
## <Ref Prop="IsFinite"/>.
## We say that <M>v</M> is defined over <M>R</M>.
## Typically, <M>R</M> will be at least a semiring.
## <P/>
## For creating new vector objects compatible with <M>v</M>,
## <Ref Oper="NewVector"/> requires that also the value of
## <Ref Attr="ConstructingFilter" Label="for a vector object"/>
## is known for <M>v</M>.
## <P/>
## Further, entry access <M>v[i]</M> is expected to return a &GAP; object,
## for <M>1 \leq i \leq</M><C> Length</C><M>( v )</M>,
## and that these entries of <M>v</M> belong to the base domain <M>R</M>.
## <P/>
## Note that we do <E>not</E> require that <M>v</M> is a list in the sense
## of <Ref Filt="IsList"/>,
## in particular the rules of list arithmetic
## (see the sections <Ref Sect="Additive Arithmetic for Lists"/>
## and <Ref Sect="Multiplicative Arithmetic for Lists"/>)
## need <E>not</E> hold.
## For example, the sum of two vector objects of different lengths or
## defined over different base domains is not defined,
## and a plain list of vector objects is not a matrix.
## Also unbinding entries of vector objects is not defined.
## <P/>
## Scalar multiplication from the left is defined only with elements from
## <M>R</M>.
## <P/>
## The family of <M>v</M> (see <Ref Func="FamilyObj"/>) is the same as
## the family of its base domain <M>R</M>.
## However, it is <E>not</E> required that the entries lie in <M>R</M>
## in the sense of <Ref Oper="\in" Label="for a collection"/>,
## also values may occur that can be naturally embedded into <M>R</M>.
## For example, if <M>R</M> is a polynomial ring then some entries
## in <M>v</M> may be elements of the coefficient ring of <M>R</M>.
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareCategory( "IsVectorObj", IsVector and IsVecOrMatObj and IsRowVectorOrVectorObj );
#############################################################################
##
## <#GAPDoc Label="IsMatrixOrMatrixObj">
## <ManSection>
## <Filt Name="IsMatrixOrMatrixObj" Arg='obj' Type="Category"/>
##
## <Description>
## Several functions are defined for objects in <Ref Filt="IsMatrix"/> and
## objects in <Ref Filt="IsMatrixObj"/>.
## All these objects lie in the filter <Ref Filt="IsMatrixOrMatrixObj"/>.
## It should be used in situations where an object can be either a list of
## lists in <Ref Filt="IsMatrix"/> or a <Q>proper</Q> matrix object in
## <Ref Filt="IsMatrixObj"/>,
## for example as a requirement in the installation of a method for such an
## argument.
## <P/>
## <Example><![CDATA[
## gap> m:= IdentityMat( 2, GF(2) );;
## gap> IsMatrix( m ); IsMatrixObj( m ); IsMatrixOrMatrixObj( m );
## true
## false
## true
## gap> m:= NewIdentityMatrix( IsPlistMatrixRep, GF(2), 2 );;
## gap> IsMatrix( m ); IsMatrixObj( m ); IsMatrixOrMatrixObj( m );
## false
## true
## true
## ]]></Example>
## </Description>
## </ManSection>
## <#/GAPDoc>
##
# FIXME: why is this in the `IsVector` filter? That makes perhaps sense for
# row matrices, but not in general?! So perhaps move it to IsRowListMatrix?
DeclareCategory( "IsMatrixOrMatrixObj", IsVector and IsScalar and IsVecOrMatObj );
#############################################################################
##
## Note that we cannot get this implication already in the declaration of
## 'IsMatrix' because both 'IsVector' and 'IsMatrix' are declared in
## 'lib/arith.gd',
## and 'IsMatrixOrMatrixObj' --which shall be in the middle--
## is declared in 'lib/matobj1.gd'.)
##
#T Do we want an analogous setup also for objects in 'IsRowVector' (which are
#T plain lists) and objects in 'IsVectorObj'?
#T (For some operations, such as 'WeightOfVector' or 'DistanceOfVectors',
#T this implication would make sense, but in fact the default methods for
#T 'WeightVecFFE' and 'DistanceVecFFE' are installed with requirement
#T 'IsList'.)
##
InstallTrueMethod( IsMatrixOrMatrixObj, IsMatrix );
#############################################################################
##
## <#GAPDoc Label="IsMatrixObj">
## <ManSection>
## <Filt Name="IsMatrixObj" Arg='obj' Type="Category"/>
##
## <Description>
## The idea behind <E>matrix objects</E> is that one wants to deal with
## objects like <M>m</M> by <M>n</M> arrays over a given domain
## <M>R</M>, say, which can be added and multiplied
## and can be multiplied from the left with elements from <M>R</M>.
## A matrix object <M>M</M>, say, is always a copyable object
## (see <Ref Filt="IsCopyable"/>) in <Ref Filt="IsVector"/> and
## <Ref Filt="IsScalar"/>,
## which knows the values of
## <Ref Attr="BaseDomain" Label="for a matrix object"/>
## (with value <M>R</M>),
## <Ref Attr="NumberRows" Label="for a matrix object"/>
## (with value <M>m</M>),
## <Ref Attr="NumberColumns" Label="for a matrix object"/>
## (with value <M>n</M>),
## where <M>R</M> is a domain (see Chapter <Ref Chap="Domains"/>)
## that has methods for
## <Ref Attr="Zero"/>,
## <Ref Attr="One"/>,
## <Ref Oper="\in" Label="for a collection"/>,
## <Ref Attr="Characteristic"/>,
## <Ref Prop="IsFinite"/>.
## We say that <M>v</M> is defined over <M>R</M>.
## Typically, <M>R</M> will be at least a semiring.
## <P/>
## For creating new matrix objects compatible with <M>M</M>,
## <Ref Oper="NewMatrix"/> requires that also the value of
## <Ref Attr="ConstructingFilter" Label="for a matrix object"/>
## is known for <M>M</M>.
## <P/>
## Further, entry access <M>M[i,j]</M> is expected to return a &GAP; object,
## for <M>1 \leq i \leq m</M> and <M>1 \leq j \leq n</M>,
## and that these entries of <M>M</M> belong to the base domain <M>R</M>.
## <P/>
## Note that we do <E>not</E> require that <M>M</M> is a list in the sense
## of <Ref Filt="IsList"/>,
## in particular the rules of list arithmetic
## (see the sections <Ref Sect="Additive Arithmetic for Lists"/>
## and <Ref Sect="Multiplicative Arithmetic for Lists"/>)
## need <E>not</E> hold.
<><Q <>=\[]/>
## is in general not#
##differentnumbers of rows columns defined.
## Also unbinding # to list here. PleasetheCOPYRIGHT fordetailsjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
#</
#Scalarmultiplicationfrom isdefinedonlywithelements from
## <#
## <P/
# It is notassumedthat in <R/>is associative
# wedo notdefinewhatMk/>t java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 73
#inthis,positiveintegers M<M>
## (However, a# MR/M> say,whichcan added and bemultipliedfromthe
## P>
## The filter <Ref Filt="IsMatrixObj"/> alone does <E>not</E> imply that the
## multiplication is the usual matrix multiplication.
This defined via filter
# <ef FiltI"/;
together the associativityof base domain
## also implies the associativity of matrix multiplication.
## For example,
# Ref Attr=BaseDomain Label=for "java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
## lie in <Ref Filt="java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 24
## < Filt""/>
## <P/>
## The family of <M>M</M> (see <Ref Func="FamilyObj"/>) is the
# family(ee R Attr"java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 67
## #</
#, it E>ot<E that the entries MR/>
## in the sense of <Ref Oper="\in" Label="for a collection"/>,
# occurthatcanbe naturallyinto <><M.
## For example, #Ref Attr=" Label=for avectorobject/java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
<><M.
## </# for <M>1 \leq<><>Length/>M>v <M
## </ManSection>
## <#/GAPDoc>
##
DeclareCategory( "IsMatrixObj# P>
########################################
#
## <GAPDoc Label""
# <anSection>
# Filt ame" Arg'bj =Category/java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
#java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
#
## A # </>
## (see <Ref Filt="IsMatrixObj"/>) <M>M</M> which admits access #Scalarmultiplicationfrom isjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 74
#thatis list access <M>M[]/M> <ef Oper"[]/)yields
## the <M# the its base MR/>
## for <M> i leq<M C>NumberRows(<C<>M<M<>)/>java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
# P>
## All # also may occurthat can be naturally embedded into <M>R</M>.
## example, if<M>/M>isa polynomial ring then some entries
## Several rows ## in <M>v</M> mayjava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 68
entrowlistmatrices mayshare
## DeclareCategory IsVectorObj" java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 88
# the .
# </
##ts in Rjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 66
# Filt="IsList">java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
##and they obey the generalrulesforjava.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
# <Description
##>
##</java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
## argument
################################################################## >m: ( 2,());
##
#A BaseDomain( <vector> )
#A BaseDomain( <matrix> )
##
##true
## <ManSection>
## <Heading>BaseDomain</Heading>
Name=BaseDomain Arg='ector Label=fora object>
## <Attr Name="BaseDomain" Arg='matrix' Label="for a matrix java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 9
##:why I`filter That sense for
### rw matrices,but in general?Soperhapsmove it to ?
# vector <>ector/>or matrixobject<>atrix<A,
## respectively, is defined over the domain given by its
# Ref =""Label" vector object"v.
## #
## Note that not all entries of the object # Note java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 74
# its base domain to
## <Ref Oper="\in"#liba.'
# <ef Sect=Conceptsand for Vector MatrixObjects"/>
# />
## </ManSection>
## <#/GAPDoc>
##
("", java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 48
#eclareAttribute "BaseDomain,IsVectorObj;
#DeclareAttribute( "BaseDomain", IsMatrixOrMatrixObj );
#################################################### this implication makesense in fact the default methods
##
#A NumberRows( <M> )
#A NrRows( <M> )
#A NumberColumns( <M#T IsList.java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
# NrCols(<>)
##
## <#GAPDoc Label="NumberRowsNumberColumns">
# ManSection>
## <Heading>NumberRows and NumberColumns</Heading>
#< Name=NumberRows Arg='M Label=for a matrix">
## <Attr Name="NrRows" Arg='M' Label="for a matrix object"/>
## <=NumberColumns" Arg=M Label="for matrix object/java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
## <Attr Name="NrCols" Arg='M' Label="for a matrix object"/>
##
##<escription>
# a matrix<><A,
## <Ref Attr="NumberRows" Label="for a matrix object"/> and
# a matrix "/ store the
## number of # A matrix object matrix <M/,say,is always a copyable
## Attr=NrRows"Label"fora matrix/ and
###whichknowsthe of
# Ref""Label=" a matrix object"/> and
## <Ref Attr="NumberColumns" Label="for a matrix object"/>,# (with MR<)
#</>
## </ManSection>
## <#/GAPDoc>
#
java.lang.StringIndexOutOfBoundsException: Range [30, 16) out of bounds for length 54
DeclareSynonymAttr( "NrRows", NumberRows );
DeclareAttribute# that has methodsfor
eclareSynonymAttrNrCols,NumberColumns;
#########################< Oper"i"Label=for a">
##
#A OneOfBaseDomain( <v> )
AOneOfBaseDomain<M>)
# ZeroOfBaseDomain v java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
#( <M>)
#java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
## <#GAPDoc Label="java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 26
## <## for > \eq java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 58
## < Name="OneOfBaseDomain Arg''Label=for avectorobject">
## <Attr Name="OneOfBaseDomain" Arg='M' Label="for a matrix object"/>
## Note thatdo <>ot<E> that MMM> a in
# Attr ="Arg'M'Label"for a matrixobject>
##
## <Description>
## These attributes # in particular the rules
# the <Ref ="" Label"fora object"
## and < Sect=" for ">
#
## <P/>
## If <A>v</A> or <A>M</A>, respectively, is a plain list
## (see <ef ""/> thencomputingits
## <Ref Attr="BaseDomain" is in not possible, and the of java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 70
# regardedas
## java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 8
## or <Ref Attr="java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 13
# can be regarded ascheap.
## If <A>## wedefine what <><M-power object is
## one can also call <Ref Attr="BaseDomain" Label="for a vector object"/>
## first, withoutloss performancejava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
## <# </
# <>
## <#/GAPDoc>
##
DeclareAttribute( "OneOfBaseDomain", IsVecOrMatObj );
#java.lang.StringIndexOutOfBoundsException: Range [35, 17) out of bounds for length 52
#DeclareAttribute OneOfBaseDomain" )java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
DeclareAttribute elementsof matrixLie s Ref Attr="/)
#java.lang.StringIndexOutOfBoundsException: Range [36, 17) out of bounds for length 53
#eclareAttribute(ZeroOfBaseDomain,IsMatrixOrMatrixObj
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.