Main Page | Directories | File List | Globals

Mutils.h File Reference

#include <Rdefines.h>
#include <Rconfig.h>
#include "cblas.h"
#include "Syms.h"

Go to the source code of this file.

Defines

#define RMJ   CblasRowMajor
#define CMJ   CblasColMajor
#define NTR   CblasNoTrans
#define TRN   CblasTrans
#define CTR   CblasConjTrans
#define UPP   CblasUpper
#define LOW   CblasLower
#define NUN   CblasNonUnit
#define UNT   CblasUnit
#define LFT   CblasLeft
#define RGT   CblasRight
#define AZERO(x, n)   {int _I_, _SZ_ = (n); for(_I_ = 0; _I_ < _SZ_; _I_++) (x)[_I_] = 0;}

Functions

char norm_type (char *typstr)
char rcond_type (char *typstr)
double get_double_by_name (SEXP obj, char *nm)
SEXP set_double_by_name (SEXP obj, double val, char *nm)
SEXP as_det_obj (double val, int log, int sign)
SEXP get_factors (SEXP obj, char *nm)
SEXP set_factors (SEXP obj, SEXP val, char *nm)
SEXP dgCMatrix_set_Dim (SEXP x, int nrow)
int csc_unsorted_columns (int ncol, const int p[], const int i[])
void csc_sort_columns (int ncol, const int p[], int i[], double x[])
SEXP triple_as_SEXP (int nrow, int ncol, int nz, const int Ti[], const int Tj[], const double Tx[], char *Rclass)
SEXP csc_check_column_sorting (SEXP A)
void csc_components_transpose (int m, int n, int nnz, const int xp[], const int xi[], const double xx[], int ap[], int ai[], double ax[])
void ssc_symbolic_permute (int n, int upper, const int perm[], int Ap[], int Ai[])
double * nlme_symmetrize (double *a, const int nc)
void nlme_check_Lapack_error (int info, const char *laName)
SEXP nlme_replaceSlot (SEXP obj, SEXP names, SEXP value)
SEXP nlme_weight_matrix_list (SEXP MLin, SEXP wts, SEXP adjst, SEXP MLout)
SEXP Matrix_make_named (int TYP, char **names)
static R_INLINE SEXP ALLOC_SLOT (SEXP obj, SEXP nm, SEXPTYPE type, int length)
static R_INLINE int * expand_column_pointers (int ncol, const int mp[], int mj[])
static R_INLINE int check_csc_index (const int p[], const int i[], int row, int col, int missing)
SEXP alloc3Darray (SEXPTYPE mode, int nrow, int ncol, int nface)
static R_INLINE int Lind (int k, int i)
static R_INLINE int match_mat_dims (const int xd[], const int yd[])
double * expand_csc_column (double *dest, int m, int j, const int Ap[], const int Ai[], const double Ax[])


Define Documentation

#define AZERO x,
 )     {int _I_, _SZ_ = (n); for(_I_ = 0; _I_ < _SZ_; _I_++) (x)[_I_] = 0;}
 

#define CMJ   CblasColMajor
 

#define CTR   CblasConjTrans
 

#define LFT   CblasLeft
 

#define LOW   CblasLower
 

#define NTR   CblasNoTrans
 

#define NUN   CblasNonUnit
 

#define RGT   CblasRight
 

#define RMJ   CblasRowMajor
 

#define TRN   CblasTrans
 

#define UNT   CblasUnit
 

#define UPP   CblasUpper
 


Function Documentation

SEXP alloc3Darray SEXPTYPE  mode,
int  nrow,
int  ncol,
int  nface
 

Allocate a 3-dimensional array

Parameters:
mode The R mode (e.g. INTSXP)
nrow number of rows
ncol number of columns
nface number of faces
Returns:
A 3-dimensional array of the indicated dimensions and mode

static R_INLINE SEXP ALLOC_SLOT SEXP  obj,
SEXP  nm,
SEXPTYPE  type,
int  length
[static]
 

Allocate an SEXP of given type and length, assign it as slot nm in the object, and return the SEXP. The validity of this function depends on SET_SLOT not duplicating val when NAMED(val) == 0. If this behavior changes then ALLOC_SLOT must use SET_SLOT followed by GET_SLOT to ensure that the value returned is indeed the SEXP in the slot.

Parameters:
obj object in which to assign the slot
nm name of the slot, as an R name object
type type of SEXP to allocate
length length of SEXP to allocate
Returns:
SEXP of given type and length assigned as slot nm in obj

SEXP as_det_obj double  val,
int  log,
int  sign
 

static R_INLINE int check_csc_index const int  p[],
const int  i[],
int  row,
int  col,
int  missing
[static]
 

Return the linear index of the (row, col) entry in a csc structure. If the entry is not found and missing is 0 an error is signaled; otherwise the missing value is returned.

Parameters:
p vector of column pointers
i vector of row indices
row row index
col column index
missing the value to return is the row, col entry does not exist. If this is zero and the row, col entry does not exist an error is signaled.
Returns:
index of element at (row, col) if it exists, otherwise missing

