vecxt

package vecxt

Members list

Type members

Classlikes

object BooleanArrays

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object BoundsCheck

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Determinant

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:

  1. Direct array access for row-major matrices (2-5x faster than matrix element access)
  2. SIMD vectorization for row swaps (3-7x faster, uses vector loads/stores)
  3. 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 Object
trait Matchable
class Any
Self type
object DoubleArrays

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object DoubleMatrix

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object IntArrays

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IntArrays.type
case class InvalidMatrix(cols: Int, rows: Int, data: Int) extends Exception

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object JvmIntMatrix

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class MatrixDimensionMismatch(aCols: Int, aRows: Int, bCols: Int, bRows: Int) extends Exception

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
object MatrixHelper

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait OneAndZero[A]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object OneAndZero

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
OneAndZero.type
case class VectorDimensionMismatch(givenDimension: Int, requiredDimension: Int) extends Exception

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
object all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
all.type
object arrayUtil

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
arrayUtil.type
object arrays

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
arrays.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 Object
trait Matchable
class Any
Self type
object dimMatCheck

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object indexCheckMat

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object matrix

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
matrix.type
object matrixUtil

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
matrixUtil.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 Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self 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 Object
trait Matchable
class Any
Self type

Types

type Col = Int
type Row = Int
type RowCol = (Row, Col)