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 530, Mon Feb 7 10:58:27 2005 UTC revision 2105, Tue Jan 15 10:16:29 2008 UTC
# Line 1  Line 1 
1    Check for DimNames propagation in coercion and other operations.
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    
6  - [,] indexing  - [,] indexing: for sparse "works", but not yet for negative indices!
7    
8  - group generics: "Arith", but also "Ops" and "Math";  see  - consider moving alloc3Darray from ./src/Mutils.c to
9    ?Math.data.frame  and the examples in    $(RSRC)/src/base/array.c
10    ?SetGeneric  ------
11    - provide methods for "dspMatrix" and "dppMatrix"!
12    
13  - bCrosstab(): do we really want the diagonal "V:V" crosstabs?  - implement (more) methods for supporting "packed" (symmetric / triangular)
14                 (if so or in any case: add to  man/bCrosstab.Rd )    matrices; particularly something like pack() and unpack()  [to/from our
15      classes from/to "numeric"] --- have already man/unpack.Rd but no method yet!
16    
17  - src/Metis/ : one of the two Makefiles needs fixing, as changing    (have some dtr* <-> dtp*)
              src/Metis/*.c  does not lead to recompilation.  
   --DB - it seems both Makefiles need fixing.  I think I have the  
              src/Metis/Makefile fixed but not src/Makefile  
18    
19  - man/Matrix.Rd :  has example with dimnames, but we just drop them!  -----
                 MM thinks dimnames should be supported (but then ...)  
20    
21  - data/ : names 'mm' and even more 'y' are  ``too short''.  - combine the C functions for multiplication by special forms and
22          If we really want to keep them, don't use "LazyData"    solution wrt special forms by using a 'right' argument and a
23          (such that one needs  data(*) explicitly);    'classed' argument.
24          But MM would rather want something like  ex.mm and ex.y     [done with dgeMatrix_matrix_mm();  not yet for other classes;
25        and for _crossprod()]
26    
27  - "factors" maybe should move up to "Matrix"  - add more comprehensive examples / tests for Schur decomposition
28    
29  -------  - arithmetic for sparse matrices:
30                 <sparseMatrix>  o  <same-dim-sparseMatrix>
31      should return a sparse matrix  for at least "+" and "*" , also %%,
32      and "/" and "%/%" at least when the RHS is non-zero a scalar.
33      Challenge: nice implementation (``common non-0''; but Tsparse* is not uniq).
34    
35  We have a (at least one) basic problem :  -----
    Currently the show() method fail sometime after coercion:  
    e.g. 'sy' show()s wrongly, even though it "str()" fine :  
36    
37        (po <- crossprod(Matrix(0:3, 2))) # ok  - "Math2" , "Math", "Arith":
38        (ge <- as(po, "dgeMatrix")) # ok     keep triangular and symmetric Matrices when appropriate:
39        (sy <- as(po, "dsyMatrix")) # BAD     particularly desirable for  "Math2": round(), signif()
       str(sy) # looks fine  
40    
41    or  - "d" <-> "l" coercion for all "[TCR]" sparse matrices is really trivial:
42        example(expand) # -> ex$L and ex$U look bad, however    "d" -> "l" : drops the 'x' slot
43        as(ex$L, "dgeMatrix") # `works'    "l" -> "d" : construct an 'x' slot of all '1'
44      We currently have many of these conversions explicitly, e.g.
45       setAs("dsTMatrix", "lsTMatrix",
46          function(from) new("lsTMatrix", i = from@i, j = from@j, uplo = from@uplo,
47                             Dim = from@Dim, Dimnames = from@Dimnames))
48      but I would rather want to automatically construct all these coercion
49      methods at once by a ``method constructor'', i.e.,
50      for all  "dsparse*" -> "lsparse*" and vice versa.
51      How can one do this {in a documented way} ?
52    
53    {Of course, we don't need a workaround but must understand  - Think of constructing  setAs(...) calls automatically in order to
54     and solve the problem}    basically enable all ``sensible'' as(fromMatrix, toMatrix)  calls,
55      possibly using canCoerce(.)
56    
57    - setAs(<Mcl>,  "[dln]Matrix") for <Mcl> in {Matrix or denseMatrix + sparseMatrix}
58    
59    - When we have a packed matrix, it's a waste to go through "full" to "sparse":
60      ==> implement
61            setAs("dspMatrix", "sparseMatrix")
62            setAs("dppMatrix", "sparseMatrix")
63            setAs("dtpMatrix", "sparseMatrix")
64      and the same for "lsp" , "ltp"  and  "nsp" , "ntp" !
65    
66    - tcrossprod(x, y) : do provide methods for y != NULL
67      calling Lapack's DGEMM for "dense"
68      [2005-12-xx: done for dgeMatrix at least]
69    
70    - BUGlet:  Shouldn't lose factorization here:
71      h6 <- Hilbert(6); chol(h6) ; str(h6) # has factor
72      str(H6 <- as(h6, "dspMatrix"))       # has lost factor
73      ## and the same in a similar situation involving  "dpo", "dpp"
74    
75    - Things like  M[upper.tri(M)] are not really most useful for  sparse
76      matrices.  --> provide generic functions
77      upperTriMatrix(), lowerTriMatrix()  both with argument  'diag = TRUE'
78      (which can be set to FALSE of course) which are used to extract a
79      triangle from an arbitrary sparse matrix and  return a  "dtCMatrix".
80    
81    - Factorizations: LU done; also Schur()  for  *sparse*  Matrices.
82    
83    - band(), triu(), tril() for *all* including "matrix", not just sparse matrices
84    
85    - is.na() method for all our matrices [ ==> which(*, arr.ind=TRUE) might work ]
86    
87    - use  .Call(Csparse_drop, M, tol) in more places,
88      both with 'tol = 0.' to drop "values that happen to be 0" and for
89      zapsmall() methods for Csparse*
90    
91    - implement .Call(Csparse_scale, ....) interfacing to cholmod_scale()
92      in src/CHOLMOD/Include/cholmod_matrixops.h : for another function
93      specifically for multiplying a cholmod_sparse object by a diagonal matrix.
94      Use it in %*% and [t]crossprod methods.
95    
96    - chol() and determinant() should ``work'': proper result or "good" error
97      message.
98    
99    - make sure *all* group methods have (maybe "bail-out") setMethod for "Matrix".
100      e.g. zapsmall(<pMatrix>) fails "badly"
101    
102    - speedup: pass class definition to non0ind() [check all calls ..]
103    
104    - sum(): implement methods which work for *all* our matrices.
105    
106    - Implement  expand(.) for the Cholesky() results
107      "dCHMsimpl" and  "dCHMsuper"  -- currently have no *decent* way to get at
108      the matrix factors of the corresponding matrix factorization !!
109    
110    - rbind(<sparse>, <dense>) does not work  (e.g. <dgC>, <dge>)
111    
112    - make sure  M[FALSE, FALSE]  works for all Matrices
113      {e.g. fails for M <- Diagonal(4)}
114    
115    - <sparse> %*% <dense>  {also in crossprod/tcrossprod}  currently always
116      returns <dense>, since --> Csparse_dense_prod --> cholmod_sdmult
117      and that does only return dense.
118      When the sparse matrix is very sparse, i.e. has many rows with only zero
119      entries, it would make much sense to return sparse.
120    
121    - sparse-symmetric + diagonal should stay sparse-symmetric
122      (only stays sparse): Matrix(0, 4, 4) + Diagonal(4, 1:4)
123      --> R/diagMatrix.R ('FIXME')
124      but also R/Ops.R  to ensure  sp-sym. + sp-sym. |-> sp-sym.  etc
125    
126    - Diagonal(n) %*% A ---  too slow!! --> ~/R/MM/Pkg-ex/Matrix/diag-Tamas-ex.R
127    
128    - For a square sparse matrix 'b' {typically dgCMatrix or dgTMatrix},
129      we'd want a function  "Mat_plus_t_Mat" <- function(b) {....}
130      which computes the symmetric sparse matrix   b + t(b)
131      in way that never works with size-doubled vectors from  b@i etc..
132    
133    - ! <symmetricMatrix>  loses symmetry, both for dense and sparse matrices.
134      !M  where M is "sparseMatrix", currently always gives dense. This only
135      makes sense when M is ``really sparse''.
136    
137    - msy <- as(matrix(c(2:1,1:2),2), "dsyMatrix"); str(msy)
138    
139      shows that the Cholesky factorization is computed ``too quickly''.
140      Can be a big pain for largish matrices, when it is unneeded.
141    
142    - example(Cholesky, echo=FALSE) ; cm <- chol(mtm); str(cm); str(mtm)
143    
144      shows that chol() does not seems to make use of an already
145      present factorization and rather uses one with more '0' in x slot.
146    
147    - diag(m) <- val    currently automatically works via  m[cbind(i,i)] <- val
148      However,
149      we need methods for 'diag<-' at least for diagonalMatrix,
150      triangularMatrix, and probably also "dense*general*Matrix" since the
151      above currently goes via "matrix" and back instead of using the 'x' slot
152      directly.
153    
154    - image(M, ..): Think about an optional smart option which keeps
155       "0 |-> transparent" and allows colors to differentiate negative and
156       positive entries.
157    
158    - examples for solve( Cholesky(.), b, system = c("A", "LDLt"....))
159      probably rather in man/CHMfactor-class.Rd than man/Cholesky.Rd
160    
161    - (A + tr(A))/2  := the symmetric part of A, is needed in several
162      circumstances; unfortunately it's not "smart" (preserving symmetry, ...)
163      --> define a generic and methods for it!
164      Names:  symPart(A) or  symMat(A) or symmetrize(A) or ... ?
165      Googling around I found that Nick Higham has a GPL contributed Matlab
166      toolbox where he uses  symmpart(A) := (A + A') /. 2
167      {and  skewpart(A) := (A - A') /. 2}
168    
169    - tr(A %*% B) {and even  tr(A %*% B %*% C) ...} are also needed
170      frequently in some computations {conditional normal distr. ...}.
171      Since this can be done faster than by
172        sum(diag(A %*% B))  even for traditional matrices, e.g.
173                   sum(A * t(B)) or {even faster for "full" mat}
174                   crossprod(as.vector(A), as.vector(B))
175      and even more so for, e.g.  <sparse> %*% <dense>
176      {used in Soeren's 'gR' computations},
177      we should also provide a generic and methods.
178    
179    - qr.R(qr(x)) may differ for the "same" matrix, depending on it being
180      sparse or dense:
181        "qr.R(<sparse>) may differ from qr.R(<dense>) because of permutations"
182    
183      This is not really acceptable and currently influences  rcond() as well.
184    
185    - chol() and qr() generic:  currently have *two* arguments, and give
186    
187      New generic for "chol" does not agree with implicit generic from package "base"; a new generic will be assigned with package "Matrix"
188    
189      New generic for "qr" does not agree with implicit generic from package "base"; a new generic will be assigned with package "Matrix"
190    
191      It was mentioned by an R-core member that he thought it did not make
192      sense to also dispatch on 'tol' or 'pivot' ...  --> maybe change that..

Legend:
Removed from v.530  
changed lines
  Added in v.2105

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