Changeset 7168a54 in tol


Ignore:
Timestamp:
Mar 9, 2009, 8:57:39 AM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
9a6c6f7
Parents:
516e91c
Message:

Using VMatrix sparse Choleski decomposition to solve system related to ARMA autocovariance

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@706 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/bmath/bstat/arma.cpp

    r516e91c r7168a54  
    2525
    2626#include <tol/tol_matrix.h>
     27#include <tol/tol_bvmat.h>
    2728#include <tol/tol_barma.h>
    2829#include <tol/tol_bstat.h>
    … …  
    579580    BMat gp, test;
    580581    BDat err;
     582   
     583    BVMat ms, As, Ls, gps;
     584    As.DMat2sparse((const BMatrix<double>&)A);
     585    ms.DMat2sparse((const BMatrix<double>&)m);
     586    BVMat::CholeskiFactor(As,Ls,"XtX",true,false);
     587    BVMat::CholeskiSolve(Ls,(ms.T()*As).T(),gps,"PtLLtP");
     588    gps.GetDMat((BMatrix<double>&)gp);
     589    test = A*gp-m;
     590    err  = test.FrobeniusNorm();
    581591
    582592//*
    583593  //TRZ(psi); TRZ(m); TRZ(A);
    584 
     594/*
    585595    if(p>100)
    586596    {
    … …  
    602612      }
    603613    }
     614*/
     615    bool closeToNonStationary = false;
    604616    if(err.IsUnknown()  || (err>Sqrt((1+p)*DEpsilon())))
    605617    {
     618      closeToNonStationary = true;
    606619      BText method = BText("Golub_Reinsch_Mod");
    607620      BMat U, V;
    … …  
    622635      return(false);
    623636    }
    624     else if(err>Sqrt((1+p)*DEpsilon()))
    625     {  
     637    else if(closeToNonStationary)
     638    {
    626639      Warning(I2("ARMA structure is not numerically stationary. "
    627640                 "Lost precision for autocovarianze matrix: ",
Note: See TracChangeset for help on using the changeset viewer.