Skip to content

Commit 9abedc3

Browse files
committed
now using the new version of jacobi_pd
1 parent 106d023 commit 9abedc3

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

include/superpose3d.hpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
#define _SUPERPOSE3D_HPP
99

1010

11-
#include "matrix_alloc.hpp" //convenient allocation function for 2D arrays
12-
#include "peigencalc.hpp" //calculate eigenvalues and eigenvectors
11+
#include "matrix_alloc_jpd.hpp" // Defines "Alloc2D()" and "Dealloc2D()"
12+
#include "peigencalc.hpp" // Calculates eigenvalues and eigenvectors
1313

1414

1515

1616
namespace superpose3d {
1717

18+
using namespace matrix_alloc_jpd;
19+
1820
// -----------------------------------------------------------
1921
// ------------------------ INTERFACE ------------------------
2022
// -----------------------------------------------------------
@@ -372,22 +374,22 @@ Alloc(size_t N) {
372374
aWeights = new Scalar [N];
373375
for (size_t i = 0; i < N; i++)
374376
aWeights[i] = 1.0 / N;
375-
matrix_alloc::Alloc2D(3, 3, &R);
376-
matrix_alloc::Alloc2D(N, 3, &aaXf_shifted);
377-
matrix_alloc::Alloc2D(N, 3, &aaXm_shifted);
377+
Alloc2D(3, 3, &R);
378+
Alloc2D(N, 3, &aaXf_shifted);
379+
Alloc2D(N, 3, &aaXm_shifted);
378380
}
379381

380382
template<typename Scalar, typename ConstArrayOfCoords, typename ConstArray>
381383
void Superpose3D<Scalar, ConstArrayOfCoords, ConstArray>::
382384
Dealloc() {
383385
if (R)
384-
matrix_alloc::Dealloc2D(&R);
386+
Dealloc2D(&R);
385387
if (aWeights)
386388
delete [] aWeights;
387389
if (aaXf_shifted)
388-
matrix_alloc::Dealloc2D(&aaXf_shifted);
390+
Dealloc2D(&aaXf_shifted);
389391
if (aaXm_shifted)
390-
matrix_alloc::Dealloc2D(&aaXm_shifted);
392+
Dealloc2D(&aaXm_shifted);
391393
}
392394

393395
// memory management: copy and move constructor, swap, and assignment operator:

tests/test_superpose3d.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
#include <chrono>
3232
#include <random>
3333

34-
#include "superpose3d.hpp"
34+
#include "superpose3d.hpp" // Defines "Superpose3D"
35+
#include "matrix_alloc_jpd.hpp" // Defines "Alloc2D()" and "Dealloc2D()"
36+
3537
using namespace superpose3d;
38+
using namespace matrix_alloc_jpd;
3639

3740

3841
int main(int argc, char **argv) {
@@ -61,11 +64,11 @@ int main(int argc, char **argv) {
6164
w[i] = 1.0 / n_points;
6265

6366
// Allocate the immobile point cloud array (X) and fill it with coordinates
64-
matrix_alloc::Alloc2D(n_points, 3, &X);
67+
Alloc2D(n_points, 3, &X);
6568
// Allocate the mobile point cloud array (x) and fill it with coordinates
66-
matrix_alloc::Alloc2D(n_points, 3, &x);
69+
Alloc2D(n_points, 3, &x);
6770
// Allocate space for the transformed mobile point cloud
68-
matrix_alloc::Alloc2D(n_points, 3, &xprime);
71+
Alloc2D(n_points, 3, &xprime);
6972

7073
int seed = std::chrono::system_clock::now().time_since_epoch().count();
7174
std::default_random_engine rand_generator(seed);
@@ -168,9 +171,9 @@ int main(int argc, char **argv) {
168171

169172
} // for (i_cl = 0; i_cl < n_point_clouds; i_cl++)
170173

171-
matrix_alloc::Dealloc2D(&xprime);
172-
matrix_alloc::Dealloc2D(&X);
173-
matrix_alloc::Dealloc2D(&x);
174+
Dealloc2D(&xprime);
175+
Dealloc2D(&X);
176+
Dealloc2D(&x);
174177
delete [] w;
175178

176179
std::cout << "\n" << "test passed." << std::endl;

0 commit comments

Comments
 (0)