SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/R/HBMM.R
ViewVC logotype

Diff of /pkg/Matrix/R/HBMM.R

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

revision 3045, Mon Feb 16 14:39:35 2015 UTC revision 3046, Mon Feb 16 14:40:37 2015 UTC
# Line 36  Line 36 
36          on.exit(close(file))          on.exit(close(file))
37      }      }
38      hdr <- readLines(file, 4, ok = FALSE)      hdr <- readLines(file, 4, ok = FALSE)
39      Title <- sub('[[:space:]]+$', '', substr(hdr[1], 1, 72))      ## Title <- sub('[[:space:]]+$', '', substr(hdr[1], 1, 72))
40      Key <- sub('[[:space:]]+$', '', substr(hdr[1], 73, 80))      ## Key   <- sub('[[:space:]]+$', '', substr(hdr[1], 73, 80))
41      totln <- as.integer(substr(hdr[2], 1, 14))      ## totln <- as.integer(substr(hdr[2], 1, 14))
42      ptrln <- as.integer(substr(hdr[2], 15, 28))      ptrln <- as.integer(substr(hdr[2], 15, 28))
43      indln <- as.integer(substr(hdr[2], 29, 42))      indln <- as.integer(substr(hdr[2], 29, 42))
44      valln <- as.integer(substr(hdr[2], 43, 56))      valln <- as.integer(substr(hdr[2], 43, 56))
# Line 54  Line 54 
54      nr <- as.integer(substr(hdr[3], 15, 28))      nr <- as.integer(substr(hdr[3], 15, 28))
55      nc <- as.integer(substr(hdr[3], 29, 42))      nc <- as.integer(substr(hdr[3], 29, 42))
56      nz <- as.integer(substr(hdr[3], 43, 56))      nz <- as.integer(substr(hdr[3], 43, 56))
57      nel <- as.integer(substr(hdr[3], 57, 70))      ## nel <- as.integer(substr(hdr[3], 57, 70))
58      ptrfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 1, 16)))      ptrfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 1, 16)))
59      indfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 17, 32)))      indfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 17, 32)))
60      valfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 33, 52)))      valfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 33, 52)))
61      rhsfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 53, 72)))      ## rhsfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 53, 72)))
62      if (!is.na(rhsln) && rhsln > 0) {      if (!is.na(rhsln) && rhsln > 0) readLines(file, 1, ok = FALSE) # h5
         h5 <- readLines(file, 1, ok = FALSE)  
     }  
63      ptr <- readmany(file, ptrln, nc + 1, ptrfmt, as.integer)      ptr <- readmany(file, ptrln, nc + 1, ptrfmt, as.integer)
64      ind <- readmany(file, indln, nz, indfmt, as.integer)      ind <- readmany(file, indln, nz, indfmt, as.integer)
65      vals <- readmany(file, valln, nz, valfmt, as.numeric)      vals <- readmany(file, valln, nz, valfmt, as.numeric)
# Line 87  Line 85 
85      scan1 <- function(what, ...)      scan1 <- function(what, ...)
86          scan(file, nmax = 1, what = what, quiet = TRUE, ...)          scan(file, nmax = 1, what = what, quiet = TRUE, ...)
87    
88      if ((hdr <- scan1(character())) != "%%MatrixMarket")      if (scan1(character()) != "%%MatrixMarket")# hdr
89          stop("file is not a MatrixMarket file")          stop("file is not a MatrixMarket file")
90      if (!(typ <- tolower(scan1(character()))) %in% "matrix")      if (!(typ <- tolower(scan1(character()))) %in% "matrix")
91          stop(gettextf("type '%s' not recognized", typ), domain = NA)          stop(gettextf("type '%s' not recognized", typ), domain = NA)

Legend:
Removed from v.3045  
changed lines
  Added in v.3046

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