Skip to content

Commit

Permalink
Add R binding for LinearRegression
Browse files Browse the repository at this point in the history
  • Loading branch information
hpwxf committed Oct 16, 2023
1 parent cf621af commit afa8965
Show file tree
Hide file tree
Showing 15 changed files with 1,367 additions and 31 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Description: New package structure to refactor libkriging packages <https://gith
especially for concurrent programming.
License: Apache License (>= 2)
Encoding: UTF-8
Suggests: testthat, utils, foreach
SystemRequirements: Cargo (Rust's package manager), rustc
URL: https://github.com/libKriging
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
Config/rextendr/version: 0.3.1.9000
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Generated by roxygen2: do not edit by hand

S3method("$",LinearRegression)
S3method("[[",LinearRegression)
export(LinearRegression)
export(full_version)
useDynLib(libkrigingtemplate, .registration = TRUE)
35 changes: 33 additions & 2 deletions R/extendr-wrappers.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
# Generated by extendr: Do not edit by hand

# nolint start

#
# This file was created with the following call:
# .Call("wrap__make_libkrigingtemplate_wrappers", use_symbols = TRUE, package_name = "libkrigingtemplate")

#' @docType package
#' @usage NULL
#' @useDynLib libkrigingtemplate, .registration = TRUE
NULL

#' Return string `"Hello world!"` to R.
#' Return version string
#' @export
full_version <- function() .Call(wrap__full_version)

linear_regression_fit1 <- function(y, x) invisible(.Call(wrap__linear_regression_fit1, y, x))

linear_regression_fit2 <- function(y, x) invisible(.Call(wrap__linear_regression_fit2, y, x))

#' First linear regression implementation test
#' @export
LinearRegression <- new.env(parent = emptyenv())

LinearRegression$fit <- function(y, x) .Call(wrap__LinearRegression__fit, y, x)

LinearRegression$predict <- function(x) .Call(wrap__LinearRegression__predict, self, x)

#' @rdname LinearRegression
#' @usage NULL
#' @export
`$.LinearRegression` <- function (self, name) { func <- LinearRegression[[name]]; environment(func) <- environment(); func }

#' @export
hello_world <- function() .Call(wrap__hello_world)
`[[.LinearRegression` <- `$.LinearRegression`


# nolint end
Loading

0 comments on commit afa8965

Please sign in to comment.