Displaying 3 results from an estimated 3 matches for "matdesc".
Did you mean:
getdesc
2005 Apr 26
2
Advice for calling a C function
...x to my C function, as a double:
.C("gowsim", as.double(mat), as.integer(nrow(mat)), as.integer(ncol(mat)))
Then I try and reconstruct the matrix, in the form of a C array:
#include <R.h>
#include <Rmath.h>
#include <math.h>
void gowsim ( double *mat, int *OBJ, int *MATDESC)
{
double x [*MATDESC][*OBJ];
int i, j, nrow, ncol;
nrow = *OBJ;
ncol = *MATDESC;
/* Rebuild Matrix */
for (j=0; j < ncol; j++) {
for (i=0; i < nrow; i++) {
x[i][j] = *mat;
Rprintf("row %d col %d value %f\n", i, j, x[i][j]...
2005 Apr 26
2
Advice for calling a C function
...x to my C function, as a double:
.C("gowsim", as.double(mat), as.integer(nrow(mat)), as.integer(ncol(mat)))
Then I try and reconstruct the matrix, in the form of a C array:
#include <R.h>
#include <Rmath.h>
#include <math.h>
void gowsim ( double *mat, int *OBJ, int *MATDESC)
{
double x [*MATDESC][*OBJ];
int i, j, nrow, ncol;
nrow = *OBJ;
ncol = *MATDESC;
/* Rebuild Matrix */
for (j=0; j < ncol; j++) {
for (i=0; i < nrow; i++) {
x[i][j] = *mat;
Rprintf("row %d col %d value %f\n", i, j, x[i][j]...
2005 Apr 18
2
Very Slow Gower Similarity Function
...one can suggest ways to
speed up my function I would appreciate it. I suspect having a pair of nested
for loops is the problem, but I couldn't figure out how to get rid of them.
The function is:
### Gower Similarity Matrix###
sGow <- function (mat){
OBJ <- nrow(mat) #number of objects
MATDESC <- ncol (mat) #number of descriptors
MRANGE <- apply (mat,2,max, na.rm=T)-apply (mat,2,min,na.rm=T) #descr ranges
DESCRIPT <- 1:MATDESC #descriptor index vector
smat <- matrix(1, nrow = OBJ, ncol = OBJ) #'empty' similarity matrix
for (i in 1:OBJ){
for (j in i:OBJ){
##cal...