[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 08/17: gr-fec: free memory for G matrix at
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 08/17: gr-fec: free memory for G matrix at end of constructor |
Date: |
Thu, 14 Apr 2016 20:43:04 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit 1252e03f982f848082ef1e78bda922ddbedfea32
Author: tracierenea <address@hidden>
Date: Wed Apr 6 12:08:22 2016 -0500
gr-fec: free memory for G matrix at end of constructor
There's no reason to make the G matrix a data member of this class and keep
it around in memory. It's not used for encoding or decoding, so once we've used
G to get G' and H, we can free that memory.
---
gr-fec/lib/ldpc_G_matrix_impl.cc | 13 ++++++-------
gr-fec/lib/ldpc_G_matrix_impl.h | 1 -
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/gr-fec/lib/ldpc_G_matrix_impl.cc b/gr-fec/lib/ldpc_G_matrix_impl.cc
index 2c94695..8ed7969 100644
--- a/gr-fec/lib/ldpc_G_matrix_impl.cc
+++ b/gr-fec/lib/ldpc_G_matrix_impl.cc
@@ -51,8 +51,8 @@ namespace gr {
// Make an actual copy so we guarantee that we're not sharing
// memory with another class that reads the same alist file.
- gsl_matrix *temp_mtrx = gsl_matrix_alloc(d_num_rows, d_num_cols);
- gsl_matrix_memcpy(temp_mtrx, (gsl_matrix*)(x.get()));
+ gsl_matrix *G = gsl_matrix_alloc(d_num_rows, d_num_cols);
+ gsl_matrix_memcpy(G, (gsl_matrix*)(x.get()));
unsigned int row_index, col_index;
@@ -71,7 +71,7 @@ namespace gr {
for(row_index = 0; row_index < d_k; row_index++) {
for(col_index = 0; col_index < d_k; col_index++) {
- int value = gsl_matrix_get(temp_mtrx, row_index, col_index);
+ int value = gsl_matrix_get(G, row_index, col_index);
gsl_matrix_set(I_test, row_index, col_index, value);
}
}
@@ -97,13 +97,12 @@ namespace gr {
// Our G matrix is verified as correct, now convert it to the
// parity check matrix.
- d_G_ptr = temp_mtrx;
// Grab P matrix
gsl_matrix *P = gsl_matrix_alloc(d_k, d_n-d_k);
for(row_index = 0; row_index < d_k; row_index++) {
for(col_index = 0; col_index < d_n-d_k; col_index++) {
- int value = gsl_matrix_get(d_G_ptr, row_index, col_index + d_k);
+ int value = gsl_matrix_get(G, row_index, col_index + d_k);
gsl_matrix_set(P, row_index, col_index, value);
}
}
@@ -130,13 +129,14 @@ namespace gr {
// Calculate G transpose (used for encoding)
d_G_transp_ptr = gsl_matrix_alloc(d_n, d_k);
- gsl_matrix_transpose_memcpy(d_G_transp_ptr, d_G_ptr);
+ gsl_matrix_transpose_memcpy(d_G_transp_ptr, G);
d_H_sptr = matrix_sptr((matrix*)H_ptr);
// Free memory
gsl_matrix_free(P);
gsl_matrix_free(P_transpose);
+ gsl_matrix_free(G);
}
@@ -288,7 +288,6 @@ namespace gr {
ldpc_G_matrix_impl::~ldpc_G_matrix_impl()
{
// Call the gsl_matrix_free function to free memory.
- gsl_matrix_free(d_G_ptr);
gsl_matrix_free(d_G_transp_ptr);
}
} /* namespace code */
diff --git a/gr-fec/lib/ldpc_G_matrix_impl.h b/gr-fec/lib/ldpc_G_matrix_impl.h
index b9b119d..5c2c44f 100644
--- a/gr-fec/lib/ldpc_G_matrix_impl.h
+++ b/gr-fec/lib/ldpc_G_matrix_impl.h
@@ -62,7 +62,6 @@ namespace gr {
// GSL matrix structure for transpose of G
gsl_matrix *d_G_transp_ptr;
- gsl_matrix *d_G_ptr;
gsl_matrix *d_H_obj;
//! Get the generator matrix (used during encoding)
- [Commit-gnuradio] [gnuradio] branch maint updated (b7da9af -> bc60fdb), git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 05/17: gr-fec: LDPC python function - making a better docstring, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 11/17: gr-fec, LDPC: correct the name of the python function called, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 08/17: gr-fec: free memory for G matrix at end of constructor,
git <=
- [Commit-gnuradio] [gnuradio] 12/17: gr-fec, LDPC: use mult_matrices_mod2 function, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 04/17: gr-fec: LDPC python function - addressing an attribute error, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 06/17: gr-fec: LDPC python - adding a handy function, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 09/17: gr-fec: free memory for info word in LDPC gen mtrx encoder, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 10/17: gr-fec: free memory used for the LDPC H matrix in the destructor, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 02/17: gr-fec: LDPC python function - addressing an "undefined" error, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 14/17: float(version) doesn't work with "1.9.0"; fixed nx version checking, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 17/17: Merge remote-tracking branch 'tracierenea/fec_ldpc_H_fix' into maint, git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 01/17: gr-fec: Fix memory allocation issue during encoding., git, 2016/04/14
- [Commit-gnuradio] [gnuradio] 13/17: grc: update year in copyright, git, 2016/04/14