SCM

SCM Repository

[matrix] Diff of /pkg/src/lgCMatrix.c
ViewVC logotype

Diff of /pkg/src/lgCMatrix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 865, Fri Aug 19 16:57:49 2005 UTC revision 866, Fri Aug 19 16:58:26 2005 UTC
# Line 32  Line 32 
32      return ScalarLogical(1);      return ScalarLogical(1);
33  }  }
34    
35    /* very parallel to csc_matrix() in ./dgeMatrix.c */
36    SEXP lcsc_to_matrix(SEXP x)
37    {
38        SEXP ans, pslot = GET_SLOT(x, Matrix_pSym);
39        int j, ncol = length(pslot) - 1,
40            nrow = INTEGER(GET_SLOT(x, Matrix_DimSym))[0],
41            *xp = INTEGER(pslot),
42            *xi = INTEGER(GET_SLOT(x, Matrix_iSym));
43        int *ax;
44    
45        ax = LOGICAL(ans = PROTECT(allocMatrix(LGLSXP, nrow, ncol)));
46        for (j = 0; j < (nrow * ncol); j++) ax[j] = 0;
47        for (j = 0; j < ncol; j++) {
48            int ind;
49            for (ind = xp[j]; ind < xp[j+1]; ind++)
50                ax[j * nrow + xi[ind]] = 1;
51        }
52        UNPROTECT(1);
53        return ans;
54    }
55    
56  /**  /**
57   * C := op(A) %*% op(B) + beta ^ C for logical sparse column-oriented matrices   * C := op(A) %*% op(B) + beta ^ C for logical sparse column-oriented matrices
58   *   *

Legend:
Removed from v.865  
changed lines
  Added in v.866

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge