Skip to content
Back to skills

Irlba

ASecurity

R irlba package for fast SVD/PCA. Use for truncated SVD and PCA on large matrices.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 4, 2026
datago

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill irlba --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Irlba?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Irlba
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-irlba/badge)](https://www.skillsdirectory.com/skills/leolin990405-irlba)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: irlba
description: R irlba package for fast SVD/PCA. Use for truncated SVD and PCA on large matrices.
---

# irlba

Fast truncated SVD and PCA.

## Truncated SVD

```r
library(irlba)

# Compute top 5 singular vectors
svd_result <- irlba(A, nv = 5)

# Results
svd_result$u  # Left singular vectors
svd_result$v  # Right singular vectors
svd_result$d  # Singular values
```

## Fast PCA

```r
# PCA via SVD
pca <- prcomp_irlba(data, n = 5)

# Results
pca$x         # Scores (rotated data)
pca$rotation  # Loadings
pca$sdev      # Standard deviations
pca$center    # Means
pca$scale     # Scales

# Predict
predict(pca, newdata = new_data)
```

## Options

```r
# With centering and scaling
pca <- prcomp_irlba(data, n = 5,
  center = TRUE,
  scale. = TRUE)

# More iterations for accuracy
svd_result <- irlba(A, nv = 5, maxit = 1000)
```

## Sparse Matrices

```r
library(Matrix)

# Create sparse matrix
sparse_A <- Matrix(A, sparse = TRUE)

# SVD on sparse matrix
svd_result <- irlba(sparse_A, nv = 5)
```

## Partial SVD

```r
# Only left vectors
svd_result <- irlba(A, nv = 5, nu = 0)

# Only right vectors
svd_result <- irlba(A, nv = 5, nv = 0)
```

## Augmented Implicitly Restarted

```r
# For better convergence
svd_result <- irlba(A, nv = 5,
  work = 20,      # Working subspace size
  reorth = TRUE)  # Reorthogonalization
```

## Comparison with Base R

```r
# Base R (computes all)
svd_full <- svd(A)

# irlba (computes only top k)
svd_partial <- irlba(A, nv = 5)

# Much faster for large matrices
```

## Low-Rank Approximation

```r
# Reconstruct matrix
svd_result <- irlba(A, nv = 5)
A_approx <- svd_result$u %*% diag(svd_result$d) %*% t(svd_result$v)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.