Skip to content

Commit

Permalink
Merge pull request #81 from koheiw/fix-valgrind
Browse files Browse the repository at this point in the history
Fix valgrind
  • Loading branch information
koheiw authored Jun 29, 2024
2 parents 1cafc19 + 3d4eafd commit 13591ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ class Array {

//convert to arma::mat
arma::mat to_mat() {
std::vector<double> temp;
temp.reserve(row * col);
for (std::size_t i = 0; i < data.size(); i++) {
temp.insert(temp.end(), data[i].begin(), data[i].end());
arma::mat mt(row, col);
for (std::size_t r = 0; r < row; r++) {
for (std::size_t c = 0; c < col; c++) {
mt(r, c) = data[r][c];
}
}
arma::mat mt = arma::conv_to<arma::mat>::from(temp);
mt.reshape(col, row);
mt = mt.t();
return mt;
}

Expand Down
1 change: 0 additions & 1 deletion src/lda.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define ARMA_NO_DEBUG
#include "lib.h"
#include "dev.h"
#include "lda.h"
Expand Down

0 comments on commit 13591ff

Please sign in to comment.