ARBase.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ARBase.cpp 2620 2011-05-26 14:42:13Z yanweignss $"
00002 
00008 //============================================================================
00009 //
00010 //  This file is part of GPSTk, the GPS Toolkit.
00011 //
00012 //  The GPSTk is free software; you can redistribute it and/or modify
00013 //  it under the terms of the GNU Lesser General Public License as published
00014 //  by the Free Software Foundation; either version 2.1 of the License, or
00015 //  any later version.
00016 //
00017 //  The GPSTk is distributed in the hope that it will be useful,
00018 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //  GNU Lesser General Public License for more details.
00021 //
00022 //  You should have received a copy of the GNU Lesser General Public
00023 //  License along with GPSTk; if not, write to the Free Software Foundation,
00024 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 //
00026 //  Wei Yan - Chinese Academy of Sciences . 2011
00027 //
00028 //============================================================================
00029 
00030 #include "ARBase.hpp"
00031 
00032 
00033 namespace gpstk
00034 {
00035       // This method to get the convert matrix from SD ambiguity to DD 
00036       // ambiguity
00037    Matrix<double> ARBase::sd2ddMatrix(const size_t& n, const size_t& i)
00038       throw(ARException)
00039    {
00040       if( i >= n)
00041       {
00042          Exception e("The reference index CAN NOT greater than toltal number.");
00043          GPSTK_THROW(e);
00044       }
00045 
00046       Matrix<double> sdMat(n-1, n, 0.0);
00047 
00048       for(int j = 0; j< sdMat.rows(); j++)
00049       {
00050          sdMat(j,i) = -1.0;
00051          if(j<i) sdMat(j,j) = 1.0;  
00052          else    sdMat(j,j+1) = 1.0;    
00053       }
00054 
00055       return sdMat;
00056 
00057    }  // End of method 'ARBase::sd2ddMatrix()'
00058    
00059       // Compute float ambiguity by selection of the parameter weight method
00060    void ARBase::computeFloatAmbiguity(const Matrix<double>& A, 
00061                                       const Matrix<double>& B, 
00062                                       const Matrix<double>& W,
00063                                       const Vector<double>& y, 
00064                                       Vector<double>& ambFloat,
00065                                       Matrix<double>& ambCov,
00066                                       double smFactor)
00067       throw(ARException)
00068    {
00069       try
00070       {
00071             // check the smooth factor
00072          if( (smFactor< 0.001) || (smFactor>0.0001))
00073          {
00074             smFactor = 0.001;
00075          }
00076 
00077          Matrix<double> I = ident<double>(A.rows());
00078          Matrix<double> AT = transpose(A);
00079          Matrix<double> ATW = AT*W;
00080 
00081          Matrix<double> Px = diag(ATW*A);
00082 
00083          Matrix<double> Ja = I - A * inverseSVD(ATW * A + smFactor*Px) * ATW;
00084 
00085          Matrix<double> BTWJ = transpose(B) * W * Ja;
00086 
00087          ambFloat= inverseSVD(BTWJ * B) * BTWJ * y;
00088          ambCov = inverseSVD(BTWJ * B);
00089       }
00090       catch (...)
00091       {
00092          ARException e("Failed to compute float ambiguity.");
00093          GPSTK_THROW(e);
00094       }
00095    
00096    }  // End of method 'ARLambda::computeFloatAmbiguity()'
00097 
00098 }   // End of namespace gpstk
00099 

Generated on Tue May 22 03:30:56 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1