asinh — Element-wise inverse hyperbolic sine in MATLAB and RunMat.
Y = asinh(X) evaluates the inverse hyperbolic sine of each element in X. Real and complex inputs are handled element-wise, with branch behavior matching MATLAB semantics.
Syntax
Y = asinh(X)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
X | Any | Yes | — | Single/double real or complex input; integer, logical, and character forms are RunMat-only extensions. |
Returns
| Name | Type | Description |
|---|---|---|
Y | Any | Element-wise inverse hyperbolic sine result. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:asinh:InvalidInput | Input cannot be interpreted as supported numeric/char/complex data. | asinh: invalid input |
RunMat:asinh:Internal | Internal gather/conversion/allocation/provider flow failed. | asinh: internal error |
RunMat:asinh:TooManyOutputs | More than one output is requested. | asinh: too many output arguments |
How asinh works
- Accepts scalars, vectors, matrices, and N-D tensors and applies the operation element-wise using MATLAB's broadcasting rules.
- The documented table and timetable overloads are not yet implemented in RunMat.
- Documented single and complex-single inputs preserve native single storage; double and complex-double inputs preserve double storage.
- Typed-integer, logical, and character inputs are RunMat-only extensions. They enter an explicit double computation boundary and preserve input shape.
- Real inputs produce real outputs for all finite values. Complex inputs follow MATLAB's principal branch definition
asinh(z) = log(z + sqrt(z^2 + 1)). - NaNs and infinities propagate according to IEEE arithmetic and match MATLAB's special-case tables.
Does RunMat run asinh on the GPU?
RunMat Accelerate keeps tensors on the GPU when a provider implements unary_asinh. Otherwise, it gathers the authoritative value, evaluates the reference implementation, and restores the result to the input handle's owning provider.
GPU memory and residency
The fusion planner keeps tensors on the GPU whenever the active provider exposes unary_asinh. When the hook is unavailable, RunMat gathers, computes, and restores the result to the input handle's owning provider. Resident integer and logical inputs remain separately gated RunMat-only extensions.
Examples
Inverse hyperbolic sine of a scalar
y = asinh(0.5)Expected output:
y = 0.4812Applying asinh to every element of a vector
x = linspace(-2, 2, 5);
y = asinh(x)Expected output:
y = [-1.4436 -0.8814 0 0.8814 1.4436]Evaluating asinh on a matrix
A = [0 -0.5 1.0; 1.5 -2.0 3.0];
B = asinh(A)Expected output:
B =
0 -0.4812 0.8814
1.1948 -1.4436 1.8184Computing asinh on GPU data
G = gpuArray([0.25 0.5; 0.75 1.0]);
result_gpu = asinh(G);
result = gather(result_gpu)Expected output:
result = [0.2475 0.4812; 0.6931 0.8814]Handling complex arguments with asinh
z = [1 + 2i, -0.5 + 0.75i];
w = asinh(z)Expected output:
w =
1.4694 + 1.0634i
-0.6063 + 0.6822iUsing asinh inside fused GPU expressions
G = gpuArray(rand(1024, 1));
Y = sinh(G) + asinh(G)Using asinh with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how asinh changes the result.
Run a small asinh example, explain the result, then change one input and compare the output.
FAQ
Does asinh ever return complex numbers for real inputs?⌄
No. Real arguments always produce real results. Complex outputs arise only when the inputs themselves are complex.
How are logical or integer inputs handled?⌄
They are outside the documented single/double data domain. RunMat mode retains logical and all-eight-class integer inputs as explicit extensions and converts them to double at the inverse-hyperbolic-sine computation boundary.
What happens if the GPU provider lacks unary_asinh?⌄
RunMat gathers the data, evaluates asinh on the CPU, and restores the result to the input handle's owning provider.
Is there a precision difference between CPU and GPU outputs?⌄
Both paths operate in the provider's precision (f32 or f64). Small rounding differences may appear near very large magnitudes, but the results stay within MATLAB's tolerance specs.
Can asinh participate in fusion?⌄
Yes. Element-wise fusion templates include asinh, allowing the fusion planner to inline it alongside other unary operations when generating WGSL kernels.
How are character arrays processed?⌄
Character input is outside the documented single/double domain. RunMat mode retains it as an explicit extension, interprets Unicode code points as doubles, and applies asinh element-wise.
What happens with NaN or Inf values?⌄
NaNs propagate unchanged. Positive and negative infinities map to infinities with the same sign, matching MATLAB's special-case rules.
Can I keep complex results on the GPU?⌄
Complex floating input is supported. When a provider hook is unavailable, RunMat uses an owner-preserving fallback and restores the complex result to the same provider.
Does asinh support automatic differentiation plans?⌄
Yes. The fusion and acceleration metadata mark asinh as an element-wise operation, so future autodiff infrastructure can reuse the same kernel hooks.
Related Math functions
Trigonometry
acos · acosh · asin · atan · atan2 · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh
Elementwise
abs · angle · bsxfun · complex · conj · double · erf · erfcinv · exp · expm1 · factorial · flintmax · gamma · gammaln · heaviside · hypot · idivide · imag · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · swapbytes · times · typecast · uint16 · uint32 · uint8
Reduction
all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · std · sum · trapz · var
Structure
bandwidth · isdiag · ishermitian · issymmetric · istril · istriu · symrcm
Signal
blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · fir1 · freqz · gauspuls · hamming · hann · hilbert · periodogram · pulstran · pwelch · rectpuls · resample · sawtooth · sinc · spectrogram · square · tripuls · unwrap · upsample · zplane
Optim
coneprog · fminbnd · fminunc · fsolve · fzero · integral · linprog · lsqcurvefit · lsqnonlin · optimoptions · optimset · quad · secondordercone
Ops
cross · ctranspose · dot · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how asinh is executed, line by line, in Rust.
- View the source for asinh 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.