RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • bayesopt
    • classify
    • confusionmat
    • crossvalind
    • cvpartition
    • fitclinear
    • fitctree
    • fitlm
    • kmeans
    • knnsearch
    • lasso
    • lassoglm
    • linkage
    • lscov
    • mnrfit
    • optimizableVariable
    • pdist
    • pdist2
    • perfcurve
    • predict
    • regress
    • ridge
    • squareform
    • test
    • training
    • tsne

lscov — Solve linear least-squares systems with observation covariance weighting.

lscov(A,B) solves the linear least-squares system A*x = B. lscov(A,B,V) treats V as an observation covariance matrix, or as a vector of observation weights. lscov(A,B,V,alg) accepts "chol" and "orth" algorithm selectors.

Syntax

lscov(A,B)

How lscov works

  • A must be a nonempty 2-D numeric design matrix. B must be a vector with one value per row of A, or a matrix with the same number of rows as A.
  • The primary output has shape size(A,2) x size(B,2) for matrix right-hand sides, and size(A,2) x 1 for vector right-hand sides.
  • V may be omitted, empty, a scalar weight, a weight vector with one value per observation, or a dense square covariance matrix matching the observation count. Weights must be finite and nonnegative with at least one positive value.
  • The default "chol" algorithm uses Cholesky transformation for positive-definite covariance matrices when possible. Singular positive semidefinite covariance matrices fall back to the SVD-backed "orth" transformation.
  • Requested outputs follow MATLAB's [x,stdx,mse,S] form. stdx matches the coefficient shape, mse is a 1 x size(B,2) row, and S is available only when B is a vector.
  • Real and complex dense A/B are supported. Sparse inputs and provider-native GPU solves are not implemented in this slice.

Examples

Fit an unweighted line

A = [ones(3,1) (0:2)']; B = [1;3;5]; [x,stdx,mse,S] = lscov(A,B)

Expected output:

x is approximately [1; 2] and mse is 0.

Use observation weights

A = [ones(3,1) (0:2)']; B = [1;2;10]; w = [1;1;100]; x = lscov(A,B,w)

Expected output:

The high-weight third observation has more influence on x.

Using lscov with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how lscov changes the result.

Run a small lscov example, explain the result, then change one input and compare the output.

FAQ

Does lscov add an intercept automatically?⌄

No. Include a column of ones in A when the model should include an intercept.

Does lscov run on the GPU?⌄

No. The current implementation gathers GPU inputs and runs the dense weighted least-squares solve on the host.

Related Stats functions

Ml

bayesopt · classify · confusionmat · crossvalind · cvpartition · fitclinear · fitctree · fitlm · kmeans · knnsearch · lasso · lassoglm · linkage · mnrfit · optimizableVariable · pdist · pdist2 · perfcurve · predict · regress · ridge · squareform · test · training · tsne

Summary

binocdf · boxplot · cdf · cdfplot · chi2cdf · corr · corrcoef · corrcov · cov · cov2corr · dummyvar · ecdf · filloutliers · fitdist · geomean · grpstats · harmmean · icdf · isoutlier · kstest · kurtosis · lsline · mad · mode · nanmax · normalize · normcdf · norminv · normpdf · onehotdecode · onehotencode · pdf · prctile · quantile · refline · rmse · skewness · tabulate · tcdf · tiedrank · tinv · tpdf · ttest2 · wblinv

Random

binornd · bootstrp · datasample · dividerand · exprnd · gamrnd · lhsdesign · mvnrnd · normrnd · random · randsample · rng · trnd · unidrnd · unifrnd · wblrnd

Hist

histc · histcounts · histcounts2

Options

statget · statset

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how lscov is executed, line by line, in Rust.

  • View the source for lscov in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • How lscov works
  • Examples
  • Fit an unweighted line
  • Use observation weights
  • Using lscov with coding agents
  • FAQ
  • Related Stats functions
  • Ml
  • Summary
  • Random
  • Hist
  • Options
  • Open-source implementation
  • About RunMat