Skip to content

Commit 967274b

Browse files
committed
Added new method to compute points on a quadratic variety
1 parent 4da2ff7 commit 967274b

File tree

2 files changed

+121
-3
lines changed

2 files changed

+121
-3
lines changed

lib/varieties.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ DeclareRepresentation( "IsHermitianVarietyRep", IsHermitianVariety and IsProject
4646

4747
DeclareCategory( "IsQuadraticVariety", IsProjectiveVariety );
4848
DeclareRepresentation( "IsQuadraticVarietyRep", IsQuadraticVariety and IsProjectiveVarietyRep, ["geometry","polring","listofpols"]);
49+
DeclareCategory( "IsPointsOfQuadraticVariety", IsPointsOfAlgebraicVariety );
50+
DeclareRepresentation( "IsPointsOfQuadraticVarietyRep", IsPointsOfQuadraticVariety, ["variety"]);
51+
DeclareOperation( "PointsOfQuadraticVariety", [IsQuadraticVariety] );
4952

5053
### 3. Affine Varieties ###
5154

@@ -209,4 +212,3 @@ DeclareOperation( "ConicOnFivePoints", [ IsHomogeneousList and
209212

210213

211214
## List of dimensions and field
212-

lib/varieties.gi

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,124 @@ InstallMethod( Display,
440440
Print("\n Polynomial: ", DefiningListOfPolynomials(var),"\n");
441441
end );
442442

443+
#############################################################################
444+
#O PointsOfQuadraticVariety ( <var> )
445+
# returns the points of a quadratic variety using the associated polar space.
446+
##
447+
InstallMethod( PointsOfQuadraticVariety,
448+
"for a quadratic variety",
449+
[ IsQuadraticVariety and IsQuadraticVarietyRep ],
450+
function( var )
451+
local pts;
452+
pts := rec(
453+
geometry := var!.geometry,
454+
type := 1,
455+
variety := var
456+
);
457+
return Objectify(
458+
NewType( ElementsCollFamily, IsPointsOfQuadraticVariety and
459+
IsPointsOfQuadraticVarietyRep),
460+
pts
461+
);
462+
end );
463+
464+
#############################################################################
465+
#O Points( <var> )
466+
# shortcut to PointsOfQuadraticVariety
467+
##
468+
InstallMethod( Points,
469+
"for a quadratic variety",
470+
[ IsQuadraticVariety and IsQuadraticVarietyRep ],
471+
function( var )
472+
return PointsOfQuadraticVariety( var );
473+
end );
474+
475+
#############################################################################
476+
#O ViewObj ( <pts> )
477+
##
478+
InstallMethod( ViewObj,
479+
"for a collection representing the points of a quadratic variety",
480+
[ IsPointsOfQuadraticVariety and IsPointsOfQuadraticVarietyRep ],
481+
function( pts )
482+
Print("<points of ", pts!.variety, ">");
483+
end );
484+
485+
#############################################################################
486+
#O PrintObj ( <pts> )
487+
##
488+
InstallMethod( PrintObj,
489+
"for a collection representing the points of a quadratic variety",
490+
[ IsPointsOfQuadraticVariety and IsPointsOfQuadraticVarietyRep ],
491+
function( pts )
492+
Print("Points( ", pts!.variety, " )");
493+
end );
494+
495+
#############################################################################
496+
#O Iterator ( <pts> )
497+
# iterator for the points of a quadratic variety via its polar space
498+
##
499+
InstallMethod( Iterator,
500+
"for points of a quadratic variety",
501+
[ IsPointsOfQuadraticVariety ],
502+
function( pts )
503+
local qv, ps, ambient, inner;
504+
qv := pts!.variety;
505+
ps := PolarSpace( qv );
506+
ambient := qv!.geometry;
507+
inner := Iterator( Points( ps ) );
508+
return IteratorByFunctions( rec(
509+
NextIterator := function(iter)
510+
local p, obj;
511+
p := NextIterator(iter!.inner);
512+
obj := UnderlyingObject(p);
513+
if IsCVecRep(obj) or IsCMatRep(obj) then
514+
obj := Unpack(obj);
515+
fi;
516+
return VectorSpaceToElement( ambient, obj );
517+
end,
518+
IsDoneIterator := function(iter)
519+
return IsDoneIterator(iter!.inner);
520+
end,
521+
ShallowCopy := function(iter)
522+
return rec( inner := ShallowCopy(iter!.inner) );
523+
end,
524+
inner := inner
525+
));
526+
end );
527+
528+
#############################################################################
529+
#O Enumerator ( <pts> )
530+
# enumerator for the points of a quadratic variety via its polar space
531+
##
532+
InstallMethod( Enumerator,
533+
"for points of a quadratic variety",
534+
[ IsPointsOfQuadraticVariety ],
535+
function( pts )
536+
local qv, ps, ambient;
537+
qv := pts!.variety;
538+
ps := PolarSpace( qv );
539+
ambient := qv!.geometry;
540+
return List( Enumerator( Points( ps ) ),
541+
function(p)
542+
local obj;
543+
obj := UnderlyingObject(p);
544+
if IsCVecRep(obj) or IsCMatRep(obj) then
545+
obj := Unpack(obj);
546+
fi;
547+
return VectorSpaceToElement( ambient, obj );
548+
end );
549+
end );
550+
551+
#############################################################################
552+
#O Size( <pts> )
553+
##
554+
InstallMethod( Size,
555+
"for points of a quadratic variety",
556+
[ IsPointsOfQuadraticVariety ],
557+
function( pts )
558+
return Size( Points( PolarSpace( pts!.variety ) ) );
559+
end );
560+
443561
#############################################################################
444562
#O PolarSpace ( <var> )
445563
# returns the polar space defined by the equation in the list of polynomials
@@ -1771,5 +1889,3 @@ InstallMethod( Size,
17711889

17721890

17731891

1774-
1775-

0 commit comments

Comments
 (0)