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 2005, Wed Jul 18 14:46:20 2007 UTC revision 2112, Mon Feb 18 08:24:46 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":
# Line 52  Line 35 
35    for all  "dsparse*" -> "lsparse*" and vice versa.    for all  "dsparse*" -> "lsparse*" and vice versa.
36    How can one do this {in a documented way} ?    How can one do this {in a documented way} ?
37    
38    - Think of constructing  setAs(...) calls automatically in order to
39      basically enable all ``sensible'' as(fromMatrix, toMatrix)  calls,
40      possibly using canCoerce(.)
41    
42    - setAs(<Mcl>,  "[dln]Matrix") for <Mcl> in {Matrix or denseMatrix + sparseMatrix}
43    
44    - When we have a packed matrix, it's a waste to go through "full" to "sparse":
45      ==> implement
46            setAs("dspMatrix", "sparseMatrix")
47            setAs("dppMatrix", "sparseMatrix")
48            setAs("dtpMatrix", "sparseMatrix")
49      and the same for "lsp" , "ltp"  and  "nsp" , "ntp" !
50    
51  - tcrossprod(x, y) : do provide methods for y != NULL  - tcrossprod(x, y) : do provide methods for y != NULL
52    calling Lapack's DGEMM for "dense"    calling Lapack's DGEMM for "dense"
53    [2005-12-xx: done for dgeMatrix at least]    [2005-12-xx: done for dgeMatrix at least]
# Line 61  Line 57 
57    str(H6 <- as(h6, "dspMatrix"))       # has lost factor    str(H6 <- as(h6, "dspMatrix"))       # has lost factor
58    ## and the same in a similar situation involving  "dpo", "dpp"    ## and the same in a similar situation involving  "dpo", "dpp"
59    
 - 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".  
   
60  - Factorizations: LU done; also Schur()  for  *sparse*  Matrices.  - Factorizations: LU done; also Schur()  for  *sparse*  Matrices.
61    
 - band(), triu(), tril() for *all* including "matrix", not just sparse matrices  
   
62  - 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 ]
63    
 - 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" !  
   
64  - use  .Call(Csparse_drop, M, tol) in more places,  - use  .Call(Csparse_drop, M, tol) in more places,
65    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
66    zapsmall() methods for Csparse*    zapsmall() methods for Csparse*
# Line 92  Line 73 
73  - chol() and determinant() should ``work'': proper result or "good" error  - chol() and determinant() should ``work'': proper result or "good" error
74    message.    message.
75    
 - Think of constructing  setAs(...) calls automatically in order to  
   basically enable all ``sensible'' as(fromMatrix, toMatrix)  calls,  
   possibly using canCoerce(.)  
   
76  - make sure *all* group methods have (maybe "bail-out") setMethod for "Matrix".  - make sure *all* group methods have (maybe "bail-out") setMethod for "Matrix".
77    e.g. zapsmall(<pMatrix>) fails "badly"    e.g. zapsmall(<pMatrix>) fails "badly"
78    
 - speedup: pass class definition to non0ind() [check all calls ..]  
   
79  - sum(): implement methods which work for *all* our matrices.  - sum(): implement methods which work for *all* our matrices.
80    
81  - Implement  expand(.) for the Cholesky() results  - Implement  expand(.) for the Cholesky() results
82    "dCHMsimpl" and  "dCHMsuper"  -- currently have no *decent* way to get at    "dCHMsimpl" and  "dCHMsuper"  -- currently have no *decent* way to get at
83    the matrix factors of the corresponding matrix factorization !!    the matrix factors of the corresponding matrix factorization !!
84    
85  - 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)}  
86    
87  - <sparse> %*% <dense>  {also in crossprod/tcrossprod}  currently always  - <sparse> %*% <dense>  {also in crossprod/tcrossprod}  currently always
88    returns <dense>, since --> Csparse_dense_prod --> cholmod_sdmult    returns <dense>, since --> Csparse_dense_prod --> cholmod_sdmult
# Line 133  Line 95 
95    --> R/diagMatrix.R ('FIXME')    --> R/diagMatrix.R ('FIXME')
96    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
97    
98  - For a square sparse matrix 'b' {typically dgCMatrix or dgTMatrix},  - Diagonal(n) %*% A ---  too slow!! --> ~/R/MM/Pkg-ex/Matrix/diag-Tamas-ex.R
   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    
