Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix valgrind #81

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading