SCM

SCM Repository

[matrix] Diff of /pkg/TODO
ViewVC logotype

Diff of /pkg/TODO

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

revision 1887, Thu Jun 7 09:04:34 2007 UTC revision 2207, Mon Jul 7 22:34:52 2008 UTC
# Line 1  Line 1 
1  Check for DimNames propagation in coercion and other operations.  - Check for DimNames propagation in coercion and other operations.
 ------  
 - rcond methods for sparseMatrix classes  
2    
3  - Report the problem in the Linux ldexp manual page.  The second and  - Report the problem in the Linux ldexp manual page.  The second and
4    third calls in the Synopsis should be to ldexpf and ldexpl.    third calls in the Synopsis should be to ldexpf and ldexpl.
5    
 - [,] indexing: for sparse "works", but not yet for negative indices!  
   
 - consider moving alloc3Darray from ./src/Mutils.c to  
   $(RSRC)/src/base/array.c  
 ------  
6  - provide methods for "dspMatrix" and "dppMatrix"!  - provide methods for "dspMatrix" and "dppMatrix"!
7    
8  - implement (more) methods for supporting "packed" (symmetric / triangular)  - implement (more) methods for supporting "packed" (symmetric / triangular)
# Line 18  Line 11 
11    
12    (have some dtr* <-> dtp*)    (have some dtr* <-> dtp*)
13    
 -----  
   
14  - combine the C functions for multiplication by special forms and  - combine the C functions for multiplication by special forms and
15    solution wrt special forms by using a 'right' argument and a    solution wrt special forms by using a 'right' argument and a
16    'classed' argument.    'classed' argument.
17     [done with dgeMatrix_matrix_mm();  not yet for other classes;     [done with dgeMatrix_matrix_mm();  not yet for other classes;
18      and for _crossprod()]      and for _crossprod()]
19    
 - add more comprehensive examples / tests for Schur decomposition  
   
 - arithmetic for sparse matrices:  
              <sparseMatrix>  o  <same-dim-sparseMatrix>  
   should return a sparse matrix  for at least "+" and "*" , also %%,  
   and "/" and "%/%" at least when the RHS is non-zero a scalar.  
   Challenge: nice implementation (``common non-0''; but Tsparse* is not uniq).  
   
20  -----  -----
21    
22  - "Math2" , "Math", "Arith":  - "Math2" , "Math", "Arith":
23     keep triangular and symmetric Matrices when appropriate:     keep triangular and symmetric Matrices when appropriate:
24     particularly desirable for  "Math2": round(), signif()     particularly desirable for  "Math2": round(), signif()
25    
26      For triangular matrices, more specifically make sure the four rules of
27      "triangular matrix algebra" (Golub+Van Loan 1996, 3.1.8, p.93) are
28      fulfilled; now(2008-03-06) ok for Csparse; not yet for <dtr> %*% <dtr>
29    
30  - "d" <-> "l" coercion for all "[TCR]" sparse matrices is really trivial:  - "d" <-> "l" coercion for all "[TCR]" sparse matrices is really trivial:
31    "d" -> "l" : drops the 'x' slot    "d" -> "l" : drops the 'x' slot
32    "l" -> "d" : construct an 'x' slot of all '1'    "l" -> "d" : construct an 'x' slot of all '1'
# Line 52  Line 39 
39    for all  "dsparse*" -> "lsparse*" and vice versa.    for all  "dsparse*" -> "lsparse*" and vice versa.
40    How can one do this {in a documented way} ?    How can one do this {in a documented way} ?
41    
42    - Think of constructing  setAs(...) calls automatically in order to
43      basically enable all ``sensible'' as(fromMatrix, toMatrix)  calls,
44      possibly using canCoerce(.)
45    
46    - setAs(<Mcl>,  "[dln]Matrix") for <Mcl> in {Matrix or denseMatrix + sparseMatrix}
47    
48    - When we have a packed matrix, it's a waste to go through "full" to "sparse":
49      ==> implement
50            setAs("dspMatrix", "sparseMatrix")
51            setAs("dppMatrix", "sparseMatrix")
52            setAs("dtpMatrix", "sparseMatrix")
53      and the same for "lsp" , "ltp"  and  "nsp" , "ntp" !
54    
55  - tcrossprod(x, y) : do provide methods for y != NULL  - tcrossprod(x, y) : do provide methods for y != NULL
56    calling Lapack's DGEMM for "dense"    calling Lapack's DGEMM for "dense"
57    [2005-12-xx: done for dgeMatrix at least]    [2005-12-xx: done for dgeMatrix at least]
# Line 61  Line 61 
61    str(H6 <- as(h6, "dspMatrix"))       # has lost factor    str(H6 <- as(h6, "dspMatrix"))       # has lost factor
62    ## and the same in a similar situation involving  "dpo", "dpp"    ## and the same in a similar situation involving  "dpo", "dpp"
63    
 - Things like  M[upper.tri(M)] are not really most useful for  sparse  
   matrices.  --> provide generic functions  
   upperTriMatrix(), lowerTriMatrix()  both with argument  'diag = TRUE'  
   (which can be set to FALSE of course) which are used to extract a  
   triangle from an arbitrary sparse matrix and  return a  "dtCMatrix".  
   
64  - Factorizations: LU done; also Schur()  for  *sparse*  Matrices.  - Factorizations: LU done; also Schur()  for  *sparse*  Matrices.
65    
 - band(), triu(), tril() for *all* including "matrix", not just sparse matrices  
   
66  - is.na() method for all our matrices [ ==> which(*, arr.ind=TRUE) might work ]  - is.na() method for all our matrices [ ==> which(*, arr.ind=TRUE) might work ]
67    
 - When we have a packed matrix, it's a waste to go through "full" to "sparse":  
   ==> implement  
         setAs("dspMatrix", "sparseMatrix")  
         setAs("dppMatrix", "sparseMatrix")  
         setAs("dtpMatrix", "sparseMatrix")  
   and the same for "lsp" , "ltp"  and  "nsp" , "ntp" !  
   
68  - use  .Call(Csparse_drop, M, tol) in more places,  - use  .Call(Csparse_drop, M, tol) in more places,
69    both with 'tol = 0.' to drop "values that happen to be 0" and for    both with 'tol = 0.' to drop "values that happen to be 0" and for
70    zapsmall() methods for Csparse*    zapsmall() methods for Csparse*
# Line 89  Line 74 
74    specifically for multiplying a cholmod_sparse object by a diagonal matrix.    specifically for multiplying a cholmod_sparse object by a diagonal matrix.
75    Use it in %*% and [t]crossprod methods.    Use it in %*% and [t]crossprod methods.
76    
77  - chol() and determinant() should ``work'': proper result or "good" error  - chol() should ``work'': proper result or "good" error message.
   message.  
   
 - Think of constructing  setAs(...) calls automatically in order to  
   basically enable all ``sensible'' as(fromMatrix, toMatrix)  calls,  
   possibly using canCoerce(.)  
78    
79  - make sure *all* group methods have (maybe "bail-out") setMethod for "Matrix".  - make sure *all* group methods have (maybe "bail-out") setMethod for "Matrix".
80    e.g. zapsmall(<pMatrix>) fails "badly"    e.g. zapsmall(<pMatrix>) fails "badly"
81    
 - speedup: pass class definition to non0ind() [check all calls ..]  
   
 - sum(): implement methods which work for *all* our matrices.  
   
82  - Implement  expand(.) for the Cholesky() results  - Implement  expand(.) for the Cholesky() results
83    "dCHMsimpl" and  "dCHMsuper"  -- currently have no *decent* way to get at    "dCHMsimpl" and  "dCHMsuper"  -- currently have no *decent* way to get at
84    the matrix factors of the corresponding matrix factorization !!    the matrix factors of the corresponding matrix factorization !!
85    
86  - rbind(<sparse>, <dense>) does not work  (e.g. <dgC>, <dge>)  - rbind2(<sparse>, <dense>) does not work  (e.g. <dgC>, <dge>)
   
 - setAs(<Mcl>,  "[dln]Matrix" )  for <Mcl> in {Matrix or denseMatrix + sparseMatrix}  
   
 - Tell users about the possibility to disable the "S4-generic but somewhat slow"  
   cbind/rbind, e.g. via  
   
   setHook(packageEvent("Matrix", "onLoad"),  
           function(...) methods:::bind_activation(FALSE))  
   
 - ensure that  M[0], M[FALSE], M[1:2]  works as for traditional Matrices  
   
 - make sure  M[FALSE, FALSE]  works for all Matrices  
   {e.g. fails for M <- Diagonal(4)}  
87    
88  - <sparse> %*% <dense>  {also in crossprod/tcrossprod}  currently always  - <sparse> %*% <dense>  {also in crossprod/tcrossprod}  currently always
89    returns <dense>, since --> Csparse_dense_prod --> cholmod_sdmult    returns <dense>, since --> Csparse_dense_prod --> cholmod_sdmult
# Line 133  Line 96 
96    --> R/diagMatrix.R ('FIXME')    --> R/diagMatrix.R ('FIXME')
97    but also R/Ops.R  to ensure  sp-sym. + sp-sym. |-> sp-sym.  etc    but also R/Ops.R  to ensure  sp-sym. + sp-sym. |-> sp-sym.  etc
98    
 - For a square sparse matrix 'b' {typically dgCMatrix or dgTMatrix},  
   we'd want a function  "Mat_plus_t_Mat" <- function(b) {....}  
   which computes the symmetric sparse matrix   b + t(b)  
   in way that never works with size-doubled vectors from  b@i etc..  
   
99  - ! <symmetricMatrix>  loses symmetry, both for dense and sparse matrices.  - ! <symmetricMatrix>  loses symmetry, both for dense and sparse matrices.
100    !M  where M is "sparseMatrix", currently always gives dense. This only    !M  where M is "sparseMatrix", currently always gives dense. This only
101    makes sense when M is ``really sparse''.    makes sense when M is ``really sparse''.
102    
103  - column names of sparse matrices are not printed;  - example(Cholesky, echo=FALSE) ; cm <- chol(mtm); str(cm); str(mtm)
104    we now "mention" them (if they are non-empty).  
105    Option:    shows that chol() does not seems to make use of an already
106          build show( <sparseMatrix>) on a function, possibly    present factorization and rather uses one with more '0' in x slot.
         print.sparseMatrix(), which gets an argument such as  
         'col.names.show  = FALSE' which is documented and can be set to TRUE  
107    
108  - 'arules' needs fast colSums() and rowSums() - for ngCMatrix;  - diag(m) <- val    currently automatically works via  m[cbind(i,i)] <- val
109    do it for "nMatrix" and "lMatrix" and return *integer*    This (`[<-` method) is now "smart" for diagonalMatrix, but needs also to
110      be for triangularMatrix, and probably also "dense*general*Matrix" since the
111      above currently goes via "matrix" and back instead of using the 'x' slot
112      directly; in particular, the triangular* "class property" is lost!
113    
114      Note that 'diag(M[,-1]) <- val' is deadly slow for large sparse M,
115      but that's because of the "outer" assignment in the equivalent
116      M[,-1] <- `diag<-`(M[,-1], val).
117    
118    - examples for solve( Cholesky(.), b, system = c("A", "LDLt"....))
119      probably rather in man/CHMfactor-class.Rd than man/Cholesky.Rd
120    
121    - LDL(<CHMsimpl>) looks relatively easy; via  "tCsparse_diag()"
122       {diagonal entries of *triangular* Csparse}
123      --> see comment in determinant(<dsC>) in R/dsCMatrix.R, will give
124      faster determinant
125    
126    - tr(A %*% B) {and even  tr(A %*% B %*% C) ...} are also needed
127      frequently in some computations {conditional normal distr. ...}.
128      Since this can be done faster than by
129        sum(diag(A %*% B))  even for traditional matrices, e.g.
130                   sum(A * t(B)) or {even faster for "full" mat}
131                   crossprod(as.vector(A), as.vector(B))
132      and even more so for, e.g.  <sparse> %*% <dense>
133      {used in Soeren's 'gR' computations},
134      we should also provide a generic and methods.
135    
136    - qr.R(qr(x)) may differ for the "same" matrix, depending on it being
137      sparse or dense:
138        "qr.R(<sparse>) may differ from qr.R(<dense>) because of permutations"
139    
140      This is not really acceptable and currently influences  rcond() as well.
141    
142    - eigen() should become generic, and get a method at least for diagonal,
143      but also for symmetric -> dsyMatrix  [LAPACK dsyev() uses UPLO !],
144      but also simply for dgeMatrix (without going via tradition matrices).
145      What about Sparse?  There's fill-in, but it may still be sensible, e.g.
146      mlist <- list(1, 2:3, diag(x=5:3), 27, cbind(1,3:6), 100:101)
147      ee <- eigen(tcrossprod(bdiag(lapply(mlist, as.matrix))))
148      Matrix( signif(ee$vectors, 3) )
149    
150    - facmul() has no single method defined;  it looks like a good idea though
151      (instead of the infamous qr.qy, qr.qty,.... functions)
152    
153    - symmpart() and skewpart()  for *sparse* matrices still use (x +/- t(x))/2
154      and could be made more efficient.
155      Consider going via  asTuniq() or something very close to
156      .Arith.Csparse() in R/Ops.R
157    
158    - many setAs(*, "[dl]..Matrix") are still needed, as long as e.g.
159      replCmat() uses as_CspClass() and drop0(.) which itself call
160      as_CspClass() quite a bit.  --> try to replace these by
161      as(*, "CsparseMatrix"); forceSymmetric, etc.
162    
163    - implement fast diag(<triangularCsparse>) via calling new
164      src/Csparse.c's diag_tC_ptr()
165    
166    - add examples (and tests!) for update(<CHMfactor>, ..) and
167      Cholesky(......, Imult), also tests for hidden {hence no examples}
168      ldetL2up() { R/CHMfactor.R }
169    
170    - chol(<nsCMatrix>)  gives "temporarily disabled"
171      but should give the *symbolic* factorization;
172      similarly Cholesky(.) is not enabled
173    
174    - writeMM(obj, file=stdout()) creates file "1" since file is silently
175      assumed to be a string, i.e. cannot be a connection.
176      An R (instead of C) version should be pretty simple, and would work with
177      connections automatically ["lsparse" become either "real" or
178      "pattern", "depending if they have NAs or not].
179    
180    - <diagMatrix> o <ddenseMatrix> currently works via sparse, but
181      should return <diagMatrix> in the same cases where
182      <diagMatrix> o <numeric> does.
183    
184    - look at solve.QP.compact() in \pkg{quadprog} and how to do that using
185      our sparse matrices.  Maybe this needs to be re-implemented using CHOLMOD
186      routines.
187    
188    - "sparseVector" : indices, i.e. @i and @length  should be changed
189                     from class "integer" to "numeric" (i.e. double prec),
190      since we want to be able to coerce large sparse matrices to sparse
191      vectors, where length maybe considerably larger than 2^32.

Legend:
Removed from v.1887  
changed lines
  Added in v.2207

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