ScriptedFunctor

5 views
Skip to first unread message

René Birkner

unread,
Nov 9, 2009, 11:33:04 AM11/9/09
to Macaulay2
Hi,

how can I assign a new method to a scriptedFunctor? I want to do the
following:

I have a bundle E on a Toric Variety and I want the rank of the i-th
cohomology group in degree u to be returned by the command:

hh^i (E,u)


I know that hh is used for hodge numbers on smooth projective
varieties.
thanks
René

Greg

unread,
Nov 9, 2009, 11:51:38 AM11/9/09
to Macaulay2
René:

I would do the something like the following:

hh(ZZ,ToricVectorBundle,ZZ) := ZZ => (i,E,u) -> ( ... )

A silly example illustrating the idea and how I discovered it
is given below.

-- Greg.

Macaulay2, version 1.3.1
with packages: ConwayPolynomials, Elimination, IntegralClosure,
LLLBases, PrimaryDecomposition, ReesAlgebra,
SchurRings,
TangentCone

i1 : methods(hh)

o1 = {(hh, Sequence, ProjectiveVariety)}

o1 : VerticalList

i2 : code(hh,Sequence,ProjectiveVariety)

o2 = -- code for method: hh(Sequence,ProjectiveVariety)
/Applications/Macaulay2-1.3.1/share/Macaulay2/Core/
varieties.m2:431:42-440:6: --source code:
hh(Sequence,ProjectiveVariety) := (pq,X) -> if X.cache.?hh and
X.cache.hh#?pq then X.cache.hh#pq else (
(p,q) := pq;
if class p =!= ZZ or class q =!= ZZ then error "expected
integer superscripts";
d := dim X;
pqs := { (p,q), (q,p), (d-p,d-q), (d-q,d-p) };
(p,q) = min { (p,q), (q,p), (d-p,d-q), (d-q,d-p) };
h := rank HH^q cotangentSheaf(p,X);
if not X.cache.?hh then X.cache.hh = new MutableHashTable;
scan(pqs, pq -> X.cache.hh#pq = h);
h)

i3 : hh(ZZ,QQ) := QQ => (pq,r) -> 3*pq*r;

i4 : hh^1(2/1)

o4 = 6

o4 : QQ

i5 : hh^2(2/1)

o5 = 12

o5 : QQ

i6 : hh^3(1/2)

9
o6 = -
2

o6 : QQ

René Birkner

unread,
Nov 10, 2009, 8:11:11 AM11/10/09
to Macaulay2
Ok, for just two arguments (i and the bundle) it works to define

hh(ZZ,ToricVectorBundle) := ZZ => (i,E) -> (....)

but if I want to add a degree vector I can not add another argument
but

hh(ZZ,Sequence) := ZZ => (i,S) -> (
(E,u) := S;
...)

works.

Daniel R. Grayson

unread,
Nov 10, 2009, 1:53:57 PM11/10/09
to maca...@googlegroups.com
We should fix this for you in the next version of Macaulay2! I.e, hh
should allow dispatching on the classes of multiple arguments, as in
hh^i(x,y), the way HH allows.

(Defining a method for hh(ZZ,Sequence) prevents someone else from
doing so, and someone else might want to.)

René Birkner

unread,
Nov 11, 2009, 4:35:49 AM11/11/09
to Macaulay2
that would be great!

I did not like my solution either because of "blocking" (ZZ,Sequence).
I will change that then as soon as possible.

Thanks
René
Reply all
Reply to author
Forward
0 new messages