Last change
on this file since 8189 was 8189, checked in by kjdon, 20 years ago |
first version of Imperial College's Visualiser code
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1007 bytes
|
Line | |
---|
1 | package vishnu.cluster;
|
---|
2 |
|
---|
3 | import java.util.*;
|
---|
4 |
|
---|
5 | // kainof DistanceMatrix
|
---|
6 | public class SimMatrix
|
---|
7 | {
|
---|
8 | public double[] matrix;
|
---|
9 |
|
---|
10 | // "vectors" is the expanded SparseMatrix, i.e. doc x keywords
|
---|
11 | // VECTOR_SIZE = #keywords
|
---|
12 | public SimMatrix(double[][] vectors,
|
---|
13 | int limit, Distance simfunc, int VECTOR_SIZE)
|
---|
14 | {
|
---|
15 | int i,j;
|
---|
16 | double iarray[];
|
---|
17 |
|
---|
18 | // size = #docs
|
---|
19 | int size=vectors.length, index=0;
|
---|
20 |
|
---|
21 | // to exclude diagonal and conjugates
|
---|
22 | // - - - - -
|
---|
23 | // |
|
---|
24 | // * |
|
---|
25 | // * * |
|
---|
26 | // * * * |
|
---|
27 | int realSize = (size * (size - 1)/2);
|
---|
28 | matrix=new double[realSize];
|
---|
29 | System.out.println("Similarity matrix size: " + size);
|
---|
30 |
|
---|
31 | for(i = 1; i < size; i++)
|
---|
32 | {
|
---|
33 | iarray=vectors[i];
|
---|
34 | for(j = 0; j < i; j++)
|
---|
35 | {
|
---|
36 | matrix[index] = simfunc.get(iarray,
|
---|
37 | vectors[j],
|
---|
38 | VECTOR_SIZE);
|
---|
39 | index++;
|
---|
40 | }
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.