Skip to content

Commit

Permalink
Id serialization for the outputting network fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
luav committed Dec 13, 2017
1 parent 1a79f5c commit 776fcc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/info/exascale/statix/Statix.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,31 +393,31 @@ public void saveNet(String outputPath) throws IOException {
// so even for the symmetric matrix all iterations should be done
int i = 0;
for (String inst1: instances) {
final long sid = csmat.instanceId(inst1); // Source node id
final int sid = csmat.instanceId(inst1); // Source node id
boolean initial = true; // First item in the line
int j = 0;
for (String inst2: instances) {
if(j > i) { // Skip back links
if(initial) {
initial = false;
netf.write(sid + ">");
netf.write(Integer.toUnsignedString(sid) + ">");
}
final float weight = (float)csmat.similarity(inst1, inst2);
if(weight == 0)
continue;
final long did = csmat.instanceId(inst2);
final int did = csmat.instanceId(inst2);
//System.out.print(" " + did + ":" + weight);
//if(weight <= 0 || Float.isNaN(weight))
// throw new IllegalArgumentException("Weight for #(" + inst1 + ", " + inst2 + ") is out of range: " + weight);
netf.write(" " + did + ":" + weight);
netf.write(" " + Integer.toUnsignedString(did) + ":" + weight);
}
++j;
}
if(!initial)
netf.write("\n");
++i;
}
System.err.println("The network is saved into: " + outputPath);
System.err.println("The network is saved to: " + outputPath);
}
}

Expand Down

0 comments on commit 776fcc4

Please sign in to comment.