[hamradio-commits] [gnss-sdr] 110/251: passing vectors by reference and not by value

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Wed Sep 2 00:22:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.

commit 490031b72c5e3e8ebfc137d7870c002b794a7a83
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Wed May 20 18:24:13 2015 +0200

    passing vectors by reference and not by value
---
 src/utils/front-end-cal/front_end_cal.cc | 29 ++++++++++++++---------------
 src/utils/front-end-cal/front_end_cal.h  |  4 ++--
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc
index f8f54a4..db12a95 100644
--- a/src/utils/front-end-cal/front_end_cal.cc
+++ b/src/utils/front-end-cal/front_end_cal.cc
@@ -282,20 +282,20 @@ bool FrontEndCal::get_ephemeris()
 }
 
 
-arma::vec FrontEndCal::lla2ecef(arma::vec lla)
+arma::vec FrontEndCal::lla2ecef(const arma::vec & lla)
 {
     // WGS84 flattening
-    double f = 1/298.257223563;
+    double f = 1.0 / 298.257223563;
 
     // WGS84 equatorial radius
-    double R = 6378137;
+    double R = 6378137.0;
 
     arma::vec ellipsoid = "0.0 0.0";
-    double phi = (lla(0)/360.0) * GPS_TWO_PI;
-    double lambda = (lla(1)/360.0) * GPS_TWO_PI;
+    double phi = (lla(0) / 360.0) * GPS_TWO_PI;
+    double lambda = (lla(1) / 360.0) * GPS_TWO_PI;
 
     ellipsoid(0) = R;
-    ellipsoid(1) = sqrt(1-(1-f)*(1-f));
+    ellipsoid(1) = sqrt(1.0 - (1.0 - f)*(1.0 - f));
 
     arma::vec ecef = "0.0 0.0 0.0 0.0";
     ecef = geodetic2ecef(phi, lambda, lla(3), ellipsoid);
@@ -304,18 +304,18 @@ arma::vec FrontEndCal::lla2ecef(arma::vec lla)
 }
 
 
-arma::vec FrontEndCal::geodetic2ecef(double phi, double lambda, double h, arma::vec ellipsoid)
+arma::vec FrontEndCal::geodetic2ecef(double phi, double lambda, double h, const arma::vec & ellipsoid)
 {
     double a = ellipsoid(0);
     double e2 = ellipsoid(1)*ellipsoid(1);
     double sinphi = sin(phi);
     double cosphi = cos(phi);
-    double N = a / sqrt(1 - e2 * sinphi*sinphi);
+    double N = a / sqrt(1.0 - e2 * sinphi*sinphi);
     arma::vec ecef = "0.0 0.0 0.0 0.0";
 
     ecef(0) = (N + h) * cosphi * cos(lambda);
     ecef(1) = (N + h) * cosphi * sin(lambda);
-    ecef(2) = (N*(1 - e2) + h) * sinphi;
+    ecef(2) = (N*(1.0 - e2) + h) * sinphi;
 
     return ecef;
 }
@@ -376,7 +376,6 @@ double FrontEndCal::estimate_doppler_from_eph(unsigned int PRN, double TOW, doub
             double mean_Doppler_Hz;
             mean_Doppler_Hz = arma::mean(Doppler_Hz);
             return mean_Doppler_Hz;
-            return 0;
         }
     else
         {
@@ -389,13 +388,13 @@ void FrontEndCal::GPS_L1_front_end_model_E4000(double f_bb_true_Hz, double f_bb_
 {
     const double f_osc_n = 28.8e6;
     //PLL registers settings (according to E4000 datasheet)
-    const double N = 109;
-    const double Y = 65536;
-    const double X = 26487;
-    const double R = 2;
+    const double N = 109.0;
+    const double Y = 65536.0;
+    const double X = 26487.0;
+    const double R = 2.0;
 
     // Obtained RF center frequency
-    double f_rf_pll = (f_osc_n*(N+X/Y))/R;
+    double f_rf_pll = (f_osc_n * (N + X / Y)) /R;
 
     // RF frequency error caused by fractional PLL roundings
     double f_bb_err_pll = GPS_L1_FREQ_HZ - f_rf_pll;
diff --git a/src/utils/front-end-cal/front_end_cal.h b/src/utils/front-end-cal/front_end_cal.h
index 852e5ed..51581b6 100644
--- a/src/utils/front-end-cal/front_end_cal.h
+++ b/src/utils/front-end-cal/front_end_cal.h
@@ -49,7 +49,7 @@ private:
      * coordinates, P.  LLA is in [degrees degrees meters].  P is in meters.
      * The default ellipsoid planet is WGS84. Original copyright (c) by Kai Borre.
      */
-    arma::vec lla2ecef(arma::vec lla);
+    arma::vec lla2ecef(const arma::vec & lla);
     /*!
      * GEODETIC2ECEF Convert geodetic to geocentric (ECEF) coordinates
      * [X, Y, Z] = GEODETIC2ECEF(PHI, LAMBDA, H, ELLIPSOID) converts geodetic
@@ -80,7 +80,7 @@ private:
      * Paul R. Wolf and Bon A. Dewitt, "Elements of Photogrammetry with
      * Applications in GIS," 3rd Ed., McGraw-Hill, 2000 (Appendix F-3).
      */
-    arma::vec geodetic2ecef(double phi, double lambda, double h, arma::vec ellipsoid);
+    arma::vec geodetic2ecef(double phi, double lambda, double h, const arma::vec & ellipsoid);
     /*!
      * \brief Reads the ephemeris data from an external XML file
      *

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list