Main Page | Directories | File List | File Members | Related Pages

Classes.c

Go to the documentation of this file.
00001 
00009 #include "party.h"
00010 
00011 SEXP 
00012     PL2_expectationSym,
00013     PL2_covarianceSym,
00014     PL2_linearstatisticSym,
00015     PL2_expcovinfSym,
00016     PL2_expcovinfssSym,
00017     PL2_sumweightsSym,
00018     PL2_dimensionSym,
00019     PL2_MPinvSym,  
00020     PL2_rankSym,
00021     PL2_svdSym,
00022     PL2_svdmemSym,
00023     PL2_methodSym,
00024     PL2_jobuSym, 
00025     PL2_jobvSym, 
00026     PL2_uSym,
00027     PL2_vSym,
00028     PL2_sSym,
00029     PL2_pSym,
00030     PL2_teststatSym,
00031     PL2_pvalueSym,
00032     PL2_tolSym,
00033     PL2_maxptsSym,
00034     PL2_absepsSym,
00035     PL2_relepsSym,
00036     PL2_minprobSym,
00037     PL2_minsplitSym,
00038     PL2_minbucketSym,
00039     PL2_variablesSym, 
00040     PL2_transformationsSym, 
00041     PL2_is_nominalSym, 
00042     PL2_is_ordinalSym, 
00043     PL2_is_censoredSym, 
00044     PL2_orderingSym, 
00045     PL2_levelsSym, 
00046     PL2_scoresSym, 
00047     PL2_has_missingsSym, 
00048     PL2_whichNASym, 
00049     PL2_jointtransfSym, 
00050     PL2_nobsSym, 
00051     PL2_ninputsSym,
00052     PL2_linexpcov2sampleSym, 
00053     PL2_weightsSym, 
00054     PL2_varmemorySym,
00055     PL2_varMmemorySym, 
00056     PL2_MscorematricesSym,
00057     PL2_splitstatisticsSym,
00058     PL2_savesplitstatsSym,
00059     PL2_responsesSym, 
00060     PL2_inputsSym,
00061     PL2_testtypeSym, 
00062     PL2_nresampleSym,
00063     PL2_varctrlSym, 
00064     PL2_splitctrlSym, 
00065     PL2_gtctrlSym,
00066     PL2_mincriterionSym,
00067     PL2_maxsurrogateSym,
00068     PL2_randomsplitsSym,
00069     PL2_mtrySym,
00070     PL2_dontuseSym,
00071     PL2_dontusetmpSym,
00072     PL2_stumpSym,
00073     PL2_maxdepthSym,
00074     PL2_tgctrlSym;
00075 
00076 SEXP party_init(void) {
00077     PL2_expectationSym = install("expectation");
00078     PL2_covarianceSym = install("covariance");
00079     PL2_linearstatisticSym = install("linearstatistic");
00080     PL2_expcovinfSym = install("expcovinf");
00081     PL2_expcovinfssSym = install("expcovinfss");
00082     PL2_sumweightsSym = install("sumweights");
00083     PL2_dimensionSym = install("dimension");
00084     PL2_MPinvSym = install("MPinv");
00085     PL2_rankSym = install("rank");
00086     PL2_svdSym = install("svd");
00087     PL2_svdmemSym = install("svdmem");
00088     PL2_methodSym = install("method");
00089     PL2_jobuSym = install("jobu");
00090     PL2_jobvSym = install("jobv");
00091     PL2_uSym = install("u");
00092     PL2_vSym = install("v");
00093     PL2_sSym = install("s");
00094     PL2_pSym = install("p"); 
00095     PL2_teststatSym = install("teststat");
00096     PL2_pvalueSym = install("pvalue");
00097     PL2_tolSym = install("tol");
00098     PL2_maxptsSym = install("maxpts");
00099     PL2_absepsSym = install("abseps");
00100     PL2_relepsSym = install("releps");
00101     PL2_minsplitSym = install("minsplit");
00102     PL2_minprobSym = install("minprob");
00103     PL2_minbucketSym = install("minbucket");
00104     PL2_variablesSym = install("variables"); 
00105     PL2_transformationsSym = install("transformations"); 
00106     PL2_is_nominalSym = install("is_nominal"); 
00107     PL2_is_ordinalSym = install("is_ordinal"); 
00108     PL2_is_censoredSym = install("is_censored"); 
00109     PL2_orderingSym = install("ordering"); 
00110     PL2_levelsSym = install("levels"); 
00111     PL2_scoresSym = install("scores"); 
00112     PL2_has_missingsSym = install("has_missings"); 
00113     PL2_whichNASym = install("whichNA"); 
00114     PL2_jointtransfSym = install("jointtransf"); 
00115     PL2_nobsSym = install("nobs"); 
00116     PL2_ninputsSym = install("ninputs"); 
00117     PL2_linexpcov2sampleSym = install("linexpcov2sample"); 
00118     PL2_weightsSym = install("weights"); 
00119     PL2_varmemorySym = install("varmemory"); 
00120     PL2_varMmemorySym = install("varMmemory"); 
00121     PL2_MscorematricesSym = install("Mscorematrices"); 
00122     PL2_splitstatisticsSym = install("splitstatistics");
00123     PL2_savesplitstatsSym = install("savesplitstats");
00124     PL2_responsesSym = install("responses"); 
00125     PL2_inputsSym = install("inputs"); 
00126     PL2_testtypeSym = install("testtype"); 
00127     PL2_nresampleSym = install("nresample"); 
00128     PL2_varctrlSym = install("varctrl"); 
00129     PL2_splitctrlSym = install("splitctrl"); 
00130     PL2_gtctrlSym = install("gtctrl"); 
00131     PL2_mincriterionSym = install("mincriterion"); 
00132     PL2_maxsurrogateSym = install("maxsurrogate"); 
00133     PL2_randomsplitsSym = install("randomsplits"); 
00134     PL2_mtrySym = install("mtry"); 
00135     PL2_dontuseSym = install("dontuse"); 
00136     PL2_dontusetmpSym = install("dontusetmp"); 
00137     PL2_stumpSym = install("stump"); 
00138     PL2_maxdepthSym = install("maxdepth"); 
00139     PL2_tgctrlSym = install("tgctrl"); 
00140     return(R_NilValue);
00141 }
00142 
00143 /* accessor functions */
00144 
00145 int get_dimension(SEXP object) {
00146     return(INTEGER(GET_SLOT(object, PL2_dimensionSym))[0]);
00147 }
00148 
00149 int get_teststat(SEXP object) {
00150     return(INTEGER(GET_SLOT(object, PL2_teststatSym))[0]);
00151 }
00152 
00153 int get_pvalue(SEXP object) {
00154     return(INTEGER(GET_SLOT(object, PL2_pvalueSym))[0]);
00155 }
00156 
00157 double get_tol(SEXP object) {
00158     return(REAL(GET_SLOT(object, PL2_tolSym))[0]);
00159 }
00160 
00161 int get_maxpts(SEXP object) {
00162     return(INTEGER(GET_SLOT(object, PL2_maxptsSym))[0]);
00163 }
00164 
00165 double get_abseps(SEXP object) {
00166     return(REAL(GET_SLOT(object, PL2_absepsSym))[0]);
00167 }
00168 
00169 double get_releps(SEXP object) {
00170     return(REAL(GET_SLOT(object, PL2_relepsSym))[0]);
00171 }
00172 
00173 double get_minsplit(SEXP object) {
00174     return(REAL(GET_SLOT(object, PL2_minsplitSym))[0]);
00175 }
00176 
00177 double get_minprob(SEXP object) {
00178     return(REAL(GET_SLOT(object, PL2_minprobSym))[0]);
00179 }
00180 
00181 double get_minbucket(SEXP object) {
00182     return(REAL(GET_SLOT(object, PL2_minbucketSym))[0]);
00183 }
00184 
00185 SEXP get_transformation(SEXP object, int variable) {
00186     return(VECTOR_ELT(
00187                GET_SLOT(object, PL2_transformationsSym), 
00188                variable - 1));
00189 }
00190 
00191 SEXP get_jointtransf(SEXP object) {
00192     return(GET_SLOT(object, PL2_jointtransfSym));
00193 }
00194 
00195 SEXP get_variable(SEXP object, int variable) {
00196     return(VECTOR_ELT(
00197                GET_SLOT(object, PL2_variablesSym), 
00198                variable - 1));
00199 }
00200 
00201 int is_nominal(SEXP object, int variable) {
00202     return(INTEGER(GET_SLOT(object, PL2_is_nominalSym))[variable - 1]);
00203 }
00204 
00205 int is_ordinal(SEXP object, int variable) {
00206     return(INTEGER(GET_SLOT(object, PL2_is_ordinalSym))[variable - 1]);
00207 }
00208 
00209 int is_censored(SEXP object, int variable) {
00210     return(INTEGER(GET_SLOT(object, PL2_is_censoredSym))[variable - 1]);
00211 }
00212 
00213 int has_missings(SEXP object, int variable) {
00214     return(INTEGER(GET_SLOT(object, PL2_has_missingsSym))[variable - 1]);
00215 }
00216 
00217 SEXP get_ordering(SEXP object, int variable) {
00218     if (!is_nominal(object, variable)) {
00219         return(VECTOR_ELT(
00220                GET_SLOT(object, PL2_orderingSym), 
00221                variable - 1));
00222     } else {
00223         error("Variable %d is not ordered", variable);
00224         return(R_NilValue);
00225     }
00226 }
00227 
00228 SEXP get_levels(SEXP object, int variable) {
00229     if (is_nominal(object, variable) || 
00230         is_ordinal(object, variable)) {
00231         return(VECTOR_ELT(
00232                GET_SLOT(object, PL2_levelsSym), 
00233                variable - 1));
00234     } else {
00235         error("Variable %d is not an (ordered) factor", variable);
00236         return(R_NilValue);
00237     }
00238 }
00239 
00240 SEXP get_scores(SEXP object, int variable) {
00241     if (is_ordinal(object, variable)) {
00242         return(VECTOR_ELT(
00243                GET_SLOT(object, PL2_scoresSym), 
00244                variable - 1));
00245     } else {
00246         error("Variable %d is not an ordered factor", variable);
00247         return(R_NilValue);
00248     }
00249 }
00250 
00251 SEXP get_missings(SEXP object, int variable) {
00252     if (has_missings(object, variable)) {
00253         return(VECTOR_ELT(
00254                GET_SLOT(object, PL2_whichNASym), 
00255                variable - 1));
00256     } else {
00257         error("Variable %d has no missing values", variable);
00258         return(R_NilValue);
00259     }
00260 }
00261 
00262 SEXP get_varmemory(SEXP object, int variable) {
00263     return(VECTOR_ELT(GET_SLOT(object, PL2_varmemorySym), 
00264                       variable - 1));
00265 }
00266 
00267 SEXP get_varMmemory(SEXP object, int variable) {
00268     return(VECTOR_ELT(GET_SLOT(object, PL2_varMmemorySym), 
00269                       variable - 1));
00270 }
00271 
00272 SEXP get_Mscorematrix(SEXP object, int variable) {
00273     return(VECTOR_ELT(GET_SLOT(object, PL2_MscorematricesSym), 
00274                       variable - 1));
00275 }
00276 
00277 int get_savesplitstats(SEXP object) {
00278     return(INTEGER(GET_SLOT(object, PL2_savesplitstatsSym))[0]);
00279 }
00280 
00281 SEXP get_splitstatistics(SEXP object) {
00282     return(GET_SLOT(object, PL2_splitstatisticsSym));
00283 }
00284 
00285 int get_nobs(SEXP object) {
00286     return(INTEGER(GET_SLOT(object, PL2_nobsSym))[0]);
00287 }
00288 
00289 int get_ninputs(SEXP object) {
00290     return(INTEGER(GET_SLOT(object, PL2_ninputsSym))[0]);
00291 }
00292 
00293 SEXP get_weights(SEXP object, int variable) {
00294     return(VECTOR_ELT(GET_SLOT(object, PL2_weightsSym), variable - 1));
00295 }
00296 
00297 int get_testtype(SEXP object) {
00298     return(INTEGER(GET_SLOT(object, PL2_testtypeSym))[0]);
00299 }
00300 
00301 int get_nresample(SEXP object) {
00302     return(INTEGER(GET_SLOT(object, PL2_nresampleSym))[0]);
00303 }
00304 
00305 SEXP get_varctrl(SEXP object) {
00306     return(GET_SLOT(object, PL2_varctrlSym));
00307 }
00308 
00309 SEXP get_splitctrl(SEXP object) {
00310     return(GET_SLOT(object, PL2_splitctrlSym));
00311 }
00312 
00313 SEXP get_gtctrl(SEXP object) {
00314     return(GET_SLOT(object, PL2_gtctrlSym));
00315 }
00316 
00317 SEXP get_tgctrl(SEXP object) {
00318     return(GET_SLOT(object, PL2_tgctrlSym));
00319 }
00320 
00321 double get_mincriterion(SEXP object) {
00322     return(REAL(GET_SLOT(object, PL2_mincriterionSym))[0]);
00323 }
00324 
00325 int get_maxsurrogate(SEXP object) {
00326     return(INTEGER(GET_SLOT(object, PL2_maxsurrogateSym))[0]);
00327 }
00328 
00329 int get_randomsplits(SEXP object) {
00330     return(INTEGER(GET_SLOT(object, PL2_randomsplitsSym))[0]);
00331 }
00332 
00333 int get_mtry(SEXP object) {
00334     return(INTEGER(GET_SLOT(object, PL2_mtrySym))[0]);
00335 }
00336 
00337 SEXP get_dontuse(SEXP object) {
00338     return(GET_SLOT(object, PL2_dontuseSym));
00339 }
00340 
00341 SEXP get_dontusetmp(SEXP object) {
00342     return(GET_SLOT(object, PL2_dontusetmpSym));
00343 }
00344 
00345 int get_stump(SEXP object) {
00346     return(INTEGER(GET_SLOT(object, PL2_stumpSym))[0]);
00347 }
00348 
00349 int check_depth(SEXP object, int depth) {
00350     int maxdepth;
00351     maxdepth = INTEGER(GET_SLOT(object, PL2_maxdepthSym))[0];
00352     if (maxdepth == 0) return(1);
00353     if (maxdepth < 1) error("maxdepth is less than one");
00354     return(depth <= maxdepth);
00355 }

Generated on Tue Apr 4 13:20:28 2006 for party by  doxygen 1.4.2