RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

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.

/
See all docs
Builtin Reference
    • blsimpv
    • blsprice

blsprice — Compute Black-Scholes European call and put option prices.

blsprice(Price,Strike,Rate,Time,Volatility) prices European call and put options under the Black-Scholes model. Optional Yield is the continuously compounded dividend or foreign risk-free yield and defaults to zero.

Syntax

[Call, Put] = blsprice(Price, Strike, Rate, Time, Volatility)
[Call, Put] = blsprice(Price, Strike, Rate, Time, Volatility, Yield)

Inputs

Price
Type
NumericArray
Required
Yes
Description
Current underlying asset price.
Strike
Type
NumericArray
Required
Yes
Description
Exercise price.
Rate
Type
NumericArray
Required
Yes
Description
Continuously compounded risk-free rate.
Time
Type
NumericArray
Required
Yes
Description
Time to expiration in years.
Volatility
Type
NumericArray
Required
Yes
Description
Annualized asset volatility.
Yield
Type
NumericArray
Required
No
Default
0
Description
Continuously compounded yield.
NameTypeRequiredDefaultDescription
PriceNumericArrayYes—Current underlying asset price.
StrikeNumericArrayYes—Exercise price.
RateNumericArrayYes—Continuously compounded risk-free rate.
TimeNumericArrayYes—Time to expiration in years.
VolatilityNumericArrayYes—Annualized asset volatility.
YieldNumericArrayNo0Continuously compounded yield.

Returns

Call
Type
NumericArray
Description
European call option price.
Put
Type
NumericArray
Description
European put option price.
NameTypeDescription
CallNumericArrayEuropean call option price.
PutNumericArrayEuropean put option price.

Returned values from blsprice depend on how many outputs the caller requests.

Errors

RunMat:BlackScholes:InvalidArgument
When
Inputs, option values, or requested output count are invalid.
Message
Black-Scholes builtin: invalid argument
RunMat:BlackScholes:InvalidInput
When
Inputs are nonnumeric, nonfinite, or have incompatible shapes.
Message
Black-Scholes builtin: invalid input
RunMat:BlackScholes:Internal
When
Runtime cannot materialize the requested output.
Message
Black-Scholes builtin: internal error
IdentifierWhenMessage
RunMat:BlackScholes:InvalidArgumentInputs, option values, or requested output count are invalid.Black-Scholes builtin: invalid argument
RunMat:BlackScholes:InvalidInputInputs are nonnumeric, nonfinite, or have incompatible shapes.Black-Scholes builtin: invalid input
RunMat:BlackScholes:InternalRuntime cannot materialize the requested output.Black-Scholes builtin: internal error

Inputs and outputs

With one output, blsprice returns the call price; [Call, Put] requests both. A zero-output request produces no output. More than two outputs are rejected before pricing or provider work.

The five required inputs and optional Yield can be scalars or arrays with MATLAB-compatible implicit-expansion dimensions. Empty Yield selects zero. Invalid financial domains and NaN inputs produce elementwise NaN rather than aborting the entire array calculation.

Double inputs produce double call and put prices. Single inputs produce single prices unless a nonscalar double array is also present; scalar double parameters, whether represented as scalar values or 1-by-1 arrays, can accompany single inputs. With no single input the result is double. This input-class rule is independent of provider choice and is RunMat behavior, not a claim about MATLAB's undocumented output-class combinations.

Single-result pricing rounds inputs to single at the calculation boundary. A finite double scalar that would overflow to infinity or underflow to zero in single is rejected before provider work. Fixed-width integer and logical pricing inputs use the double route; a wide integer may round when it enters binary64. The public compatibility target documents double inputs. Single, fixed-width integer, and logical pricing inputs are RunMat-only extensions, admitted before provider work.

GPU and execution

Resident real gpuArray inputs can use the owning provider's black_scholes_price hook. Host scalar or tensor arguments in a mixed call become temporary inputs for that same provider. A provider without the hook uses the host pricing implementation. Resident results from a provider are checked for owner, shape, and physical precision before they are returned.

The provider hook accepts physical single or double inputs only when its precision matches the input-derived result class. A mixed call with a nonscalar double array cannot silently narrow to a single provider; it falls back to host double pricing if that provider cannot execute double. Single is available only in RunMat compatibility mode. This is a custom provider operation, not a fused elementwise kernel. The function can suspend for fallback gathers and does not mutate its arguments.

Examples

European stock option

[Call, Put] = blsprice(100, 95, 0.10, 0.25, 0.50); fprintf('Call = %.4f, Put = %.4f\n', Call, Put);

Expected output:

Call = 13.6953, Put = 6.3497

Stock index option with yield

[Call, Put] = blsprice(910, 980, 0.02, 0.25, 0.25, 0.025); fprintf('Call = %.4f, Put = %.4f\n', Call, Put);

Expected output:

Call = 19.6863, Put = 90.4683

Using blsprice with coding agents

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

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

FAQ

Can a GPU-resident call remain resident?⌄

Yes when the input owner implements the pricing hook and returns valid owned outputs. Otherwise the operation falls back to the host implementation; there is no generic GPU pricing kernel.

Related Finance functions

Black Scholes

blsimpv

Indicators

macd

Source you can read

Every RunMat function's source is public. Read exactly how blsprice is executed, line by line, in Rust.

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

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Inputs
  • Returns
  • Errors
  • Inputs and outputs
  • GPU and execution
  • Examples
  • European stock option
  • Stock index option with yield
  • Using blsprice with coding agents
  • FAQ
  • Related Finance functions
  • Black Scholes
  • Indicators
  • Source you can read
  • About RunMat