SEXP csc_check_column_sorting SEXP  m  ) 
 

Check for sorted columns in an object that inherits from the dgCMatrix class. Resort the columns if necessary.

Parameters:
m pointer to an object that inherits from the dgCMatrix class
Returns:
m with the columns sorted by increasing row index

void csc_components_transpose int  m,
int  n,
int  nnz,
const int  xp[],
const int  xi[],
const double  xx[],
int  ap[],
int  ai[],
double  ax[]
 

void csc_sort_columns int  ncol,
const int  p[],
int  i[],
double  x[]
 

Sort the columns in a sparse column-oriented matrix so that each column is in increasing order of row index.

Parameters:
ncol number of columns
p column pointers
i row indices
x values of nonzero elements

int csc_unsorted_columns int  ncol,
const int  p[],
const int  i[]
 

Check for unsorted columns in the row indices

Parameters:
ncol number of columns
p column pointers
i row indices
Returns:
0 if all columns are sorted, otherwise 1

SEXP dgCMatrix_set_Dim SEXP  x,
int  nrow
 

static R_INLINE int* expand_column_pointers int  ncol,
const int  mp[],
int  mj[]
[static]
 

Expand the column pointers in the array mp into a full set of column indices in the array mj.

Parameters:
ncol number of columns
mp column pointer vector of length ncol + 1
mj vector of length mp[ncol] - 1 to hold the result
Returns:
mj

double* expand_csc_column double *  dest,
int  m,
int  j,
const int  Ap[],
const int  Ai[],
const double  Ax[]
 

Expand a column of a compressed, sparse, column-oriented matrix.

Parameters:
dest array to hold the result
m number of rows in the matrix
j index (0-based) of column to expand
Ap array of column pointers
Ai array of row indices
Ax array of non-zero values
Returns:
dest

double get_double_by_name SEXP  obj,
char *  nm
 

SEXP get_factors SEXP  obj,
char *  nm
 

static R_INLINE int Lind int  k,
int  i
[static]
 

Calculate the zero-based index in a row-wise packed lower triangular matrix. This is used for the arrays of blocked sparse matrices.

Parameters:
i column number (zero-based)
k row number (zero-based)
Returns:
The index of the (k,i) element of a packed lower triangular matrix

static R_INLINE int match_mat_dims const int  xd[],
const int  yd[]
[static]
 

Check for a complete match on matrix dimensions

Parameters:
xd dimensions of first matrix
yd dimensions of second matrix
Returns:
1 if dimensions match, otherwise 0

SEXP Matrix_make_named int  TYP,
char **  names
 

Create a named vector of type TYP

Parameters:
TYP a vector SEXP type (e.g. REALSXP)
names names of list elements with null string appended
Returns:
pointer to a named vector of type TYP

void nlme_check_Lapack_error int  info,
const char *  laName
 

Check the error code returned by an Lapack routine and create an appropriate error message.

Parameters:
info Error code as returned from the Lapack routine
laName Character string containing the name of the Lapack routine

SEXP nlme_replaceSlot SEXP  obj,
SEXP  names,
SEXP  value
 

Replace the value of a slot or subslot of an object in place. This routine purposely does not copy the value of obj. Use with caution.

Parameters:
obj object with slot to be replaced
names vector of names. The last element is the name of the slot to replace. The leading elements are the names of slots and subslots of obj.
value the replacement value for the slot
Returns:
obj, with the named slot modified in place.

double* nlme_symmetrize double *  a,
const int  nc
 

Symmetrize a matrix by copying the strict upper triangle into the lower triangle.

Parameters:
a pointer to a matrix in Fortran storage mode
nc number of columns (and rows and leading dimension) in the matrix
Returns:
a, symmetrized

SEXP nlme_weight_matrix_list SEXP  MLin,
SEXP  wts,
SEXP  adjst,
SEXP  MLout
 

Produce a weighted copy of the matrices in MLin in the storage allocated to MLout

Parameters:
MLin input matrix list
wts real vector of weights
adjst adjusted response
MLout On input a list of matrices of the same dimensions as MLin.
Returns:
MLout with its contents overwritten by a weighted copy of MLin according to wts with adjst overwriting the response.

char norm_type char *  typstr  ) 
 

char rcond_type char *  typstr  ) 
 

SEXP set_double_by_name SEXP  obj,
double  val,
char *  nm
 

SEXP set_factors SEXP  obj,
SEXP  val,
char *  nm
 

void ssc_symbolic_permute int  n,
int  upper,
const int  perm[],
int  Ap[],
int  Ai[]
 

SEXP triple_as_SEXP int  nrow,
int  ncol,
int  nz,
const int  Ti[],
const int  Tj[],
const double  Tx[],
char *  Rclass
 


Generated on Fri Feb 18 08:49:35 2005 for Matrix by  doxygen 1.4.1