File: matrix.coo-class.Rd

package info (click to toggle)
r-cran-sparsem 1.84-2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,648 kB
  • sloc: fortran: 3,998; ansic: 75; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 1,987 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
\name{matrix.coo-class}
\title{Class "matrix.coo" -- Sparse Matrices in [Coo]rdinate Format}
\docType{class}
\alias{matrix.coo-class}
\description{
  Class for sparse matrices stored in coordinate aka
  \dQuote{triplet} format, storing for each non-zero entry \code{x[i,j]}
  the triplet \code{(i,j, x[i,j])}, in slots \code{(ia, ja, ra)}.
}
\section{Objects from the Class}{
  Objects can be created by calls of the form \code{new("matrix.coo", ...)},
  but typically rather by \code{\link{as.matrix.coo}()}.
}
\section{Slots}{
  \describe{
    \item{\code{ra}:}{Object of class \code{numeric}, a real array of nnz elements containing the non-zero
        elements of A.}
    \item{\code{ja}:}{Object of class \code{integer}, an integer array of nnz elements containing the column
        indices of the elements stored in `ra'.}
    \item{\code{ia}:}{Object of class \code{integer}, an integer array of nnz elements containing the row
        indices of the elements stored in `ra'.}
    \item{\code{dimension}:}{Object of class \code{integer}, dimension of the matrix }
  }
}
\section{Methods}{
  \describe{
    \item{as.matrix.coo}{\code{signature(x = "matrix.coo")}: ... }
    \item{as.matrix.csr}{\code{signature(x = "matrix.coo")}: ... }
    \item{as.matrix}{\code{signature(x = "matrix.coo")}: ... }
    \item{dim}{\code{signature(x = "matrix.coo")}: ... }
  }
}

\seealso{ \code{\link{matrix.csr-class}}}

\examples{
 try(  new("matrix.coo") ) # fails currently {FIXME!}     # the 1x1 matrix [0]

 ## correponds to base  matrix()
 mcoo <- new("matrix.coo", ra=NA_real_, ia = 1L, ja = 1L, dimension = c(1L, 1L))
 mcoo # currently *does* print but wrongly:  as.matrix.csr(<matrix.coo>) fails to keep NA !!
 co2 <- new("matrix.coo", ra = c(-Inf, -2, 3, Inf),
            ia = c(1L,1:3), ja = 2L*(1:4), dimension = c(7L, 12L))
 co2 # works fine (as has no NA)

 ## Sparse Diagonal (from "numeric"):
 as(1:5, "matrix.diag.csr") # a sparse version of  diag(1:5)
}

\keyword{classes}