100  - ! <symmetricMatrix>  loses symmetry, both for dense and sparse matrices.  - ! <symmetricMatrix>  loses symmetry, both for dense and sparse matrices.
101    !M  where M is "sparseMatrix", currently always gives dense. This only    !M  where M is "sparseMatrix", currently always gives dense. This only
102    makes sense when M is ``really sparse''.    makes sense when M is ``really sparse''.
103    
 - log1p(<sparseMatrix>) "should" give <dsparseMatrix>  
   Pretty surely, this would happen automagically, if "log1p" became part of  
   "Math" group generic ---> which is the case from R 2.6.0 on  
   
104  - msy <- as(matrix(c(2:1,1:2),2), "dsyMatrix"); str(msy)  - msy <- as(matrix(c(2:1,1:2),2), "dsyMatrix"); str(msy)
105    
106    shows that the Cholesky factorization is computed ``too quickly''.    shows that the Cholesky factorization is computed ``too quickly''.
107    Can be a big pain for largish matrices, when it is unneeded.    Can be a big pain for largish matrices, when it is unneeded.
108    
109    - example(Cholesky, echo=FALSE) ; cm <- chol(mtm); str(cm); str(mtm)
110    
111      shows that chol() does not seems to make use of an already
112      present factorization and rather uses one with more '0' in x slot.
113    
114  - diag(m) <- val    currently automatically works via  m[cbind(i,i)] <- val  - diag(m) <- val    currently automatically works via  m[cbind(i,i)] <- val
115    However,    However,
116    we need methods for 'diag<-' at least for diagonalMatrix,    we need methods for 'diag<-' at least for diagonalMatrix,
117    triangularMatrix, and probably also "dense*general*Matrix" since the    triangularMatrix, and probably also "dense*general*Matrix" since the
118    above currently goes via "matrix" and back instead of using the 'x' slot    above currently goes via "matrix" and back instead of using the 'x' slot
119    directly.    directly.
120    
121    - image(M, ..): Think about an optional smart option which keeps
122       "0 |-> transparent" and allows colors to differentiate negative and
123       positive entries.
124    
125    - examples for solve( Cholesky(.), b, system = c("A", "LDLt"....))
126      probably rather in man/CHMfactor-class.Rd than man/Cholesky.Rd
127    
128    - tr(A %*% B) {and even  tr(A %*% B %*% C) ...} are also needed
129      frequently in some computations {conditional normal distr. ...}.
130      Since this can be done faster than by
131        sum(diag(A %*% B))  even for traditional matrices, e.g.
132                   sum(A * t(B)) or {even faster for "full" mat}
133                   crossprod(as.vector(A), as.vector(B))
134      and even more so for, e.g.  <sparse> %*% <dense>
135      {used in Soeren's 'gR' computations},
136      we should also provide a generic and methods.
137    
138    - qr.R(qr(x)) may differ for the "same" matrix, depending on it being
139      sparse or dense:
140        "qr.R(<sparse>) may differ from qr.R(<dense>) because of permutations"
141    
142      This is not really acceptable and currently influences  rcond() as well.
143    
144    - chol() and qr() generic:  currently have *two* arguments, and give the msg
145    
146      >  New generic for "chol" does not agree with implicit generic from package
147      >  "base"; a new generic will be assigned with package "Matrix"
148    
149      (and ditto for "qr")
150    
151      It was mentioned by an R-core member that he thought it did not make
152      sense to also dispatch on 'tol' or 'pivot' ...  --> maybe change that..
153    
154    - eigen() should become generic, and get a method at least for diagonal,
155      but also for symmetric -> dsyMatrix  [LAPACK dsyev() uses UPLO !],
156      but also simply for dgeMatrix (without going via tradition matrices).
157      What about Sparse?  There's fill-in, but it may still be sensible, e.g.
158      mlist <- list(1, 2:3, diag(x=5:3), 27, cbind(1,3:6), 100:101)
159      ee <- eigen(tcrossprod(bdiag(lapply(mlist, as.matrix))))
160      Matrix( signif(ee$vectors, 3) )
161    
162    - facmul() has no single method defined;  it looks like a good idea though
163      (instead of the infamous qr.qy, qr.qty,.... functions)
164    
165    - symmpart() and skewpart()  for *sparse* matrices still use (x +/- t(x))/2
166      and could be made more efficient.
167      Consider going via  asTuniq() or something very close to
168      .Arith.Csparse() in R/Ops.R
169    
170    - grep for '*HORRENDOUSLY* slow' in tests/simple.R
171      and do better than
172            unlist(lapply(seq_len(m), function(j) x[i1[j], i2[j]]))
173      in R/Matrix.R
174      --> now fixed for sparseMatrices : 'ss <- slp[ij]' in tests/simple.R
175    
176      But need similar fix for  m[ <ij-matrix> ] <- value
177      and the same for *dense* Matrices

Legend:
Removed from v.2005  
changed lines
  Added in v.2112

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