[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/02: fec: LDPC: patch for issue #847.
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/02: fec: LDPC: patch for issue #847. |
Date: |
Mon, 2 Nov 2015 15:48:19 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit c93470b71a44b3bbdc32c0fc30bb7122dc3f4d5a
Author: Tom Rondeau <address@hidden>
Date: Fri Oct 16 17:06:23 2015 -0400
fec: LDPC: patch for issue #847.
GSL didn't introduce gsl_matrix_equal until 1.15 and GNU Radio only
requires 1.10. This is an attempt to calculate if the two matrices are
equal by subtracting one from the other and seeing if the max element
is greater than 0 (all elements should be 0 if they are the same
matrix).
---
gr-fec/lib/fec_mtrx_impl.cc | 6 ++++--
gr-fec/lib/ldpc_G_matrix_impl.cc | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gr-fec/lib/fec_mtrx_impl.cc b/gr-fec/lib/fec_mtrx_impl.cc
index 7c4dd34..88027ff 100644
--- a/gr-fec/lib/fec_mtrx_impl.cc
+++ b/gr-fec/lib/fec_mtrx_impl.cc
@@ -479,9 +479,11 @@ namespace gr {
gsl_matrix *identity = gsl_matrix_alloc(n,n);
gsl_matrix_set_identity(identity);
- int test_if_equal = gsl_matrix_equal(identity,test);
+ //int test_if_equal = gsl_matrix_equal(identity,test);
+ gsl_matrix_sub(identity, test); // should be null set if equal
+ double test_if_not_equal = gsl_matrix_max(identity);
- if (!test_if_equal) {
+ if(test_if_not_equal > 0) {
throw "Error in calc_inverse_mod2(): The matrix inverse found is not
valid.\n";
}
diff --git a/gr-fec/lib/ldpc_G_matrix_impl.cc b/gr-fec/lib/ldpc_G_matrix_impl.cc
index d0a6df1..2c94695 100644
--- a/gr-fec/lib/ldpc_G_matrix_impl.cc
+++ b/gr-fec/lib/ldpc_G_matrix_impl.cc
@@ -77,13 +77,16 @@ namespace gr {
}
// Check if the identity matrix exists in the right spot.
- int test_if_equal = gsl_matrix_equal(identity, I_test);
+ //int test_if_equal = gsl_matrix_equal(identity, I_test);
+ gsl_matrix_sub(identity, I_test); // should be null set if equal
+ double test_if_not_equal = gsl_matrix_max(identity);
// Free memory
gsl_matrix_free(identity);
gsl_matrix_free(I_test);
- if(!test_if_equal) {
+ //if(!test_if_equal) {
+ if(test_if_not_equal > 0) {
GR_LOG_ERROR(d_logger,
"Error in ldpc_G_matrix_impl constructor. It appears "
"that the given alist file did not contain either a "