Skip to content

Commit

Permalink
MAINT: Appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Aug 30, 2023
1 parent d4bb355 commit 06eb6d6
Show file tree
Hide file tree
Showing 8 changed files with 411 additions and 401 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/pkg-check.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/pkgcheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: pkgcheck

# This will cancel running jobs once a new run is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

on:
# Manually trigger the Action under Actions/pkgcheck
workflow_dispatch:
# Run on every push to main
push:
branches:
- main

jobs:
pkgcheck:
runs-on: ubuntu-latest
steps:
- uses: ropensci-review-tools/pkgcheck-action@main
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: pre-commit

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

on:
pull_request:
push:
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ repos:
- id: trailing-whitespace
exclude: ^(.lintr)
- id: end-of-file-fixer
exclude: ^(inst)
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
exclude: ^(include)
exclude: ^(inst)
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.2.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
LinkingTo:
cpp11
Imports:
Imports:
cpp11
Suggests:
Suggests:
Matrix
40 changes: 23 additions & 17 deletions R/fastMatMR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,46 @@ NULL

#' Convert Various Numeric Types to Matrix Market Format
#'
#' This function takes different types of numeric inputs—vectors, matrices, and sparse matrices—
#' and converts them into Matrix Market files. The output file is written to disk.
#' This function takes different types of numeric inputs—vectors, matrices, and
#' sparse matrices— and converts them into Matrix Market files. The output file
#' is written to disk.
#'
#' @param input A numeric object to be converted. This can be a numeric vector, a matrix, or a sparse matrix.
#' @param fname The name of the output file where the Matrix Market formatted data will be saved.
#' It is recommended to use a filename ending with ".mtx" for clarity.
#' @param input A numeric object to be converted. This can be a numeric vector,
#' a matrix, or a sparse matrix. @param fname The name of the output file
#' where the Matrix Market formatted data will be saved. It is recommended to
#' use a filename ending with ".mtx" for clarity.
#'
#' @return This function has no return value. It writes a Matrix Market formatted file to disk.
#' @return This function has no return value. It writes a Matrix Market
#' formatted file to disk.
#'
#' @examples
#' \dontrun{
#' vec <- c(1, 2, 3)
#' mat <- matrix(c(1, 2, 3, 4), nrow = 2)
#' sparse_mat <- Matrix::Matrix(c(1, 0, 0, 2), nrow = 2, sparse = TRUE)
#' Diagonal ^-
#' ## Diagonal ^-
#' sparse_mat <- Matrix::Matrix(c(1, 1, 0, 2), nrow = 2, sparse = TRUE)
#' And not diagonal -^
#' ## And not diagonal -^
#'
#' writeFMM(vec, "vector.mtx")
#' writeFMM(mat, "matrix.mtx")
#' writeFMM(sparse_mat, "sparse_matrix.mtx")
#' write_fmm(vec, "vector.mtx")
#' write_fmm(mat, "matrix.mtx")
#' write_fmm(sparse_mat, "sparse_matrix.mtx")
#' }
#'
#' @export
writeFMM <- function(input, fname = "out.mtx") {
write_fmm <- function(input, fname = "out.mtx") {
if (is.vector(input)) {
return(vec_to_fmm(input, fname))

Check warning on line 40 in R/fastMatMR-package.R

View workflow job for this annotation

GitHub Actions / pre-commit

file=/home/runner/work/fastMatMR/fastMatMR/R/fastMatMR-package.R,line=40,col=12,no visible global function definition for ‘vec_to_fmm’
} else if (is.matrix(input)) {
return(mat_to_fmm(input, fname))

Check warning on line 42 in R/fastMatMR-package.R

View workflow job for this annotation

GitHub Actions / pre-commit

file=/home/runner/work/fastMatMR/fastMatMR/R/fastMatMR-package.R,line=42,col=12,no visible global function definition for ‘mat_to_fmm’
}
else if (inherits(input, "sparseMatrix")) {
} else if (inherits(input, "sparseMatrix")) {
return(sparse_to_fmm(input, fname))

Check warning on line 44 in R/fastMatMR-package.R

View workflow job for this annotation

GitHub Actions / pre-commit

file=/home/runner/work/fastMatMR/fastMatMR/R/fastMatMR-package.R,line=44,col=12,no visible global function definition for ‘sparse_to_fmm’
}
else {
stop("Unsupported input type. Accepted types are numeric vector, matrix, and sparseMatrix.")
} else {
stop(
paste(
"Unsupported input type.",
"Accepted types are numeric vector, matrix, and sparseMatrix."
)
)
}
}
Loading

0 comments on commit 06eb6d6

Please sign in to comment.