Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
aac9e2cd
Commit
aac9e2cd
authored
Dec 06, 2010
by
Mathias Goldau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX #445] Now the dendrogram file will not be written every loop, but finally after the loop
parent
5ea3d7ca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
10 deletions
+71
-10
src/common/datastructures/WDendrogram.cpp
src/common/datastructures/WDendrogram.cpp
+11
-6
src/common/datastructures/WDendrogram.h
src/common/datastructures/WDendrogram.h
+2
-0
src/common/datastructures/test/WDendrogram_test.h
src/common/datastructures/test/WDendrogram_test.h
+10
-1
src/modules/gaussProcesses/detTractClusteringGP/WMDetTractClusteringGP.cpp
...Processes/detTractClusteringGP/WMDetTractClusteringGP.cpp
+2
-3
src/modules/gaussProcesses/detTractClusteringGP/test/WMDetTractClustering_test.h
...ses/detTractClusteringGP/test/WMDetTractClustering_test.h
+46
-0
No files found.
src/common/datastructures/WDendrogram.cpp
View file @
aac9e2cd
...
...
@@ -31,6 +31,7 @@
#include <vector>
#include "../WAssert.h"
#include "../WLogger.h"
#include "../WStringUtils.h"
#include "WDendrogram.h"
...
...
@@ -87,8 +88,8 @@ std::string WDendrogram::toTXTString() const
level
[
i
]
=
std
::
max
(
level
[
left
],
level
[
right
]
)
+
1
;
preds
[
m_parents
[
i
]
].
insert
(
i
);
std
::
set
<
size_t
>
join
;
std
::
set_union
(
childsOfInnerNodes
[
m_parents
[
i
]
].
begin
(),
childsOfInnerNodes
[
m_parents
[
i
]
].
end
(),
childsOfInnerNodes
[
i
].
begin
(),
childsOfInnerNodes
[
i
].
end
(),
std
::
inserter
(
join
,
join
.
begin
()
)
);
std
::
set_union
(
childsOfInnerNodes
[
m_parents
[
i
]
].
begin
(),
childsOfInnerNodes
[
m_parents
[
i
]
].
end
(),
childsOfInnerNodes
[
i
].
begin
(),
childsOfInnerNodes
[
i
].
end
(),
std
::
inserter
(
join
,
join
.
begin
()
)
);
childsOfInnerNodes
[
m_parents
[
i
]
]
=
join
;
ss
<<
"("
<<
level
[
i
]
<<
", ("
;
size_t
numElements
=
childsOfInnerNodes
[
i
].
size
();
...
...
@@ -106,10 +107,14 @@ std::string WDendrogram::toTXTString() const
}
using
string_utils
::
operator
<<
;
ss
<<
"("
<<
left
<<
", "
<<
right
<<
"), "
<<
m_heights
[
i
-
m_heights
.
size
()
-
1
]
<<
")"
<<
std
::
endl
;
// TODO(math): the needs to be made with a writer instead
std
::
ofstream
file
(
"/home/math/pansen.txt"
);
file
<<
ss
.
str
();
file
.
close
();
}
// TODO(math): the needs to be made with a writer instead
wlog
::
debug
(
"WDendrogram"
)
<<
"start writing the txt file to pansen.txt"
;
std
::
ofstream
file
(
"/home/math/pansen.txt"
);
file
<<
ss
.
str
();
file
.
close
();
wlog
::
debug
(
"WDendrogram"
)
<<
"written the txt file to pansen.txt"
;
return
ss
.
str
();
}
src/common/datastructures/WDendrogram.h
View file @
aac9e2cd
...
...
@@ -25,6 +25,8 @@
#ifndef WDENDROGRAM_H
#define WDENDROGRAM_H
#include <sstream>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
...
...
src/common/datastructures/test/WDendrogram_test.h
View file @
aac9e2cd
...
...
@@ -27,6 +27,7 @@
#include <cxxtest/TestSuite.h>
#include "../../WLogger.h"
#include "../WDendrogram.h"
/**
...
...
@@ -54,7 +55,7 @@ public:
{
WDendrogram
d
(
5
);
d
.
merge
(
0
,
1
,
0.8
);
// 5
d
.
merge
(
5
,
2
,
0.4
);
// 6
d
.
merge
(
5
,
2
,
0.4
);
// 6
d
.
merge
(
3
,
4
,
0.60
);
// 7
d
.
merge
(
6
,
7
,
0.32
);
// 8
std
::
stringstream
ss
;
...
...
@@ -74,6 +75,14 @@ public:
TS_FAIL
(
"Invalid dendrogram to string generation"
);
}
}
/**
* Sets up the WLogger to properly log some thing...
*/
void
setUp
(
void
)
{
WLogger
::
startup
();
}
};
#endif // WDENDROGRAM_TEST_H
src/modules/gaussProcesses/detTractClusteringGP/WMDetTractClusteringGP.cpp
View file @
aac9e2cd
...
...
@@ -138,8 +138,7 @@ boost::shared_ptr< WMDetTractClusteringGP::MST > WMDetTractClusteringGP::compute
// initialize the first the similarities to the root node.
const
WGaussProcess
&
root
=
dataSet
->
front
();
// is the root vertex of the MST
std
::
vector
<
double
>
similarities
(
dataSet
->
size
(),
0.0
);
similarities
[
0
]
=
wlimits
::
MAX_DOUBLE
;
// root node has maximal similarity and is selected first
for
(
size_t
i
=
1
;
i
<
dataSet
->
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
dataSet
->
size
();
++
i
)
{
const
WGaussProcess
&
p
=
(
*
dataSet
)[
i
];
if
(
root
.
getBB
().
minDistance
(
p
.
getBB
()
)
<
root
.
getMaxSegmentLength
()
+
p
.
getMaxSegmentLength
()
)
...
...
@@ -226,7 +225,7 @@ boost::shared_ptr< WDendrogram > WMDetTractClusteringGP::computeDendrogram( boos
size_t
u
=
cit
->
second
.
first
;
size_t
v
=
cit
->
second
.
second
;
// u and v may already
contain to
a cluster, thus we need their cannonical elements
// u and v may already
be a member of
a cluster, thus we need their cannonical elements
size_t
cEu
=
uf
.
find
(
u
);
size_t
cEv
=
uf
.
find
(
v
);
...
...
src/modules/gaussProcesses/detTractClusteringGP/test/WMDetTractClustering_test.h
0 → 100644
View file @
aac9e2cd
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMDETTRACTCLUSTERING_TEST_H
#define WMDETTRACTCLUSTERING_TEST_H
#include <cxxtest/TestSuite.h>
#include "../WMDetTractClustering.h"
/**
* TODO(math): Document this!
*/
class
WMDetTractClusteringTest
:
public
CxxTest
::
TestSuite
{
public:
/**
* TODO(math): Document this!
*/
void
testSomething
(
void
)
{
}
};
#endif // WMDETTRACTCLUSTERING_TEST_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment