F2SP.java
1.04 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
69
70
71
72
73
74
75
76
77
package is2.data;
final public class F2SP extends IFV {
final private float[] parameters;
public double score = 0;
public F2SP(float[] p) {
parameters = p;
}
@Override
final public void add(int i) {
if (i > 0)
score += parameters[i];
}
final public void add(int[] i) {
for (int element : i) {
if (element > 0)
score += parameters[element];
}
}
final public void sub(float[] px, int i, Long2IntInterface li) {
if (i > 0) {
score -= px[li.l2i(i)];
// score -= px[i];
// else score -=px[];
}
}
@Override
public void clear() {
score = 0;
}
/*
* (non-Javadoc)
*
* @see is2.IFV#getScore()
*/
@Override
public double getScore() {
return score;
}
public double getScoreF() {
return score;
}
/*
* (non-Javadoc)
*
* @see is2.IFV#clone()
*/
@Override
public IFV clone() {
return new F2SP(this.parameters);
}
/**
* @param l2i
*/
public void addRel(int i, float f) {
if (i > 0)
score += parameters[i] * f;
}
public int length() {
return this.parameters.length;
}
}