Skip to content

Commit

Permalink
Small improvements in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomessilva committed Sep 11, 2023
1 parent 6d7f304 commit e0ef323
Show file tree
Hide file tree
Showing 32 changed files with 4,250 additions and 4,236 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: fort
Type: Package
Title: Fast Orthogonal Random Transforms in R
Title: Fast Orthogonal Random Transforms
Version: 0.0.1
Authors@R:
person("Tom\u00e9", "Silva", email = "tome@tomesilva.com",
role = c("cre", "aut"), comment = c(ORCID = "0000-0002-9434-8686"))
Description: Provides convenient access to fast structured random linear
Description: Provides convenient access to fast, structured, random linear
transforms implemented in C++ (via 'Rcpp') that are (at least
approximately) orthogonal or semi-orthogonal, and often much faster
approximately) orthogonal or semi-orthogonal, and are often much faster
than matrix multiplication. Useful for algorithms that require or
benefit from uncorrelated random projections, such as fast dimensionality
reduction (e.g., Johnson-Lindenstrauss transform) or kernel approximation
Expand Down
13 changes: 7 additions & 6 deletions R/ft_helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#' \eqn{\mathbb{R}^{dim\_in} \to \mathbb{R}^{dim\_out}} linear transform. This transform will be
#' orthonormal when \eqn{dim\_in = dim\_out} \emph{and} they are a power of 2, and approximately
#' orthogonal or semi-orthogonal (in the sense that either \eqn{W^T W \approx I_{dim\_in}} or
#' \eqn{W W^T \approx I_{dim\_out}}, if \eqn{W} represents the transform) otherwise.
#' \eqn{W W^T \approx I_{dim\_out}}, if \eqn{W} represents the transform and \eqn{I_n} represents an
#' N-dimensional identity matrix) otherwise.
#'
#' The goal of `fort()` is to provide an easy and efficient way of calculating fast orthogonal random
#' transforms (when `dim_in` is the same as `dim_out`) or semi-orthogonal transforms (when `dim_in` is
Expand All @@ -20,7 +21,7 @@
#' Internally, all `fort` transforms assume a blocksize which \emph{must} be a power of 2 and no smaller
#' than `max(dim_in, dim_out)`. The resulting transform will be practically orthonormal when
#' \eqn{dim\_in = dim\_out} and they match the blocksize of the transform, and practically semi-orthogonal
#' when \eqn{dim\_in != dim\_out} and `max(dim_in, dim_out)` matches the blocksize. Otherwise, these
#' when \eqn{dim\_in \neq dim\_out} and `max(dim_in, dim_out)` matches the blocksize. Otherwise, these
#' properties will \emph{only approximately} hold, since the output will result from a decimated
#' transform (i.e., the rows and columns of the transform should be decorrelated, but not necessarily
#' orthogonal).
Expand All @@ -37,10 +38,10 @@
#' Currently, the available options for the `type` parameter are:
#' * `default`: this is the default option, if no `type` is specified; currently, it assumes the `fft2`
#' type, but this is subject to change (so avoid this option in non-interactive usage);
#' * `fft1`: this type of `fort` transform uses the Fast Fourier Transform as base transform; for more
#' technical details, see [FastTransformFFT1].
#' * `fft2`: this type of `fort` transform uses the Fast Fourier Transform as base transform; for more
#' technical details, see [FastTransformFFT2].
#' * `fft1`: this type of `fort` transform uses the Fast Fourier Transform as base transform (which is
#' used once); for more technical details, see [FastTransformFFT1].
#' * `fft2`: this type of `fort` transform uses the Fast Fourier Transform as base transform (which is
#' used twice); for more technical details, see [FastTransformFFT2].
#'
#' @section Using `fort` transforms:
#' In practice, to apply the fast transform to the columns of a matrix, you should use the `%*%` operator
Expand Down
6 changes: 5 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ knitr::opts_chunk$set(

<!-- badges: end -->

The `fort` package provides convenient access to fast structured random linear transforms implemented in C++ (via 'Rcpp') that are (at least approximately) orthogonal or semi-orthogonal, and often much faster than matrix multiplication, in the same spirit as the [Fastfood](#ref4), [ACDC](#ref3), [HD](#ref2) and [SD](#ref1) families of random structured transforms.
The `fort` package provides convenient access to fast, structured, random linear transforms implemented in C++ (via 'Rcpp') that are (at least approximately) orthogonal or semi-orthogonal, and are often much faster than matrix multiplication, in the same spirit as the [Fastfood](#ref4), [ACDC](#ref3), [HD](#ref2) and [SD](#ref1) families of random structured transforms.

Useful for algorithms that require or benefit from uncorrelated random projections, such as fast dimensionality reduction (e.g., [Johnson-Lindenstrauss transform](#links)) or kernel approximation (e.g., [random kitchen sinks](#ref5)) methods.

For more technical details, see the reference page for [`fort()`](https://tomessilva.github.io/fort/reference/fort.html).

## Installation

You can install the development version of `fort` from [GitHub](https://github.com/) with:
Expand Down Expand Up @@ -81,6 +83,8 @@ system.time(for (i in 1:100) test <- slow_transform %*% matrix_to_transform, gcF
Note: in this case, using a `fort` fast transform leads to a speed-up of
about 10x compared to the use of matrix multiplication.

For more information on how to use `fort` in practice, check out the [package's vignette](https://tomessilva.github.io/fort/articles/fort-basic.html).

## License

MIT
Expand Down
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@

<!-- badges: end -->

The `fort` package provides convenient access to fast structured random
linear transforms implemented in C++ (via ‘Rcpp’) that are (at least
approximately) orthogonal or semi-orthogonal, and often much faster than
matrix multiplication, in the same spirit as the [Fastfood](#ref4),
[ACDC](#ref3), [HD](#ref2) and [SD](#ref1) families of random structured
transforms.
The `fort` package provides convenient access to fast, structured,
random linear transforms implemented in C++ (via ‘Rcpp’) that are (at
least approximately) orthogonal or semi-orthogonal, and are often much
faster than matrix multiplication, in the same spirit as the
[Fastfood](#ref4), [ACDC](#ref3), [HD](#ref2) and [SD](#ref1) families
of random structured transforms.

Useful for algorithms that require or benefit from uncorrelated random
projections, such as fast dimensionality reduction (e.g.,
[Johnson-Lindenstrauss transform](#links)) or kernel approximation
(e.g., [random kitchen sinks](#ref5)) methods.

For more technical details, see the reference page for
[`fort()`](https://tomessilva.github.io/fort/reference/fort.html).

## Installation

You can install the development version of `fort` from
Expand Down Expand Up @@ -48,11 +51,11 @@ library(fort)

matrix_to_transform <- diag(4) # 4 x 4 identity matrix
(new_matrix <- fast_transform %*% matrix_to_transform) # transformed matrix
#> [,1] [,2] [,3] [,4]
#> [1,] 0.01658196 -0.85400548 -0.14042079 -0.50068122
#> [2,] 0.14042079 -0.50068122 0.01658196 0.85400548
#> [3,] -0.29097292 0.08269119 -0.94622503 0.11469580
#> [4,] 0.94622503 0.11469580 -0.29097292 -0.08269119
#> [,1] [,2] [,3] [,4]
#> [1,] -0.08507199 0.04448012 0.19822740 0.97544358
#> [2,] 0.95848508 -0.26849697 0.03818877 0.08807578
#> [3,] -0.26849697 -0.95848508 -0.08807578 0.03818877
#> [4,] 0.04448012 0.08507199 -0.97544358 0.19822740

(inverse_transform <- solve(fast_transform)) # get inverse transform
#> fort linear operation (inverted): R^4 <- [fft2] <- R^4
Expand Down Expand Up @@ -90,6 +93,10 @@ system.time(for (i in 1:100) test <- slow_transform %*% matrix_to_transform, gcF
Note: in this case, using a `fort` fast transform leads to a speed-up of
about 10x compared to the use of matrix multiplication.

For more information on how to use `fort` in practice, check out the
[package’s
vignette](https://tomessilva.github.io/fort/articles/fort-basic.html).

## License

MIT
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e0ef323

Please sign in to comment.