Displaying 2 results from an estimated 2 matches for "dims2".
Did you mean:
dims
2008 Apr 05
2
Adding a Matrix Exponentiation Operator
...rixData(SEXP a, SEXP b, int nrows, int ncols, int mode) {
for (int i=0; i < ncols; ++i)
for (int j=0; j < nrows; ++j)
REAL(b)[i * nrows + j] = REAL(a)[i * nrows + j];
}
SEXP do_matexp(SEXP call, SEXP op, SEXP args, SEXP rho)
{
int nrows, ncols;
SEXP matrix, tmp, dims, dims2;
SEXP x, y, x_, x__;
int i,j,e,mode;
// Still need to fix full complex support
mode = isComplex(CAR(args)) ? CPLXSXP : REALSXP;
SETCAR(args, coerceVector(CAR(args), mode));
x = CAR(args);
y = CADR(args);
dims = getAttrib(x, R_DimSymbol);
nrows = INTEGER(dims)[...
2008 Jul 11
1
Subsetting an array by a vector of dimensions
...y by a vector of n dimensions? E.g. assume I have
> x <- array(1:24, dim=2:4)
> x[1,1,2]
[1] 7
> dims <- c(1,1,2)
I would like a function that I can supply x and dims as parameters to, and have it return 7. Also, I would like to do something like:
> x[1,1,]
[1] 1 7 13 19
> dims2<- c(1,1,NA)
And have a function of x and dims2 that gives me back [1] 1 7 13 19
Does such a thing exist?
Thanks
Richard
--
Richard D. Pearson richard.pearson at postgrad.manchester.ac.uk
School of Computer Science, http://www.cs.man.ac.uk/~pearsonr
University of Mancheste...