The R Project SVN R-packages

Rev

Rev 1043 | Rev 4039 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1043 Rev 1294
Line 78... Line 78...
78
dense matrices.  At present only the real classes have been
78
dense matrices.  At present only the real classes have been
79
implemented.  These classes are
79
implemented.  These classes are
80
\begin{description}
80
\begin{description}
81
\item[dgeMatrix] Real matrices in general storage mode
81
\item[dgeMatrix] Real matrices in general storage mode
82
\item[dsyMatrix] Symmetric real matrices in non-packed storage
82
\item[dsyMatrix] Symmetric real matrices in non-packed storage
-
 
83
\item[dspMatrix] Symmetric real matrices in packed storage (one triangle only)
83
\item[dtrMatrix] Triangular real matrices in non-packaged storage
84
\item[dtrMatrix] Triangular real matrices in non-packed storage
-
 
85
\item[dtpMatrix] Triangular real matrices in packed storage (triangle only)
84
\item[dpoMatrix] Positive semi-definite symmetric real matrices in
86
\item[dpoMatrix] Positive semi-definite symmetric real matrices in
85
  non-package storage
87
  non-packed storage
-
 
88
\item[dppMatrix] \ \ dito \ \ in packed storage
86
\end{description}
89
\end{description}
87
Methods for these classes include coercion between these classes, when
90
Methods for these classes include coercion between these classes, when
88
appropriate, and coercion to the \code{matrix} class; methods for
91
appropriate, and coercion to the \code{matrix} class; methods for
89
matrix multiplication (\code{\%*\%}); cross products
92
matrix multiplication (\code{\%*\%}); cross products
90
(\code{crossprod}), matrix norm (\code{norm}); reciprocal condition
93
(\code{crossprod}), matrix norm (\code{norm}); reciprocal condition
91
number (\code{rcond}); LU factorization (\code{lu}) or, for the
94
number (\code{rcond}); LU factorization (\code{lu}) or, for the
92
\code{poMatrix} class, the Cholesky decomposition (\code{chol}); and
95
\code{poMatrix} class, the Cholesky decomposition (\code{chol}); and
93
solutions of linear systems of equations (\code{solve}).
96
solutions of linear systems of equations (\code{solve}).
94
 
97
 
-
 
98
Further, group methods have been defined for the \code{Arith} (basic
-
 
99
arithmetic, including with scalar numbers) and the \code{Math} (basic
-
 
100
mathematical functions) group..
-
 
101
 
95
Whenever a factorization or a decomposition is calculated it is
102
Whenever a factorization or a decomposition is calculated it is
96
preserved as a (list) element in the \code{factors} slot of the
103
preserved as a (list) element in the \code{factors} slot of the
97
original object.  In this way a sequence of operations, such as
104
original object.  In this way a sequence of operations, such as
98
determining the condition number of a matrix then solving a linear
105
determining the condition number of a matrix then solving a linear
99
system based on the matrix, do not require multiple factorizations of
106
system based on the matrix, do not require multiple factorizations of
Line 117... Line 124...
117
\begin{Sinput}
124
\begin{Sinput}
118
setClass("dgTMatrix",
125
setClass("dgTMatrix",
119
         representation(i = "integer", j = "integer", x = "numeric",
126
         representation(i = "integer", j = "integer", x = "numeric",
120
                        Dim = "integer"))
127
                        Dim = "integer"))
121
\end{Sinput}
128
\end{Sinput}
122
\end{Schunk}  
129
\end{Schunk}
123
    
130
 
124
The triplet representation is row-oriented if elements in the same row
131
The triplet representation is row-oriented if elements in the same row
125
were adjacent and column-oriented if elements in the same column were
132
were adjacent and column-oriented if elements in the same column were
126
adjacent.  The compressed sparse row (csr) (or compressed sparse
133
adjacent.  The compressed sparse row (csr) (or compressed sparse
127
column - csc) representation is similar to row-oriented triplet
134
column - csc) representation is similar to row-oriented triplet
128
(column-oriented triplet) except that \code{i} (\code{j}) just stores
135
(column-oriented triplet) except that \code{i} (\code{j}) just stores
129
the index of the first element in the row (column).  (There are a
136
the index of the first element in the row (column).  (There are a
130
couple of other details but that is the gist of it.)  These compressed
137
couple of other details but that is the gist of it.)  These compressed
131
representations remove the redundant row (column) indices and provide
138
representations remove the redundant row (column) indices and provide
132
faster access to a given location in the matrix because you only need
139
faster access to a given location in the matrix because you only need
133
to check one row (column).
140
to check one row (column).
134
    
141
 
135
The preferred representation of sparse matrices in the SparseM package
142
The preferred representation of sparse matrices in the SparseM package
136
is csr.  Matlab uses csc.  We hope that Octave will also use this
143
is csr.  Matlab uses csc.  We hope that Octave will also use this
137
representation. There are certain advantages to csc in systems like R
144
representation. There are certain advantages to csc in systems like R
138
and Matlab where dense matrices are stored in column-major order.  For
145
and Matlab where dense matrices are stored in column-major order.  For
139
example, Sivan Toledo's TAUCS~\cite{Taucs} library and Tim Davis's
146
example, Sivan Toledo's TAUCS~\cite{Taucs} library and Tim Davis's