Skip to content

Commit 52ece31

Browse files
committed
SparseHC for ALENEX
1 parent d25e66f commit 52ece31

File tree

8 files changed

+24
-19
lines changed

8 files changed

+24
-19
lines changed

.cproject

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.267221764" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
2424
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.2029839111" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
2525
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.702038611" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
26-
<option id="gnu.cpp.compiler.option.other.other.883284545" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++11" valueType="string"/>
26+
<option id="gnu.cpp.compiler.option.other.other.883284545" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++0x" valueType="string"/>
2727
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.497432667" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
2828
</tool>
2929
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2049340360" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
@@ -76,7 +76,7 @@
7676
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.617207059" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
7777
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.792113800" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
7878
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.115487490" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
79-
<option id="gnu.cpp.compiler.option.other.other.1688185505" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++11" valueType="string"/>
79+
<option id="gnu.cpp.compiler.option.other.other.1688185505" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++0x" valueType="string"/>
8080
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1561502608" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
8181
</tool>
8282
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1334603518" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
@@ -126,5 +126,7 @@
126126
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
127127
</scannerConfigBuildInfo>
128128
</storageModule>
129-
<storageModule moduleId="refreshScope"/>
129+
<storageModule moduleId="refreshScope" versionNumber="1">
130+
<resource resourceType="PROJECT" workspacePath="/sparsehc"/>
131+
</storageModule>
130132
</cproject>

.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</dictionary>
3232
<dictionary>
3333
<key>org.eclipse.cdt.make.core.buildLocation</key>
34-
<value>${workspace_loc:/SparseHC/Debug}</value>
34+
<value>${workspace_loc:/SparseHC/Release}</value>
3535
</dictionary>
3636
<dictionary>
3737
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ Example:
2727
Data:
2828

2929
To randomly generate pairwise Euclidean distance matrices of different sizes and dimensions:
30-
https://bitbucket.org/ngthuydiem/simulate
30+
https://bitbucket.org/ngthuydiem/simmat
3131

3232

Release/src/subdir.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CPP_DEPS += \
3838
src/%.o: ../src/%.cpp
3939
@echo 'Building file: $<'
4040
@echo 'Invoking: GCC C++ Compiler'
41-
g++ -O3 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
41+
g++ -O3 -Wall -c -fmessage-length=0 -std=c++0x -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
4242
@echo 'Finished building: $<'
4343
@echo ' '
4444

src/averagecluster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ float AverageVertex::computeDist(AverageVertex* v, float max, float tempMax) {
2626
missing = maxWidth - width;
2727

2828
if (missing == 0) {
29-
dist = (weight + max * missing) / maxWidth;
29+
dist = weight / maxWidth;
3030
if (dist < exactDist) {
3131
exactDist = dist;
3232
candidate = v;

src/completecluster.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ void CompleteCluster::clusterMatrix(InMatrix * mat) {
156156
maxEdges *= 1.1f;
157157
}
158158

159-
fprintf(stderr, "Finished! M = %u. linear ratio: %.2f. quadratic ratio: %zu\n", maxEdges,
159+
fprintf(stderr, "Finished! number of edges = %u. linear ratio: %.2f. quadratic ratio: %zu\n", maxEdges,
160160
(double) maxEdges / mat->numPoints, mat->numElements / maxEdges);
161-
printf("%u\t", maxEdges);
162161
}
163162

src/inmatrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ InMatrix::InMatrix(const char* filename, uint numPoints, float threshold) :
1111
Matrix(numPoints, threshold) {
1212
file = fopen(filename, "rb");
1313
if (!file)
14-
EXIT_MSG(filename);
14+
EXIT_MSG("Cannot open input file!");
1515

1616
// get length of file:
1717
pos = 0;

src/main.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,36 @@ int main(int argc, char **argv) {
3434

3535
if (!extractOptions("--matrix=%s", matFileName, argc, argv))
3636
EXIT_MSG("The path to input matrix file is required!");
37-
fprintf(stderr, "Input matrix: %s\n", matFileName);
37+
printf("Input matrix: %s\n", matFileName);
3838

3939
if (!extractOptions("--tree=%s", treeFileName, argc, argv))
4040
EXIT_MSG("The path to output tree file is required!");
41-
fprintf(stderr, "Output tree: %s\n", treeFileName);
41+
printf("Output tree: %s\n", treeFileName);
4242

4343
if (!extractOptions("--size=%u", &numPoints, argc, argv))
4444
EXIT_MSG("The number of data points is required!");
45-
fprintf(stderr, "Number of data points: %u\n", numPoints);
45+
printf("Data points: %u\n", numPoints);
4646

4747
if (!extractOptions("--threshold=%f", &threshold, argc, argv))
4848
EXIT_MSG("The distance threshold of the input matrix is required!");
49-
fprintf(stderr, "Distance threshold: %f\n", threshold);
49+
printf("Threshold: %f\n", threshold);
5050

5151
char buf[BUF_SIZE];
5252
if (extractOptions("--linkage=%s", buf, argc, argv)) {
5353
if (strcmp(buf, "average") == 0) {
5454
linkage = 0;
55-
fprintf(stderr, "Linkage: average\n");
55+
printf("Linkage: average\n");
5656
} else if (strcmp(buf, "complete") == 0) {
5757
linkage = 1;
58-
fprintf(stderr, "Linkage: complete\n");
58+
printf("Linkage: complete\n");
5959
} else if (strcmp(buf, "single") == 0) {
6060
linkage = 2;
61-
fprintf(stderr, "Linkage: single\n");
61+
printf("Linkage: single\n");
62+
} else if (strcmp(buf, "weighted") == 0) {
63+
linkage = 3;
64+
printf("Linkage: weighted\n");
6265
} else
63-
EXIT_MSG(
64-
"Invalid linkage option! SparseHC only supports average-linkage, complete-linkage and single-linkage.");
66+
EXIT_MSG( "Invalid linkage option! ");
6567
}
6668
initProfiler(1, "cluster");
6769

@@ -79,6 +81,8 @@ int main(int argc, char **argv) {
7981
cluster = new CompleteCluster(numPoints, treeFileName);
8082
else if (linkage == 2)
8183
cluster = new SingleCluster(numPoints, treeFileName);
84+
else if (linkage == 3)
85+
cluster = new AverageCluster(numPoints, treeFileName);
8286

8387
cluster->createLeaves();
8488
PROFILE("cluster", cluster->clusterMatrix(inMat));

0 commit comments

Comments
 (0)