source: prextra/lasso.h @ 52

Last change on this file since 52 was 5, checked in by bduin, 14 years ago
File size: 2.7 KB
Line 
1/* Copyright (C) 1998
2   Berwin A Turlach <bturlach@stats.adelaide.edu.au> */
3
4/* This library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Library General Public License
6   as published by the Free Software Foundation; either version 2 of
7   the License, or (at your option) any later version. */
8
9/* This library is distributed in the hope that it will be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   Library General Public License for more details. */
13
14/* You should have received a copy of the GNU Library General Public
15   License along with this library; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17   MA 02111-1307, USA. */
18/*#define S_Plus*/
19#define Matlab
20#ifndef BT_LASSO_H
21#define BT_LASSO_H
22#include <stdlib.h>
23#include <stdio.h>
24#include <math.h>
25#include <float.h>
26#if defined(S_Plus)
27#include <S.h>
28#if defined(SPLUS_VERSION) && SPLUS_VERSION >= 4000
29#  include <newredef.h>
30#endif
31#endif
32
33#if defined(Matlab)
34#   include "mex.h"
35#endif
36
37void lasso(double *x, long *pn, long *pm, double *pt,
38           double *beta, double *y, double *yhat1, double *r,
39           double *lagrangian, long *psuc,  long *pverb, long *pas_sub);
40void mult_lasso(double *x, long *pn, long *pm, double *pt, long *pl,
41                double *beta, double *y, double *yhat1, double *r,
42                double *lagrangian, long *psuc, long *pverb);
43void rs_lasso(double *x, double *y, long *pn, long *porder,
44           double *pt, double *beta, double *yhat1,  double *yhat2,
45           double *r, long *psuc, long *pverb, long *pas_sub);
46void rs_auto(double *x, double *y, long *pn, long *porder,
47           double *pt, double *beta, double *yhat1, double *yhat2,
48           double *r,  long *pcrit1, double *pprec,
49           long *psuc, long *pverb,
50           double *tgr, double *tgr_val, long *ptgr_len);
51#if !defined(S_Plus)
52#define Calloc(n,t)       (t *) malloc((n)*sizeof(t))
53#define Realloc(p,n,t)    (t *) realloc(p,(n)*sizeof(t))
54#define Free(p)           free(p), p=NULL
55#include <string.h>
56#define Memcpy(p,q,n)     memcpy(p,q,(n)*sizeof(*(p)))
57#endif
58
59#define TRUE 1
60#define FALSE 0
61/*#define RMAT(i,j) (1.0e-10+*(rmat+(j)*((j)+1)/2+(i))) //??*/
62#define RMAT(i,j) (*(rmat+(j)*((j)+1)/2+(i))) /*??*/
63#define QMAT(i,j) (*(qmat+(j)*q_nrow+(i)))
64#define RLAST(i)  (*(rmat+(r_ncol-1)*r_ncol/2+(i)))
65#define RLTEL     (*(rmat+r_ncol*(r_ncol+1)/2-1))
66#define RCOL(j)   (rmat+(j)*((j)+1)/2)
67#define QCOL(j)   (qmat+(j)*q_nrow)
68#define RLTCOL    (rmat+(r_ncol-1)*r_ncol/2)
69/*#define QR_CHUNK 10*/
70#if defined (S_Plus)
71#define ERRMSG(where,msg) errmsg(msg)
72#else
73#define ERRMSG(where,msg) errmsg(where,msg)
74#endif
75#endif
Note: See TracBrowser for help on using the repository browser.