-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDivisor.class.st
More file actions
68 lines (59 loc) · 1.62 KB
/
Copy pathDivisor.class.st
File metadata and controls
68 lines (59 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"
Weil divisors, i.e. formal sums (with integer coefficients) of prime divisors (integral closed subschemes of codimension 1) of an integral locally Noetherian scheme.
"
Class {
#name : #Divisor,
#superclass : #FormalSum,
#category : #'Mathematics-Schemes-Divisors'
}
{ #category : #comparing }
Divisor >> <= aDivisor [
^ (aDivisor - self) isEffective
]
{ #category : #comparing }
Divisor >> = anObject [
^ (anObject isKindOf: Divisor) and: [self ~ anObject]
]
{ #category : #comparing }
Divisor >> >= aDivisor [
^ (self - aDivisor) isEffective
]
{ #category : #accessing }
Divisor >> degree [
| answer |
answer := 0.
self coefficientsDo: [:each| answer := answer + each].
^ answer
]
{ #category : #operations }
Divisor >> gcd: aDivisor [
| newCoefficients |
newCoefficients := Dictionary new.
self keysAndValuesDo: [:key :value|
aDivisor at: key ifPresent: [:value2| newCoefficients at: key put: (value min: value2)]].
^ (self class coefficients: newCoefficients) parent: parent
]
{ #category : #testing }
Divisor >> isEffective [
^ self allSatisfy: [:each| each positive]
]
{ #category : #operations }
Divisor >> lcm: aDivisor [
| answer |
answer := self copy.
aDivisor keysAndValuesDo: [:key :value|
answer at: key put: ((self at: key) max: value)].
^ answer
]
{ #category : #accessing }
Divisor >> support [
| answer |
answer := nil. "should start from the empty variety"
self keysDo: [:each| answer := answer ifNil: [each] ifNotNil: [answer ñ each]].
^ answer
]
{ #category : #comparing }
Divisor >> ~ aDivisor [
"Answer true if the receiver and the argument are linearly equivalent."
^ (self - aDivisor) isPrincipal
]