Synopsis:
sheaf(X,M) -- produce the coherent sheaf on the variety X corresponding to the module M.
If X is the affine variety Spec R, then M should be an R-module. If X is the projective variety Proj R, then M should be a homogeneous R-module.
Code:
-- ../../../Macaulay2/m2/varieties.m2:101-107 sheaf(Variety,Module) := CoherentSheaf => (X,M) -> if M#?(sheaf,X) then M#(sheaf,X) else M#(sheaf,X) = ( if ring M =!= ring X then error "expected module and variety to have the same ring"; if instance(X,ProjectiveVariety) and not isHomogeneous M then error "expected a homogeneous module"; new CoherentSheaf from { symbol module => M, symbol variety => X