SCM

SCM Repository

[matrix] Diff of /pkg/src/dtrMatrix.c
ViewVC logotype

Diff of /pkg/src/dtrMatrix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 592, Thu Mar 3 05:16:50 2005 UTC revision 597, Thu Mar 3 19:58:59 2005 UTC
# Line 189  Line 189 
189      UNPROTECT(1);      UNPROTECT(1);
190      return val;      return val;
191  }  }
192    
193    SEXP dtrMatrix_as_dtpMatrix(SEXP from)
194    {
195        SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("dtpMatrix"))),
196            uplo = GET_SLOT(from, Matrix_uploSym),
197            diag = GET_SLOT(from, Matrix_diagSym),
198            dimP = GET_SLOT(from, Matrix_DimSym);
199        int n = *INTEGER(dimP);
200    
201        SET_SLOT(val, Matrix_rcondSym,
202                 duplicate(GET_SLOT(from, Matrix_rcondSym)));
203        SET_SLOT(val, Matrix_DimSym, duplicate(dimP));
204        SET_SLOT(val, Matrix_diagSym, duplicate(diag));
205        SET_SLOT(val, Matrix_uploSym, duplicate(uplo));
206        full_to_packed(REAL(ALLOC_SLOT(val, Matrix_xSym, REALSXP, (n*(n+1))/2)),
207                       REAL(GET_SLOT(from, Matrix_xSym)), n,
208                       *CHAR(STRING_ELT(uplo, 0)) == 'U' ? UPP : LOW,
209                       *CHAR(STRING_ELT(diag, 0)) == 'U' ? UNT : NUN);
210        UNPROTECT(1);
211        return val;
212    }

Legend:
Removed from v.592  
changed lines
  Added in v.597

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge