[hamradio-commits] [gnss-sdr] 106/251: passing vectors and matrices by reference instead of 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 dea2f74266d4594dc3e9b50fd29f6945ddeb85ad
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Tue May 19 22:09:30 2015 +0200

    passing vectors and matrices by reference instead of by value
---
 src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc |  6 +++---
 src/algorithms/PVT/libs/galileo_e1_ls_pvt.h  |  6 +++---
 src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc  |  6 +++---
 src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.h   |  6 +++---
 src/algorithms/PVT/libs/hybrid_ls_pvt.cc     | 18 +++++++++---------
 src/algorithms/PVT/libs/hybrid_ls_pvt.h      |  6 +++---
 6 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc
index 0decedc..f19f2c6 100644
--- a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc
+++ b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc
@@ -79,7 +79,7 @@ galileo_e1_ls_pvt::~galileo_e1_ls_pvt()
 }
 
 
-arma::vec galileo_e1_ls_pvt::rotateSatellite(double traveltime, arma::vec X_sat)
+arma::vec galileo_e1_ls_pvt::rotateSatellite(double traveltime, const arma::vec & X_sat)
 {
     /*
      *  Returns rotated satellite ECEF coordinates due to Earth
@@ -116,7 +116,7 @@ arma::vec galileo_e1_ls_pvt::rotateSatellite(double traveltime, arma::vec X_sat)
 }
 
 
-arma::vec galileo_e1_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w)
+arma::vec galileo_e1_ls_pvt::leastSquarePos(const arma::mat & satpos, const arma::vec & obs, const arma::mat & w)
 {
     /* Computes the Least Squares Solution.
      *   Inputs:
@@ -660,7 +660,7 @@ void galileo_e1_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double
 }
 
 
-void galileo_e1_ls_pvt::topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx)
+void galileo_e1_ls_pvt::topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx)
 {
     /*  Transformation of vector dx into topocentric coordinate
 	system with origin at x
diff --git a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h
index 8bd0bdc..1119a22 100644
--- a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h
+++ b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h
@@ -58,9 +58,9 @@
 class galileo_e1_ls_pvt
 {
 private:
-    arma::vec leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w);
-    arma::vec rotateSatellite(double traveltime, arma::vec X_sat);
-    void topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx);
+    arma::vec leastSquarePos(const arma::mat & satpos, const arma::vec & obs, const arma::mat & w);
+    arma::vec rotateSatellite(double traveltime, const arma::vec & X_sat);
+    void topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx);
     void togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z);
     void tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
 public:
diff --git a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc
index 7c9e7a9..6f56c08 100644
--- a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc
+++ b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc
@@ -99,7 +99,7 @@ gps_l1_ca_ls_pvt::~gps_l1_ca_ls_pvt()
 }
 
 
-arma::vec gps_l1_ca_ls_pvt::rotateSatellite(double traveltime, arma::vec X_sat)
+arma::vec gps_l1_ca_ls_pvt::rotateSatellite(double traveltime, const arma::vec & X_sat)
 {
     /*
      *  Returns rotated satellite ECEF coordinates due to Earth
@@ -136,7 +136,7 @@ arma::vec gps_l1_ca_ls_pvt::rotateSatellite(double traveltime, arma::vec X_sat)
 }
 
 
-arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w)
+arma::vec gps_l1_ca_ls_pvt::leastSquarePos(const arma::mat & satpos, const arma::vec & obs, const arma::mat & w)
 {
     /* Computes the Least Squares Solution.
      *   Inputs:
@@ -655,7 +655,7 @@ void gps_l1_ca_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double a
 }
 
 
-void gps_l1_ca_ls_pvt::topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx)
+void gps_l1_ca_ls_pvt::topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx)
 {
     /*  Transformation of vector dx into topocentric coordinate
 	system with origin at x
diff --git a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.h b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.h
index 207a0cf..c7e3bab 100644
--- a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.h
+++ b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.h
@@ -61,9 +61,9 @@
 class gps_l1_ca_ls_pvt
 {
 private:
-    arma::vec leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w);
-    arma::vec rotateSatellite(double traveltime, arma::vec X_sat);
-    void topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx);
+    arma::vec leastSquarePos(const arma::mat & satpos, const arma::vec & obs, const arma::mat & w);
+    arma::vec rotateSatellite(double traveltime, const arma::vec & X_sat);
+    void topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx);
     void togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z);
     void tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
 public:
diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc
index 84b6ca3..72d0fd4 100644
--- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc
+++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc
@@ -81,7 +81,7 @@ hybrid_ls_pvt::~hybrid_ls_pvt()
 }
 
 
-arma::vec hybrid_ls_pvt::rotateSatellite(double traveltime, arma::vec X_sat)
+arma::vec hybrid_ls_pvt::rotateSatellite(double traveltime, const arma::vec & X_sat)
 {
     /*
      *  Returns rotated satellite ECEF coordinates due to Earth
@@ -118,7 +118,7 @@ arma::vec hybrid_ls_pvt::rotateSatellite(double traveltime, arma::vec X_sat)
 }
 
 
-arma::vec hybrid_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w)
+arma::vec hybrid_ls_pvt::leastSquarePos(const arma::mat & satpos, const arma::vec & obs, const arma::mat & w)
 {
     /* Computes the Least Squares Solution.
      *   Inputs:
@@ -190,7 +190,7 @@ arma::vec hybrid_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma::m
                                     togeod(&dphi, &dlambda, &h, 6378137.0, 298.257223563, pos(0), pos(1), pos(2));
 
                                     //--- Find delay due to troposphere (in meters)
-                                    tropo(&trop, sin(d_visible_satellites_El[i] * GALILEO_PI/180.0), h/1000, 1013.0, 293.0, 50.0, 0.0, 0.0, 0.0);
+                                    tropo(&trop, sin(d_visible_satellites_El[i] * GALILEO_PI/180.0), h / 1000.0, 1013.0, 293.0, 50.0, 0.0, 0.0, 0.0);
                                     if(trop > 50.0 ) trop = 0.0;
                                 }
                         }
@@ -642,17 +642,17 @@ void hybrid_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double a, d
     *h = 0;
     double tolsq = 1.e-10;  // tolerance to accept convergence
     int maxit = 10;         // max number of iterations
-    double rtd = 180/GPS_PI;
+    double rtd = 180.0 / GPS_PI;
 
     // compute square of eccentricity
     double esq;
     if (finv < 1.0E-20)
         {
-            esq = 0;
+            esq = 0.0;
         }
     else
         {
-            esq = (2 - 1/finv) / finv;
+            esq = (2.0 - 1.0 / finv) / finv;
         }
 
     // first guess
@@ -695,14 +695,14 @@ void hybrid_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double a, d
             return;
         }
 
-    *h = r - a*(1 - sinphi*sinphi/finv);
+    *h = r - a*(1.0 - sinphi*sinphi/finv);
 
     // iterate
     double cosphi;
     double N_phi;
     double dP;
     double dZ;
-    double oneesq = 1 - esq;
+    double oneesq = 1.0 - esq;
 
     for (int i = 0; i < maxit; i++)
         {
@@ -734,7 +734,7 @@ void hybrid_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double a, d
 }
 
 
-void hybrid_ls_pvt::topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx)
+void hybrid_ls_pvt::topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx)
 {
     /*  Transformation of vector dx into topocentric coordinate
 	system with origin at x
diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.h b/src/algorithms/PVT/libs/hybrid_ls_pvt.h
index 2611213..a989532 100644
--- a/src/algorithms/PVT/libs/hybrid_ls_pvt.h
+++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.h
@@ -62,9 +62,9 @@
 class hybrid_ls_pvt
 {
 private:
-    arma::vec leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w);
-    arma::vec rotateSatellite(double traveltime, arma::vec X_sat);
-    void topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx);
+    arma::vec leastSquarePos(const arma::mat & satpos, const arma::vec & obs, const arma::mat & w);
+    arma::vec rotateSatellite(double traveltime, const arma::vec & X_sat);
+    void topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx);
     void togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z);
     void tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
 public:

-- 
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