SCM Repository

[matrix] View of /pkg/src/LU.c
ViewVC logotype

View of /pkg/src/LU.c

Parent Directory Parent Directory | Revision Log Revision Log

Revision 332 - (download) (as text) (annotate)
Fri Nov 12 21:04:36 2004 UTC (15 years, 2 months ago) by bates
File size: 1412 byte(s)
initialize all slots in a NEW_OBJECT
#include "LU.h"

/* FIXME - add the permutation matrix P to the result */
SEXP LU_expand(SEXP x)
	val = PROTECT(allocVector(VECSXP, 2)),
	nms = PROTECT(allocVector(STRSXP, 2)),
	lux = GET_SLOT(x, Matrix_xSym),
	dd = GET_SLOT(x, Matrix_DimSym);
    int i, n;
    double *lx;

    n = *INTEGER(dd);
    SET_STRING_ELT(nms, 0, mkChar("L"));
    SET_STRING_ELT(nms, 1, mkChar("U"));
    setAttrib(val, R_NamesSymbol, nms);
    SET_VECTOR_ELT(val, 0, L);
    SET_VECTOR_ELT(val, 1, U);
    SET_SLOT(L, Matrix_xSym, duplicate(lux));
    SET_SLOT(L, Matrix_DimSym, dd);
    SET_SLOT(L, Matrix_uploSym, ScalarString(mkChar("L")));
    SET_SLOT(L, Matrix_diagSym, ScalarString(mkChar("U")));
    SET_SLOT(L, Matrix_rcondSym, allocVector(REALSXP, 0));
    SET_SLOT(L, Matrix_factorization, allocVector(VECSXP, 0));
    make_array_triangular(REAL(GET_SLOT(L, Matrix_xSym)), L);
    SET_SLOT(U, Matrix_xSym, duplicate(lux));
    SET_SLOT(U, Matrix_DimSym, dd);
    SET_SLOT(U, Matrix_uploSym, ScalarString(mkChar("U")));
    SET_SLOT(U, Matrix_diagSym, ScalarString(mkChar("N")));
    SET_SLOT(U, Matrix_rcondSym, allocVector(REALSXP, 0));
    SET_SLOT(U, Matrix_factorization, allocVector(VECSXP, 0));
    make_array_triangular(REAL(GET_SLOT(U, Matrix_xSym)), U);
    return val;

ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge