Skip to content

Commit e7c68b7

Browse files
markuswntrstephentyrone
authored andcommitted
Add norms to imaginary helper
1 parent c142bce commit e7c68b7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/QuaternionModule/ImaginaryHelper.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ extension SIMD3 where Scalar: FloatingPoint {
3434
/// The ∞-norm of the value (`max(abs(x), abs(y), abs(z))`).
3535
@usableFromInline @inline(__always)
3636
internal var magnitude: Scalar {
37-
max()
37+
Swift.max(x.magnitude, y.magnitude, z.magnitude)
38+
}
39+
40+
/// The 1-norm of the value (`abs(x) + abs(y) + abs(z))`).
41+
@usableFromInline @inline(__always)
42+
internal var oneNorm: Scalar {
43+
x.magnitude + y.magnitude + z.magnitude
3844
}
3945

4046
/// The Euclidean norm (a.k.a. 2-norm, `sqrt(x*x + y*y + z*z)`).

0 commit comments

Comments
 (0)