vecxt
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BooleanArrays.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Cholesky.type
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
JVM-specific determinant implementation with SIMD optimizations
JVM-specific determinant implementation with SIMD optimizations
This implementation uses partial pivoting but no scaling, so it’s not suitable for ill-conditioned matrices.
Performance optimizations:
- Direct array access for row-major matrices (2-5x faster than matrix element access)
- SIMD vectorization for row swaps (3-7x faster, uses vector loads/stores)
- SIMD FMA for row elimination inner loop (5-8x faster, dominates O(n³) compute time)
SIMD uses jdk.incubator.vector API with SPECIES_PREFERRED (AVX-512 or AVX2 depending on CPU)
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Determinant.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DoubleArraysX.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DoubleMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Eigenvalues.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FloatArraysX.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IntArraysX.type
DimensionExtender (Int | Dimension) accepts any Int, not just the two meaningful values (Rows/0, Cols/1) - so reduceAlongDimension's dim can't be validated at compile time and a caller can genuinely reach this at runtime, e.g. mat.sum(2).
DimensionExtender (Int | Dimension) accepts any Int, not just the two meaningful values (Rows/0, Cols/1) - so reduceAlongDimension's dim can't be validated at compile time and a caller can genuinely reach this at runtime, e.g. mat.sum(2).
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JsDoubleMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JsFloatMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JsNativeDoubleArrays.type
Cross compilation shim
Cross compilation shim
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JsNativeFloatArrays.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JvmDoubleMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JvmFloatMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JvmIntMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
LU decomposition with partial pivoting using LAPACK.
LU decomposition with partial pivoting using LAPACK.
Decomposes a matrix A into the product PA = LU where:
- P is a permutation matrix
- L is a lower triangular matrix with unit diagonal
- U is an upper triangular matrix
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LU.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LongArrays.type
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MatrixHelper.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MatrixInstance.type
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
The result of a mean-and-variance pass over Array[Double] or Array[Int].
The result of a mean-and-variance pass over Array[Double] or Array[Int].
Replaces the named tuple (mean: Double, variance: Double), and the reason is measured rather than assumed (vecxt/issues/105):
- A named tuple erases to
scala.Tuple2, so reading one field costs an unbox. Check C3 measuredvariance(mode)— whose whole body ismeanAndVariance(mode).variance— at 37 bytes against a 35-byteMaxInlineSize, roughly 30 of them being the destructuring. - Check D1 measured 59.33 bytes/op allocated when a caller reads the pair. Notably it measured zero for
variance(mode), where the pair is dead and escape analysis scalarizes it — so the allocation is real only for callers who actually want both numbers, which is every caller ofmeanAndVariance.
Two primitive double fields is one flat object with nothing nested for escape analysis to chase, and a field read is an invokevirtual on a final class rather than an unbox.
final class, not case class, for the reason recorded on vecxt.matrix.Layout: case class synthesises productElement: Int => Object, which boxes.
No unapply, deliberately. val (m, v) = arr.meanAndVariance was the old idiom and is now .mean / .variance; val (m, v) = x is a Tuple2 pattern and cannot match a non-tuple whatever the companion offers, so restoring destructuring would mean case MeanAndVariance(m, v) => at every site — new API surface to buy back a spelling.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
The Array[Float] counterpart of MeanAndVariance, carrying two primitive float fields.
The Array[Float] counterpart of MeanAndVariance, carrying two primitive float fields.
A separate class rather than one generic in the element type: MeanAndVariance[A] would erase A to Object and box both fields, which is the cost being removed. The float kernels accumulate in Double and narrow once at the end, so this describes the result, not the arithmetic.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayBooleanOps.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayDoubleOps.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayFloatOps.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayIntOps.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayIntReductions.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayReductions.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NDArrayWhere.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NativeDoubleMatrix.type
Cross-compilation stubs — the real implementations live in src-js/floatmatrix.scala and src-native/floatmatrix.scala. all exports both names on every platform, so both have to exist here too. Same arrangement JvmDoubleMatrix/JsDoubleMatrix/NativeDoubleMatrix already use. NativeFloatMatrix was already declared empty here before either had an implementation.
Cross-compilation stubs — the real implementations live in src-js/floatmatrix.scala and src-native/floatmatrix.scala. all exports both names on every platform, so both have to exist here too. Same arrangement JvmDoubleMatrix/JsDoubleMatrix/NativeDoubleMatrix already use. NativeFloatMatrix was already declared empty here before either had an implementation.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NativeFloatMatrix.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NativeIntMatrix.type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object given_OneAndZero_Boolean
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
OneAndZero.type
Linear system solver using LAPACK.
Linear system solver using LAPACK.
Provides methods to solve systems of linear equations Ax = b using LAPACK's dgesv routine.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Solve.type
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- enum
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
VarianceMode.type
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
arrayUtil.type
Whether a single BLAS leading dimension can describe m.
Whether a single BLAS leading dimension can describe m.
BLAS addresses a matrix as one block in which one axis is contiguous and the other advances by a constant lda — a(offset + p + q * lda). So an operand is expressible exactly when one of its strides is 1 and the other is a valid leading dimension for the extent BLAS will check it against.
The second half is the part that is easy to drop, and dropping it is not harmless. lda must be at least the block's row count or the routine rejects the call, and layouts satisfying stride == 1 while failing it do occur: a broadcast column has colStride == 0, repeating one column across the matrix, which no leading dimension expresses. Guarding on stride == 1 alone therefore lets a broadcast operand through to BLAS with lda = 0.
Which extent applies follows from which stride is unit, because that also decides the transpose flag: an operand with rowStride == 1 is passed untransposed and its block has rows rows, so colStride must be at least rows; one with colStride == 1 is passed transposed, its block has cols rows, so rowStride must be at least cols.
Callers that need to know which of the two cases holds — to pick the transpose flag and lda — should test the halves directly rather than call this; this is for the guard that decides whether BLAS can be used at all.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
broadcast.type
Compute the cosine similarity between two vectors
Compute the cosine similarity between two vectors
Value parameters
- v1
-
the first vector
- v2
-
the second vector
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
cosineSimilarity.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
dimMatCheck.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
dimNDArrayCheck validates that the product of shape dimensions equals data.length.
dimNDArrayCheck validates that the product of shape dimensions equals data.length.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
dimNDArrayCheck.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
doublearrays.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
floatarrays.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
indexCheckMat.type
indexNDArrayCheck validates element-access indices against the NDArray's shape.
indexNDArrayCheck validates element-access indices against the NDArray's shape.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
indexNDArrayCheck.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
intarrays.type
Validates the output matrix c of a matmulInPlace! call: it must be shaped exactly (m.rows, b.cols) and dense column-major. matmulInPlace! hardcodes ldc = m.rows and always writes (and, when beta != 0, reads) c assuming that layout, so a wrongly-shaped or non-dense-column-major c would otherwise be corrupted or misread silently instead of failing loudly. matmul/@@ always build a conforming c themselves, so this only bites direct callers of the in-place API.
Validates the output matrix c of a matmulInPlace! call: it must be shaped exactly (m.rows, b.cols) and dense column-major. matmulInPlace! hardcodes ldc = m.rows and always writes (and, when beta != 0, reads) c assuming that layout, so a wrongly-shaped or non-dense-column-major c would otherwise be corrupted or misread silently instead of failing loudly. matmul/@@ always build a conforming c themselves, so this only bites direct callers of the in-place API.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
matmulOutputCheck.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
matrixUtil.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ndarrayOps.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
nonEmptyMatCheck.type
If this is true, then we can use the same memory layout for element-wise operations
If this is true, then we can use the same memory layout for element-wise operations
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
sameDimMatCheck.type
shapeCheck validates that all dimensions are > 0. A 0-length shape (0-d array) is valid.
shapeCheck validates that all dimensions are > 0. A 0-length shape (0-d array) is valid.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
shapeCheck.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
squareMatCheck.type
strideMatInstantiateCheck performs a set of safety checks when constructing a matrix view with arbitrary strides and offset into a backing array. The checks include:
strideMatInstantiateCheck performs a set of safety checks when constructing a matrix view with arbitrary strides and offset into a backing array. The checks include:
- Ensuring the number of rows and columns are positive.
- Ensuring the offset is within the bounds of the backing array.
- Ensuring both rowStride and colStride are non-zero.
- Calculating the maximum and minimum indices that could be accessed by the matrix view, given the strides and offset, and ensuring these indices are within the bounds of the array.
- Throws appropriate exceptions if any check fails.
Validates matrix construction parameters for stride-based layout.
Performs comprehensive bounds checking for matrices with flexible stride patterns, including support for broadcasting (zero strides) and negative strides for flipped views.
Validates:
- Positive matrix dimensions
- Valid offset within array bounds
- Sensible stride values (zero for broadcasting, non-zero otherwise)
- All matrix elements remain within array bounds
- Negative strides don't cause negative index access
- 1x1 matrices have semantically meaningful strides (0 or 1)
Value parameters
- colStride
-
Memory offset between consecutive columns
- cols
-
Number of matrix columns
- offset
-
Starting position in the data array
- raw
-
The underlying data array
- rowStride
-
Memory offset between consecutive rows
- rows
-
Number of matrix rows
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
strideNDArrayCheck validates construction of an NDArray with arbitrary strides and offset.
strideNDArrayCheck validates construction of an NDArray with arbitrary strides and offset.
Validates:
- shape and strides have the same length (rank consistency)
- All dimensions in shape are > 0
- Offset is >= 0 and < data.length
- Strides are non-zero (except 0 for broadcast dims of size 1)
- All corner combinations of indices stay within [0, data.length)
All three checks in this file are plain defs despite being generic. They read data.size — deliberately, because .size does not route an abstract element type through ScalaRunTime$.array_length the way .length does — and everything else they touch is shape, strides or indices, all Array[Int]. So there is nothing here that inline was protecting, which makes them unlike dimCheck's generic arms: those reach a.length on an Array[A] and stay inline for exactly the reason these do not need to.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
strideNDArrayCheck.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
symmetricMatCheck.type