Skip to content

Wasserstein Index Generation (WIG) Model

0packages depend
2.4Kdownloads / year
91.6%test coverage
13/13flavors OK

Overview

About

Efficient implementation of several Optimal Transport algorithms in Fangzhou Xie (2025) doi:10.48550/arXiv.2504.08722 and the Wasserstein Index Generation (WIG) model in Fangzhou Xie (2020) doi:10.1016/j.econlet.2019.108874.

Changes in 0.3.0

Performance work driven by perf profiles; all solver outputs are checked

against frozen outputs of version 0.2.0 (relative differences below 1e-11)

and the Julia-derived reference solutions in the tests.

  • wdl()/wig() on the CPU now predict the document barycenters with the same batched Gibbs-kernel iteration the training uses, on a whole batch of documents at once. Before, inference solved one barycenter per document and, with the default method = "auto", did so in the log domain, which cost about 20 times the whole training (2000 NYT headlines, 1 epoch: 33 minutes, now 33 seconds). method, threshold and n_threads of the barycenter control are documented as unused by WDL.
  • The log-stabilized sinkhorn() and barycenter() exponentiate with a vectorised rational approximation (1-2 ulp of exp()) instead of one libm call per matrix entry, and log sinkhorn() no longer computes a column soft-min per iteration whose only use, the column term of the error, is identically zero. 1000 x 1000 log Sinkhorn, 1000 iterations: 19 s to 8 s on one thread.
Show all changes in 0.3.0Hide the rest of the changes in 0.3.0
  • Worker threads (n_threads) spin briefly between the short parallel sections of an iteration instead of sleeping; 12 threads now give about 5x on the forward passes where they gave 3x.
  • The backward passes of the log-stabilized sinkhorn() and barycenter() (with_grad = TRUE) no longer materialize the M x N softmax matrices: the forward pass keeps its row and column soft-mins (M + N numbers per iteration), from which each adjoint product is one fused sweep over the cost matrix, split over the threads by column blocks. 1000 x 1000 log Sinkhorn with gradient, 1000 iterations: 15.6 s to 13.2 s on one thread, 3.8 s to 2.1 s on 12; 800 x 800 log barycenter with gradients: 37.9 s to 33.9 s and 10.9 s to 5.2 s.
  • Kernel products with up to 4 right-hand columns (the "parallel" barycenter()) use one dsymv/dgemv per column rather than a level-3 call that repacks the N x N kernel every time: 800 x 800 barycenter with 4 sources, 0.79 s to 0.34 s.
  • CUDA wdl(): the per-document cublasDgemv launches of the weight adjoint are one strided-batched GEMM (2000 headlines: 5.6 s to 4.5 s).

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.7 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-05-02
  • NOTE10 OK, 1 NOTE2026-04-25
  • ERROR6 OK, 1 NOTE, 1 ERROR2026-04-22
Advisories

none known

Documentation

In release 0.3.0
READMEYes · 339 wordsVignettesYes · 9 · dynamicNEWSYes · 100% structured · mentions 0.3.0Citation fileNoWebsiteYes · pkgdown
Help pages
9 (1 internal)includes a package overview page
Examples that run
100%6 run in a plain check
Exported functions with examples
86%
Documented parameters
59%
Return-value docs
100%
Help pages citing references
78%

Downloads

2.4K
CRAN downloads in the past year
Rank #9,178 · ~6/day · ~197/mo
Daily download trend is not available in this view yet.
45730 days
1K90 days
2.4K1 year
Compare downloads with other packages →
Also on151 r2u2 autocran

Repository

1Stars
0Forks
0Open issues
0Open PRs
0Releases
58Commits
2Commit identities
58 commits · Last activity 2026-10-07
Responsiveness
not measured

Stars over time

2025-06-11 · 12026-07-07 · 1
PracticesBeta

11 development-tooling and community-health practices detected across 6 families in the upstream repository

Checks run against github.com/fangzhou-xie/rwig on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-07 · The repository has a site deploy workflow

pkgdown site last built 2026-10-07

Reproducibility and dev environment (1)
data-raw/
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Show all practicesHide 2 practices
Lint, format, editor (1)
RStudio project
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-03-06
    Named in .Rbuildignore: .claude
    Named in .gitignore: .claude
    Commits: at least 25 crediting it in the message
Models named in its commits
  • Claude Fable 5.125 commits · Sep to Oct 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
9 external dependencies (excludes base and recommended)

Installing rwig adds 10 packages (7 with compiled code, 16 MB of source tarballs). Heaviest: stringi 11 MB, Rcpp 1.8 MB, rlang 766 KB.

Depends (1)
R >= 4.2
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (1)
Author, Maintainer since 0.1.0 (2026), Copyright holder
Releases (3)

Pick two releases to compare their code metrics.

  • 0.3.0Latest
    record
    2026-10-07 · current release · diff ↗
  • 0.2.0
    record
    2026-09-20 · diff ↗
  • R
    R 4.6.0 released · 2026-04-24
  • 0.1.0
    record
    2026-04-21
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2026-04-21
Total releases
3 / 1 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.2
Bundled data
343 KB / 1 file
Download size
478 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("rwig")
Xie, F. (2026). rwig: Wasserstein Index Generation (WIG) Model (Version 0.3.0) [Computer software]. https://doi.org/10.32614/CRAN.package.rwig

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for rwig version 0.3.0 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy