1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 OUTRAM PARK contributors
//
// This file is part of OUTRAM PARK.
//
// OUTRAM PARK is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// OUTRAM PARK is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with OUTRAM PARK. If not, see <https://www.gnu.org/licenses/>.
//! Dense BLAS-1 vector primitives for the Krylov solvers.
//!
//! Pure-Rust replacements for the handful of level-1 BLAS operations the
//! iterative solvers need. All operands are dimensionless `&[f64]` slices whose
//! length equals the number of unknowns (mesh cells); no `uom` typing is applied
//! here because a Krylov subspace mixes residuals, search directions, and
//! solution increments that share no single physical dimension.
//!
//! Every function is `O(n)` in the slice length and allocation-free (results are
//! either scalars or written in place), so they are safe to call inside the
//! innermost solver loops.
/// Euclidean inner product `Σ_i a_i · b_i` (dimensionless).
///
/// Both slices must have the same length; a mismatch panics via
/// `debug_assert`. Valid for any finite inputs; returns `0.0` for empty slices.
/// Euclidean 2-norm `sqrt(Σ_i x_i²)` (dimensionless, always `>= 0`).
///
/// Computed as `sqrt(dot(x, x))`. For very large magnitudes this can overflow to
/// `+inf`; inputs are expected to be within normal `f64` range, which holds for
/// well-scaled linear systems.
/// AXPY update `y := alpha · x + y`, in place.
///
/// `alpha` is a dimensionless scalar; `x` and `y` must have equal length (a
/// mismatch panics via `debug_assert`). `y` is overwritten with the result.
/// Scale `x := alpha · x`, in place.
///
/// `alpha` is a dimensionless scalar. Every element of `x` is multiplied by
/// `alpha`.