Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
spam
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Reinhard Furrer
spam
Commits
cb5ae56f
Commit
cb5ae56f
authored
Dec 23, 2017
by
Reinhard Furrer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new version spam[64].2.1.2 material
parent
6a327d47
Changes
157
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
157 changed files
with
6122 additions
and
1795 deletions
+6122
-1795
ChangeLog
ChangeLog
+1402
-0
DESCRIPTION
DESCRIPTION
+24
-12
NAMESPACE
NAMESPACE
+10
-3
R/apply.R
R/apply.R
+18
-21
R/constructors.R
R/constructors.R
+19
-4
R/covmat.R
R/covmat.R
+18
-5
R/definitions.R
R/definitions.R
+866
-521
R/deprecated.R
R/deprecated.R
+46
-0
R/diff.R
R/diff.R
+19
-4
R/dim.R
R/dim.R
+105
-40
R/dist.R
R/dist.R
+30
-8
R/foreign.R
R/foreign.R
+46
-5
R/helper.R
R/helper.R
+43
-18
R/kronecker.R
R/kronecker.R
+130
-46
R/math.R
R/math.R
+254
-92
R/mle.R
R/mle.R
+19
-4
R/norm.R
R/norm.R
+19
-4
R/permutation.R
R/permutation.R
+158
-76
R/plotting.R
R/plotting.R
+18
-7
R/precmat.R
R/precmat.R
+18
-5
R/profile.R
R/profile.R
+37
-4
R/rep_len64.R
R/rep_len64.R
+38
-0
R/rmvnorm.R
R/rmvnorm.R
+18
-5
R/rowcolstats.R
R/rowcolstats.R
+109
-28
R/s3only.R
R/s3only.R
+19
-4
R/s4coerce.R
R/s4coerce.R
+19
-5
R/spam_solve.R
R/spam_solve.R
+381
-153
R/spamlist.R
R/spamlist.R
+142
-64
R/subset.R
R/subset.R
+90
-26
R/summary.R
R/summary.R
+72
-0
R/tailhead.R
R/tailhead.R
+19
-5
R/tcrossprod.R
R/tcrossprod.R
+23
-4
R/toepliz.R
R/toepliz.R
+116
-47
R/xybind.R
R/xybind.R
+25
-4
inst/CITATION
inst/CITATION
+19
-0
inst/NEWS
inst/NEWS
+52
-0
man/Oral.Rd
man/Oral.Rd
+3
-0
man/UScounties.Rd
man/UScounties.Rd
+3
-0
man/USprecip.Rd
man/USprecip.Rd
+3
-0
man/adjacency.Rd
man/adjacency.Rd
+3
-0
man/allequal.Rd
man/allequal.Rd
+3
-0
man/apply.Rd
man/apply.Rd
+3
-0
man/bandwidth.Rd
man/bandwidth.Rd
+3
-0
man/bdiag.Rd
man/bdiag.Rd
+3
-0
man/chol.Rd
man/chol.Rd
+8
-5
man/circulant.Rd
man/circulant.Rd
+3
-0
man/cleanup.Rd
man/cleanup.Rd
+3
-0
man/coerce.Rd
man/coerce.Rd
+3
-0
man/coercion.Rd
man/coercion.Rd
+3
-0
man/complexity.Rd
man/complexity.Rd
+3
-0
man/constructors.Rd
man/constructors.Rd
+3
-0
man/cov.Rd
man/cov.Rd
+3
-0
man/crossprod.Rd
man/crossprod.Rd
+11
-0
man/det.Rd
man/det.Rd
+3
-0
man/diag.Rd
man/diag.Rd
+5
-2
man/diff.Rd
man/diff.Rd
+3
-0
man/dim.Rd
man/dim.Rd
+3
-0
man/display.Rd
man/display.Rd
+3
-0
man/foreign.Rd
man/foreign.Rd
+3
-0
man/germany.Rd
man/germany.Rd
+3
-0
man/germanydata.Rd
man/germanydata.Rd
+3
-0
man/grid_trace2.Rd
man/grid_trace2.Rd
+3
-0
man/grid_zoom.Rd
man/grid_zoom.Rd
+3
-0
man/headtail.Rd
man/headtail.Rd
+3
-0
man/history.spam.Rd
man/history.spam.Rd
+3
-0
man/image.Rd
man/image.Rd
+3
-0
man/import.Rd
man/import.Rd
+4
-1
man/isSymmetric.Rd
man/isSymmetric.Rd
+3
-0
man/kronecker.Rd
man/kronecker.Rd
+6
-0
man/landkreis.Rd
man/landkreis.Rd
+3
-0
man/large_matrix.Rd
man/large_matrix.Rd
+58
-0
man/lu.tri.Rd
man/lu.tri.Rd
+3
-0
man/makeprec.Rd
man/makeprec.Rd
+3
-0
man/math.Rd
man/math.Rd
+3
-0
man/math2.Rd
man/math2.Rd
+3
-0
man/methods.Rd
man/methods.Rd
+3
-0
man/mle.Rd
man/mle.Rd
+3
-0
man/nearestdist.Rd
man/nearestdist.Rd
+21
-9
man/operations.Rd
man/operations.Rd
+4
-1
man/options.Rd
man/options.Rd
+4
-2
man/ordering.Rd
man/ordering.Rd
+3
-0
man/pad.Rd
man/pad.Rd
+3
-0
man/permutation.Rd
man/permutation.Rd
+3
-0
man/powerboost.Rd
man/powerboost.Rd
+3
-0
man/precmat.Rd
man/precmat.Rd
+3
-0
man/print.Rd
man/print.Rd
+3
-0
man/rdist.Rd
man/rdist.Rd
+3
-0
man/rmvnorm.Rd
man/rmvnorm.Rd
+3
-0
man/rmvnorm.const.Rd
man/rmvnorm.const.Rd
+3
-0
man/rowcolstats.Rd
man/rowcolstats.Rd
+3
-0
man/s3only.Rd
man/s3only.Rd
+3
-0
man/solve.Rd
man/solve.Rd
+3
-0
man/spam-class.Rd
man/spam-class.Rd
+3
-7
man/spam-deprecated.Rd
man/spam-deprecated.Rd
+11
-0
man/spam-package.Rd
man/spam-package.Rd
+18
-4
man/spam.chol.NgPeyton-class.Rd
man/spam.chol.NgPeyton-class.Rd
+3
-0
man/spam.creation.Rd
man/spam.creation.Rd
+17
-8
man/spam.internal.Rd
man/spam.internal.Rd
+3
-0
man/summary.Rd
man/summary.Rd
+3
-0
man/todo.Rd
man/todo.Rd
+3
-0
man/toeplitz.Rd
man/toeplitz.Rd
+3
-0
man/triplet.Rd
man/triplet.Rd
+3
-0
man/validate_spam.Rd
man/validate_spam.Rd
+3
-0
man/version.Rd
man/version.Rd
+3
-0
man/xybind.Rd
man/xybind.Rd
+7
-2
spam64_2.0-05.tar.gz
spam64_2.0-05.tar.gz
+0
-0
spam64_2.1-2.tar.gz
spam64_2.1-2.tar.gz
+0
-0
spam_2.0-05.tar.gz
spam_2.0-05.tar.gz
+0
-0
spam_2.1-2.tar.gz
spam_2.1-2.tar.gz
+0
-0
src/bckslvmodified.f
src/bckslvmodified.f
+2
-2
src/cholmodified.f
src/cholmodified.f
+217
-229
src/dist.f
src/dist.f
+14
-11
src/fromsparsekit.f
src/fromsparsekit.f
+1
-1
src/init.c
src/init.c
+165
-0
src/kronecker.f
src/kronecker.f
+1
-1
src/spamown.f
src/spamown.f
+4
-2
src/xybind.f
src/xybind.f
+1
-1
tests/demo_article-jss-example1.R
tests/demo_article-jss-example1.R
+18
-7
tests/demo_article-jss-example1.Rout.save
tests/demo_article-jss-example1.Rout.save
+23
-11
tests/demo_article-jss-example2.R
tests/demo_article-jss-example2.R
+18
-4
tests/demo_article-jss-example2.Rout.save
tests/demo_article-jss-example2.Rout.save
+23
-8
tests/demo_article-jss.R
tests/demo_article-jss.R
+18
-11
tests/demo_article-jss.Rout.save
tests/demo_article-jss.Rout.save
+23
-27
tests/demo_cholesky.R
tests/demo_cholesky.R
+18
-11
tests/demo_cholesky.Rout.save
tests/demo_cholesky.Rout.save
+23
-15
tests/demo_jss15-BYM.R
tests/demo_jss15-BYM.R
+18
-4
tests/demo_jss15-BYM.Rout.save
tests/demo_jss15-BYM.Rout.save
+23
-8
tests/demo_jss15-Leroux.R
tests/demo_jss15-Leroux.R
+18
-5
tests/demo_jss15-Leroux.Rout.save
tests/demo_jss15-Leroux.Rout.save
+23
-9
tests/demo_spam.R
tests/demo_spam.R
+18
-11
tests/demo_spam.Rout.save
tests/demo_spam.Rout.save
+25
-17
tests/demo_timing.R
tests/demo_timing.R
+18
-11
tests/demo_timing.Rout.save
tests/demo_timing.Rout.save
+23
-15
tests/jss_areal_counts.R
tests/jss_areal_counts.R
+18
-7
tests/jss_areal_counts.Rout.save
tests/jss_areal_counts.Rout.save
+23
-11
tests/testthat.R
tests/testthat.R
+21
-2
tests/testthat/helper.R
tests/testthat/helper.R
+30
-4
tests/testthat/test-constructors.R
tests/testthat/test-constructors.R
+19
-4
tests/testthat/test-covmat.R
tests/testthat/test-covmat.R
+18
-4
tests/testthat/test-crossprod.R
tests/testthat/test-crossprod.R
+26
-4
tests/testthat/test-diff.R
tests/testthat/test-diff.R
+19
-4
tests/testthat/test-dim.R
tests/testthat/test-dim.R
+19
-4
tests/testthat/test-dist.R
tests/testthat/test-dist.R
+18
-3
tests/testthat/test-helper.R
tests/testthat/test-helper.R
+18
-7
tests/testthat/test-kronecker.R
tests/testthat/test-kronecker.R
+21
-6
tests/testthat/test-math.R
tests/testthat/test-math.R
+22
-7
tests/testthat/test-mle.R
tests/testthat/test-mle.R
+23
-8
tests/testthat/test-ops.R
tests/testthat/test-ops.R
+19
-4
tests/testthat/test-overall.R
tests/testthat/test-overall.R
+37
-0
tests/testthat/test-permutation.R
tests/testthat/test-permutation.R
+20
-4
tests/testthat/test-profile.R
tests/testthat/test-profile.R
+22
-2
tests/testthat/test-rep_len64.R
tests/testthat/test-rep_len64.R
+46
-0
tests/testthat/test-rowcolstats.R
tests/testthat/test-rowcolstats.R
+37
-4
tests/testthat/test-solve.R
tests/testthat/test-solve.R
+23
-6
tests/testthat/test-spamlist.R
tests/testthat/test-spamlist.R
+68
-6
tests/testthat/test-subset.R
tests/testthat/test-subset.R
+19
-4
tests/testthat/test-xybind.R
tests/testthat/test-xybind.R
+18
-4
No files found.
ChangeLog
View file @
cb5ae56f
This diff is collapsed.
Click to expand it.
DESCRIPTION
View file @
cb5ae56f
Package: spam
Version: 2.0-05
Date: 2016-11-19
Type: Package
Title: SPArse Matrix
Version: 2.1-2
Date: 2017-12-21
Authors@R: c(person("Reinhard", "Furrer", role = c("aut", "cre"),
email = "reihard.furrer@math.uzh.ch"),
person("Florian", "Gerber", role =
"ctb"
,
email = "rei
n
hard.furrer@math.uzh.ch"),
person("Florian", "Gerber", role =
c("ctb")
,
email = "florian.gerber@math.uzh.ch"),
person("Daniel", "Gerber", role = "ctb",
email = "daniel_gerber_2222@hotmail.com"),
person("Kaspar", "Moesinger", role = "ctb",
email = "kaspar.moesinger@gmail.com"))
Author: Reinhard Furrer [aut, cre], Florian Gerber [ctb], Kaspar Moesinger [ctb]
Maintainer: Reinhard Furrer <reinhard.furrer@math.uzh.ch>
email = "kaspar.moesinger@gmail.com"),
person("Youcef", "Saad", role = "ctb",
comment = "SPARSEKIT http://www-users.cs.umn.edu/~saad/software/SPARSKIT/"),
person(c("Esmond", "G."), "Ng", role = "ctb",
comment = "Fortran Cholesky routines"),
person(c("Barry", "W."), "Peyton", role = "ctb",
comment = "Fortran Cholesky routines"),
person(c("Joseph", "W.H."), "Liu", role = "ctb",
comment = "Fortran Cholesky routines"),
person(c("Alan", "D."), "George", role = "ctb",
comment = "Fortran Cholesky routines")
)
Depends:
R (>= 3.1),
dotCall64,
...
...
@@ -24,13 +37,12 @@ Suggests:
truncdist
VignetteBuilder: R.rsp
Description: Set of functions for sparse matrix algebra.
Differences with
SparseM/Matrix
are:
Differences with
other sparse matrix packages
are:
(1) we only support (essentially) one sparse matrix format,
(2) based on transparent and simple structure(s),
(3) tailored for MCMC calculations within G
M
RF.
(4)
S3 and S4 like-"compatible" ... and it is fast
.
(3) tailored for MCMC calculations within G
(M)
RF.
(4)
and it is fast and scalable (with the extension package spam64)
.
LazyLoad: Yes
LazyData: Yes
License: LGPL-2
Title: SPArse Matrix
URL: http://www.math.uzh.ch/furrer/software/spam/
\ No newline at end of file
URL: https://git.math.uzh.ch/reinhard.furrer/spam
NAMESPACE
View file @
cb5ae56f
useDynLib(spam)
useDynLib(spam
, .registration = TRUE
)
import(grid)
import("dotCall64")
...
...
@@ -39,10 +39,14 @@ S3method("solve","spam")
S3method("subset","spam")
S3method("summary","spam")
S3method("summary","spam.chol.NgPeyton")
S3method("print","summary.spam")
S3method("print","summary.spam.chol.NgPeyton")
S3method("t","spam")
S3method("tail","spam")
S3method("update","spam.chol.NgPeyton")
S3method("cbind","spam")
S3method("rbind","spam")
# Generic functions
export(
...
...
@@ -54,6 +58,10 @@ export(
"spam.Version",
"validate_spam",
"validspamobject", # __DEPRECATED__
"spam.options", # __DEPRECATED__
"spam.getOption", # __DEPRECATED__
"nearest.dist",
"spam_rdist",
...
...
@@ -255,7 +263,6 @@ exportMethods(
"t",
"diag",
"diag<-",
"diag<-",
"upper.tri",
"lower.tri",
...
...
R/apply.R
View file @
cb5ae56f
# This is file ../spam/R/apply.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/apply.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
# primitive apply function.
...
...
R/constructors.R
View file @
cb5ae56f
# This is file ../spam/R/constructors.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/constructors.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
"rowpointers<-"
<-
function
(
x
,
value
)
{
...
...
R/covmat.R
View file @
cb5ae56f
# This is file ../spam/R/covmat.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/covmat.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
# construct various precision matrices
...
...
R/definitions.R
View file @
cb5ae56f
This diff is collapsed.
Click to expand it.
R/deprecated.R
0 → 100644
View file @
cb5ae56f
# HEADER ####################################################
# This is file spam/R/deprecated.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
validspamobject
<-
function
(
...
)
{
# .Deprecated('validate_spam()')
message
(
"`validspamobject()` is deprecated. Use `validate_spam()` directly"
)
validate_spam
(
...
)
}
spam.getOption
<-
function
(
...
)
{
# .Deprecated(msg="`spam.getOption( arg)` is deprecated.\n Use `getOption( spam.arg)` directly")
message
(
"`spam.getOption( arg)` is deprecated. Use `getOption( spam.arg)` directly"
)
getOption
(
...
)
}
spam.options
<-
function
(
...
)
{
# .Deprecated(msg="`spam.options( arg)` is deprecated.\n Use `options( spam.arg)` directly")
message
(
"`spam.options( arg)` is deprecated. Use `options( spam.arg)` directly"
)
if
(
nargs
()
==
0
)
{
tmp
<-
names
(
options
())
return
(
options
()[
grep
(
"spam."
,
tmp
)])
}
args
<-
list
(
...
)
names
(
args
)
<-
paste0
(
"spam."
,
names
(
args
))
do.call
(
"options"
,
args
)
}
R/diff.R
View file @
cb5ae56f
# This is file ../spam/R/diff.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/diff.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
...
...
R/dim.R
View file @
cb5ae56f
# This is file ../spam/R/dim.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/dim.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
# This is the actual dim...
...
...
@@ -46,56 +60,107 @@
# dim and derivatives
"pad<-.spam"
<-
function
(
x
,
value
)
{
if
(
(
min
(
value
)
<
1
)
||
any
(
!
is.finite
(
value
)))
stop
(
"dims should be postive integers."
)
if
(
!
identical
(
length
(
value
),
2L
))
stop
(
"dims should be of length 2."
)
dimx
<-
x
@
dimension
last
<-
value
[
1
]
+1
force64
<-
getOption
(
"spam.force64"
)
# check if value is valid
if
(
(
min
(
value
)
<
1
)
||
any
(
!
is.finite
(
value
)))
stop
(
"dims should be postive integers."
)
if
(
!
identical
(
length
(
value
),
2L
))
stop
(
"dims should be of length 2."
)
dimx
<-
x
@
dimension
last
<-
value
[
1
]
+1
# In three steps:
# 1) Address col truncation
# to safe time, we also take into account if we have fewer or equal rows
# 2) Augment rows
# 3) if fewer rows and more columns, truncate
# In any case, dimensions are fixed at the end.
# If fewer cols required, we run reducedim
if
(
dimx
[
2
]
>
value
[
2
]){
# subroutine reducedim(a,ja,ia,eps,bnrow,bncol,k,b,jb,ib)
z
<-
.Fortran
(
"reducedim"
,
oldra
=
as.double
(
x
@
entries
),
oldja
=
as.integer
(
x
@
colindices
),
oldia
=
as.integer
(
x
@
rowpointers
),
eps
=
as.double
(
getOption
(
"spam.eps"
)),
as.integer
(
min
(
value
[
1
],
dimx
[
1
])),
as.integer
(
value
[
2
]),
nz
=
1L
,
entries
=
vector
(
"double"
,
length
(
x
@
entries
)),
colindices
=
vector
(
"integer"
,
length
(
x
@
entries
)),
rowpointers
=
vector
(
"integer"
,
last
),
NAOK
=
getOption
(
"spam.NAOK"
),
PACKAGE
=
"spam"
)
if
(
identical
(
z
$
nz
,
1L
)
)
return
(
new
(
"spam"
,
rowpointers
=
c
(
1L
,
rep.int
(
2L
,
as.integer
(
value
[
1
]))),
dimension
=
as.integer
(
value
)))
nz
<-
z
$
nz
-1
slot
(
x
,
"entries"
,
check
=
FALSE
)
<-
z
$
entries
[
1
:
nz
]
slot
(
x
,
"colindices"
,
check
=
FALSE
)
<-
z
$
colindices
[
1
:
nz
]
slot
(
x
,
"rowpointers"
,
check
=
FALSE
)
<-
z
$
rowpointers
[
1
:
min
(
last
,
dimx
[
1
]
+1
)]
if
(
force64
||
.format.spam
(
x
)
$
package
==
"spam64"
)
SS
<-
.format64
()
else
SS
<-
.format32
z
<-
.C64
(
"reducedim"
,
SIGNATURE
=
c
(
"double"
,
SS
$
signature
,
SS
$
signature
,
"double"
,
SS
$
signature
,
SS
$
signature
,
SS
$
signature
,
"double"
,
SS
$
signature
,
SS
$
signature
),
oldra
=
x
@
entries
,
oldja
=
x
@
colindices
,
oldia
=
x
@
rowpointers
,
eps
=
getOption
(
"spam.eps"
),
min
(
value
[
1
],
dimx
[
1
]),
value
[
2
],
nz
=
1
,
entries
=
vector_dc
(
"double"
,
length
(
x
@
entries
)),
colindices
=
vector_dc
(
SS
$
type
,
length
(
x
@
entries
)),
rowpointers
=
vector_dc
(
SS
$
type
,
last
),
INTENT
=
c
(
"r"
,
"r"
,
"r"
,
"r"
,
"r"
,
"r"
,
"w"
,
"w"
,
"w"
,
"w"
),
NAOK
=
getOption
(
"spam.NAOK"
),
PACKAGE
=
SS
$
package
)
if
(
z
$
nz
==
1
){
#was identical( z$nz,1L)
## print("2")
return
(
.newSpam
(
entries
=
x
@
entries
,
colindices
=
x
@
colindices
,
rowpointers
=
c
(
1
,
rep_len64
(
2
,
value
[
1
])),
dimension
=
value
,
force64
=
force64
)
)
}
nz
<-
z
$
nz
-1
x
<-
.newSpam
(
entries
=
z
$
entries
[
1
:
nz
],
colindices
=
z
$
colindices
[
1
:
nz
],
rowpointers
=
z
$
rowpointers
[
1
:
min
(
last
,
dimx
[
1
]
+1
)],
dimension
=
value
,
#actually here dim 2 = value 2 but dim1 maybe not yet
force64
=
force64
)
}
# augment rows
# augment rows
if
(
dimx
[
1
]
<
value
[
1
]){
slot
(
x
,
"rowpointers"
,
check
=
FALSE
)
<-
c
(
x
@
rowpointers
,
rep.int
(
x
@
rowpointers
[
length
(
x
@
rowpointers
)],
value
[
1
]
-
dimx
[
1
]))
## print("3")
x
<-
.newSpam
(
entries
=
x
@
entries
,
colindices
=
x
@
colindices
,
rowpointers
=
c
(
x
@
rowpointers
,
rep_len64
(
x
@
rowpointers
[
length
(
x
@
rowpointers
)],
value
[
1
]
-
dimx
[
1
])),
dimension
=
value
,
force64
=
force64
)
}
# special case: fewer rows and more columns, truncate
if
((
dimx
[
1
]
>
value
[
1
])
&
(
dimx
[
2
]
<
value
[
2
]))
{
lastelement
<-
(
x
@
rowpointers
[
last
]
-1
)
slot
(
x
,
"entries"
,
check
=
FALSE
)
<-
x
@
entries
[
1
:
lastelement
]
slot
(
x
,
"colindices"
,
check
=
FALSE
)
<-
x
@
colindices
[
1
:
lastelement
]
slot
(
x
,
"rowpointers"
,
check
=
FALSE
)
<-
x
@
rowpointers
[
1
:
last
]
# special case: fewer rows and more columns, truncate
if
((
dimx
[
1
]
>=
value
[
1
])
&
(
dimx
[
2
]
<=
value
[
2
]))
{
## added =, think about it again
## print("4")
lastelement
<-
(
x
@
rowpointers
[
last
]
-1
)
x
<-
.newSpam
(
entries
=
x
@
entries
[
1
:
lastelement
],
colindices
=
x
@
colindices
[
1
:
lastelement
],
rowpointers
=
x
@
rowpointers
[
1
:
last
],
dimension
=
value
,
force64
=
force64
)
}
slot
(
x
,
"dimension"
,
check
=
FALSE
)
<-
as.integer
(
value
)
#before dim x = value x was here with slot option
return
(
x
)
}
...
...
R/dist.R
View file @
cb5ae56f
# HEADER ####################################################
# This is file spam/R/dist.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
### in base:
# dist(x, method = "euclidean", diag = FALSE, upper = FALSE, p=2)
#
...
...
@@ -96,15 +116,18 @@ nearest.dist <- function( x, y=NULL, method = "euclidean",
# EXPLICIT-STORAGE-FORMAT
if
(
max
(
n1
,
n2
,
nnz
)
>
2147483647
-
1
|
getOption
(
"spam.force64"
))
SS
<-
.format64
SS
<-
.format64
()
else
SS
<-
.format32
if
(
2147483647
<
nnz
)
stop
(
"Distance matrix is too dense (1)"
)
repeat
{
d
<-
NULL
# Free the memory allocated by a previous attemp
d
<-
.C64
(
"closestdist"
,
## subroutine closestdist( ncol, x,nrowx, y, nrowy,
## & part, p, method,
## & eta, colindices, rowpointers, entries, nnz, iflag)
SIGNATURE
=
c
(
SS
$
signature
,
"double"
,
SS
$
signature
,
"double"
,
SS
$
signature
,
SS
$
signature
,
"double"
,
SS
$
signature
,
"double"
,
SS
$
signature
,
SS
$
signature
,
"double"
,
SS
$
signature
,
SS
$
signature
),
...
...
@@ -127,11 +150,10 @@ nearest.dist <- function( x, y=NULL, method = "euclidean",
nnz
=
nnz
,
iflag
=
0
,
#TODO: Check the intents!
INTENT
=
c
(
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
,
"rw"
),
INTENT
=
c
(
"r"
,
"r"
,
"r"
,
"r"
,
"r"
,
"r"
,
"rw"
,
"r"
,
"r"
,
"w"
,
"w"
,
"w"
,
"rw"
,
"w"
),
NAOK
=
getOption
(
"spam.NAOK"
),
PACKAGE
=
SS
$
package
)
...
...
@@ -140,7 +162,7 @@ nearest.dist <- function( x, y=NULL, method = "euclidean",
# EXPLICIT-STORAGE-FORMAT
if
(
max
(
n1
,
n2
,
nnz
)
>
2147483647
-
1
|
getOption
(
"spam.force64"
))
SS
<-
.format64
SS
<-
.format64
()
else
SS
<-
.format32
...
...
R/foreign.R
View file @
cb5ae56f
# This is file ../spam/R/foreign.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/foreign.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George [ctb] (Fortran Cholesky routines) #
# HEADER END ################################################
...
...
@@ -47,6 +60,9 @@ as.spam.matrix.csr <- function(x)
# 1b) spam <-> Matrix
as.dgRMatrix.spam
<-
function
(
x
)
{
if
(
.format.spam
(
x
)
$
package
!=
"spam"
){
stop
(
"dgRMatrix structure is not compatible with numeric/large integer type."
)
}
if
(
requireNamespace
(
"Matrix"
))
{
newx
<-
new
(
p
=
0
:
0
,
"dgRMatrix"
)
slot
(
newx
,
"x"
,
check
=
FALSE
)
<-
x
@
entries
...
...
@@ -58,6 +74,9 @@ as.dgRMatrix.spam <- function(x) {
}
as.dgCMatrix.spam
<-
function
(
x
)
{
if
(
.format.spam
(
x
)
$
package
!=
"spam"
){
stop
(
"dgCMatrix structure is not compatible with numeric/large integer type."
)
}
if
(
requireNamespace
(
"Matrix"
))
{
dimx
<-
x
@
dimension
nz
<-
x
@
rowpointers
[
dimx
[
1
]
+
1
]
-
1
...
...
@@ -67,6 +86,28 @@ as.dgCMatrix.spam <- function(x) {
rowpointers
=
vector
(
"integer"
,
dimx
[
2
]
+
1
),
NAOK
=
getOption
(
"spam.NAOK"
),
PACKAGE
=
"spam"
)
## SS <- .format.spam(x)
## z <- .C64("transpose",
## SIGNATURE = c( SS$signature, SS$signature,
## "double", SS$signature, SS$signature,
## "double", SS$signature, SS$signature),
## n = dimx[1],
## m = dimx[2],
## a = x@entries,
## ja = x@colindices,
## ia = x@rowpointers,
## entries = vector_dc("double",nz),
## colindices = vector_dc(SS$type, nz),
## rowpointers = vector_dc(SS$type, dimx[2] + 1),
## INTENT = c("r", "r",
## "r", "r", "r",
## "w", "w", "w"),
## NAOK = getOption("spam.NAOK"),
## PACKAGE = SS$package)
newx
<-
new
(
p
=
0
:
0
,
"dgCMatrix"
)
slot
(
newx
,
"x"
,
check
=
FALSE
)
<-
z
$
entries
slot
(
newx
,
"i"
,
check
=
FALSE
)
<-
z
$
colindices
-1L
...
...
R/helper.R
View file @
cb5ae56f
# This is file ../spam/R/helper.R
# This file is part of the spam package,
# http://www.math.uzh.ch/furrer/software/spam/
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
# HEADER ####################################################
# This is file spam/R/helper.R. #
# It is part of the R package spam, #
# --> https://CRAN.R-project.org/package=spam #
# --> https://CRAN.R-project.org/package=spam64 #
# --> https://git.math.uzh.ch/reinhard.furrer/spam #
# by Reinhard Furrer [aut, cre], Florian Gerber [ctb], #
# Daniel Gerber [ctb], Kaspar Moesinger [ctb], #
# Youcef Saad [ctb] (SPARSEKIT), #
# Esmond G. Ng [ctb] (Fortran Cholesky routines), #
# Barry W. Peyton [ctb] (Fortran Cholesky routines), #
# Joseph W.H. Liu [ctb] (Fortran Cholesky routines), #
# Alan D. George