Skip to content

Commit 3c28c6b

Browse files
authored
Merge pull request #2 from wrathematics/master
get updates
2 parents c1b490d + 5222a71 commit 3c28c6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1072
-391
lines changed

Diff for: .Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
^\.travis\.yml$
2+
^appveyor.yml$
3+
24
.vscode
35

46
LICENSE.md

Diff for: .gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
*~
22
*.swp
3+
*.status
34

45
src/*.o
56
src/*.so
7+
src/*.a
8+
9+
src/utils/*.o
10+
src/utils/*.so
11+
src/utils/*.a
12+
613
src/Makevars
714
src/endianness.h
815

916
inst/doc
17+
inst/lib
18+
19+
config.log
1020

1121
TODO
22+
.Rproj.user

Diff for: ChangeLog

+42-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
1+
Release 0.1-2:
2+
* Fixed protect stack imbalance in R_init_NA().
3+
* Hid 'restrict' keyword from C++ in inst/include headers.
4+
* Fixed control logic in various [ calls.
5+
* Created float:::ldflags() for dynamic linking.
6+
* Added some skeleton support for names+row/col-names.
7+
* Fixed performance bug with [.
8+
* Fixed NA overflow bug with length() for large matrices.
9+
* Fixed str() printing bug for matrices.
10+
11+
Release 0.1-1:
12+
* Added str() method.
13+
* Added replacer [ method.
14+
* Remove \dontrun{} blocks from manual.
15+
116
Release 0.1-0:
2-
*
17+
* Added fl() and dbl() casters.
18+
* Added random constructors flrunif(), flrnorm(), and flrand().
19+
* Added backsolve() and forwardsolve() methods.
20+
* Added binary arithmetic methods.
21+
* Added rbind() and cbind() methods.
22+
* Added [ method.
23+
* Added c() method.
24+
* Added chol() and chol2inv() methods.
25+
* Added colSums(), rowSums(), colMeans(), and rowMeans() methods.
26+
* Added rcond() method.
27+
* Added crossprod() and tcrossprod() methods.
28+
* Added diag() method.
29+
* Added eigen() method (symmetric case only).
30+
* Added min(), max(), which.min(), and which.max() methods.
31+
* Added isSymmetric() method.
32+
* Added math methods.
33+
* Added %*% method.
34+
* Added is.na() and na.omit() methods.
35+
* Added norm() method.
36+
* Added qr(), qr.Q(), qr.R(), qr.qy(), and qr.qty() methods.
37+
* Added scale() method.
38+
* Added solve() method.
39+
* Added sum() method.
40+
* Added svd() and La.svd() methods.
41+
* Added sweep() method (+, -, *, and / only).
42+
* Added t() method.
43+
* Added float32() constructor for developers.

Diff for: DESCRIPTION

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
Package: float
22
Type: Package
3-
Title: Single Precision Floats
4-
Version: 0.1-0
3+
Title: 32-Bit Floats
4+
Version: 0.1-2
55
Description: R comes with a suite of utilities for linear algebra with "numeric"
6-
(integer/double precision) vectors/matrices. However, sometimes single
7-
precision (or less!) is more than enough for a particular task. This
8-
package extends R's linear algebra facilities to include single precision
9-
(float) data. Float vectors/matrices have half the precision of their
10-
"numeric"-type counterparts, for a performance vs accuracy trade-off. The
11-
internal representation is an S4 class, which allows us to keep the syntax
12-
identical to that of base R's. Interaction between floats and base types
13-
for binary operators is generally possible; in these cases, type promotion
14-
always defaults to the higher precision. The package ships with copies of
15-
the single precision 'BLAS' and 'LAPACK', which are automatically built in
16-
the event they are not available on the system.
6+
(double precision) vectors/matrices. However, sometimes single precision (or
7+
less!) is more than enough for a particular task. This package extends R's
8+
linear algebra facilities to include 32-bit float (single precision) data.
9+
Float vectors/matrices have half the precision of their "numeric"-type
10+
counterparts but are generally faster to numerically operate on, for a
11+
performance vs accuracy trade-off. The internal representation is an S4
12+
class, which allows us to keep the syntax identical to that of base R's.
13+
Interaction between floats and base types for binary operators is generally
14+
possible; in these cases, type promotion always defaults to the higher
15+
precision. The package ships with copies of the single precision 'BLAS' and
16+
'LAPACK', which are automatically built in the event they are not available
17+
on the system.
1718
License: BSD 2-clause License + file LICENSE
1819
Copyright: The copyright for the single precision BLAS/LAPACK distribution
1920
located in src/lapack is given in the file src/lapack/LICENSE.
2021
Depends:
21-
R (>= 3.1.0), methods
22+
R (>= 3.1.0),
23+
methods
2224
Imports:
2325
utils
2426
ByteCompile: yes
2527
URL: https://github.com/wrathematics/float
2628
BugReports: https://github.com/wrathematics/float/issues
2729
Authors@R: c(
2830
person("Drew", "Schmidt", role=c("aut", "cre", "cph"), email="[email protected]"),
31+
person("Wei-Chen", "Chen", role="ctb", comment="win32 fixes"),
2932
person("ORNL", role="cph")
3033
)
3134
Maintainer: Drew Schmidt <[email protected]>

Diff for: LICENSE

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
YEAR: 2015-2017
2-
COPYRIGHT HOLDER: Drew Schmidt, ORNL
1+
YEAR: 2017
2+
COPYRIGHT HOLDER: Oak Ridge National Laboratory
3+
4+
YEAR: 2014-2017
5+
COPYRIGHT HOLDER: Drew Schmidt

Diff for: LICENSE.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright 2014-2017 Drew Schmidt, ORNL
1+
Copyright 2017 ORNL
2+
Copyright 2014-2017 Drew Schmidt
23

34
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
45

Diff for: NAMESPACE

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ S3method(as.matrix,float32)
44
S3method(as.vector,float32)
55
S3method(cbind,float32)
66
S3method(rbind,float32)
7+
S3method(str,float32)
78
export(.Machine_float)
89
export(dbl)
910
export(fl)
@@ -25,8 +26,13 @@ exportMethods("==")
2526
exportMethods(">")
2627
exportMethods(">=")
2728
exportMethods("[")
29+
exportMethods("[<-")
2830
exportMethods("^")
31+
exportMethods("colnames<-")
2932
exportMethods("dim<-")
33+
exportMethods("dimnames<-")
34+
exportMethods("names<-")
35+
exportMethods("rownames<-")
3036
exportMethods(La.svd)
3137
exportMethods(NCOL)
3238
exportMethods(NROW)
@@ -44,11 +50,13 @@ exportMethods(chol)
4450
exportMethods(chol2inv)
4551
exportMethods(colMeans)
4652
exportMethods(colSums)
53+
exportMethods(colnames)
4754
exportMethods(cos)
4855
exportMethods(cosh)
4956
exportMethods(crossprod)
5057
exportMethods(diag)
5158
exportMethods(dim)
59+
exportMethods(dimnames)
5260
exportMethods(eigen)
5361
exportMethods(exp)
5462
exportMethods(expm1)
@@ -69,6 +77,7 @@ exportMethods(max)
6977
exportMethods(min)
7078
exportMethods(na.exclude)
7179
exportMethods(na.omit)
80+
exportMethods(names)
7281
exportMethods(ncol)
7382
exportMethods(norm)
7483
exportMethods(nrow)
@@ -82,6 +91,7 @@ exportMethods(rcond)
8291
exportMethods(round)
8392
exportMethods(rowMeans)
8493
exportMethods(rowSums)
94+
exportMethods(rownames)
8595
exportMethods(scale)
8696
exportMethods(show)
8797
exportMethods(sin)
@@ -102,6 +112,7 @@ exportMethods(which.max)
102112
exportMethods(which.min)
103113
import(methods)
104114
importFrom(utils,capture.output)
115+
importFrom(utils,str)
105116
useDynLib(float,R_abs_spm)
106117
useDynLib(float,R_acos_spm)
107118
useDynLib(float,R_acosh_spm)
@@ -132,7 +143,8 @@ useDynLib(float,R_flrunif_spm)
132143
useDynLib(float,R_gamma_spm)
133144
useDynLib(float,R_ge_spm)
134145
useDynLib(float,R_gt_spm)
135-
useDynLib(float,R_init_NA)
146+
useDynLib(float,R_init_NAf)
147+
useDynLib(float,R_init_NaNf)
136148
useDynLib(float,R_isSymmetric_spm)
137149
useDynLib(float,R_isfinite_spm)
138150
useDynLib(float,R_isinfinite_spm)

Diff for: R/00-classes.r

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ setClassUnion("Int", c("integer", "matrix"))
22

33
#' Class float32
44
#'
5-
#' An S4 container for single precision (float) vector/matrix objects.
5+
#' An S4 container for 32-bit float vector/matrix objects.
66
#'
77
#' @slot Data
88
#' A vector or matrix of integers.
@@ -19,4 +19,3 @@ setClass("float32",
1919

2020
setClassUnion("Mat", c("matrix", "float32"))
2121
setClassUnion("BaseLinAlg", c("matrix", "vector"))
22-

Diff for: R/02-flags.r

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ldflags = function()
2+
{
3+
if (.Platform$OS.type != "windows")
4+
{
5+
flags = tools::file_path_as_absolute(system.file("libs", package = "float"))
6+
}
7+
else
8+
{
9+
path = file.path("libs", .Platform$r_arch)
10+
flags = tools::file_path_as_absolute(system.file(path, package = "float"))
11+
}
12+
13+
cat(paste0("-L", flags, " -lfoat"))
14+
}

Diff for: R/backsolve.r

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
#' Should the transposed coefficients matrix be used? More efficient than
1515
#' manually transposing with \code{t()}.
1616
#'
17+
#' @examples
18+
#' library(float)
19+
#'
20+
#' s = flrunif(10, 3)
21+
#' cp = crossprod(s)
22+
#' y = fl(1:3)
23+
#' backsolve(cp, y)
24+
#'
1725
#' @name backsolve
1826
#' @rdname backsolve
1927
NULL

Diff for: R/binary.r

+2-4
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,19 @@ binop = function(e1, e2, fun, floatfun)
4747
#' A matrix of the same type as the highest precision input.
4848
#'
4949
#' @examples
50-
#' \dontrun{
5150
#' library(float)
5251
#'
5352
#' s1 = flrunif(5, 5)
54-
#' s2 = flrunif(5, 2)
53+
#' s2 = flrunif(5, 5)
5554
#' x = matrix(1:25, 5)
5655
#'
5756
#' s1 + s2 # float
5857
#'
59-
#' storage.mode(x) # integer
58+
#' typeof(x) # integer
6059
#' x + s2 # float
6160
#'
6261
#' storage.mode(x) = "double"
6362
#' x + s2 # double
64-
#' }
6563
#'
6664
#' @name arithmetic
6765
#' @rdname arithmetic

Diff for: R/bind.r

-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
#' A matrix of the same type as the highest precision input.
1212
#'
1313
#' @examples
14-
#' \dontrun{
1514
#' library(float)
1615
#' x = fl(matrix(1:10, 5))
1716
#'
1817
#' rbind(x, x)
1918
#' cbind(x, x)
20-
#' }
2119
#'
2220
#' @name bind
2321
#' @rdname bind

0 commit comments

Comments
 (0)