Skip to content

Commit

Permalink
lib: add operation DirectProductFamily
Browse files Browse the repository at this point in the history
This declares the new operation DirectProductFamily, installs a method
for it. This makes the method installed for UnderlyingRelation easier to
read.
  • Loading branch information
ssiccha committed May 17, 2019
1 parent f30c1e4 commit 2c4928e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/mapping.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1259,12 +1259,11 @@ InstallMethod( UnderlyingRelation,
true,
[ IsGeneralMapping ], 0,
function( map )
local rel;
rel:= Objectify( NewType( CollectionsFamily(
DirectProductElementsFamily( [ ElementsFamily( FamilyObj( Source( map ) ) ),
ElementsFamily( FamilyObj( Range( map ) ) ) ] ) ),
IsDomain and IsAttributeStoringRep ),
rec() );
local type, rel;
type:= NewType( DirectProductFamily( [ FamilyObj( Source( map ) ),
FamilyObj( Range( map ) ) ] ),
IsDomain and IsAttributeStoringRep );
rel:= Objectify( type, rec() );
SetUnderlyingGeneralMapping( rel, map );
return rel;
end );
Expand Down
6 changes: 6 additions & 0 deletions lib/tuples.gd
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,9 @@ direct product elements families" );
DeclareOperation( "DirectProductElement", [ IsList ]);
DeclareOperation( "DirectProductElementNC",
[ IsDirectProductElementFamily, IsList ]);


#############################################################################
##
##
DeclareOperation( "DirectProductFamily", [ IsDenseList ] );
16 changes: 16 additions & 0 deletions lib/tuples.gi
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,19 @@ InstallOtherMethod( \*,
fi;
return DirectProductElement( List( dpelm, entry -> nonlist * entry ) );
end );


#############################################################################
##
##
InstallMethod( DirectProductFamily,
"for a collection (of families)",
fam -> fam = CollectionsFamily(FamilyOfFamilies),
[ IsDenseList ],
function( args )
return CollectionsFamily(
DirectProductElementsFamily(
List( args, x -> ElementsFamily( x ) )
)
);
end );

0 comments on commit 2c4928e

Please sign in to comment.