Typed array collections using primitive arrays to avoid boxing.
Provides wrappers around primitive arrays (double-array, long-array) that can be used for efficient sample storage during benchmarking. Three types are provided for the three metric types:
Typed array collections using primitive arrays to avoid boxing. Provides wrappers around primitive arrays (double-array, long-array) that can be used for efficient sample storage during benchmarking. Three types are provided for the three metric types: - DoubleArray for :quantitative metrics - LongArray for :event metrics - ObjectArray for :nominal metrics
(->double-array arr)Creates a DoubleArray from a primitive double array. Use (double-array coll) to convert a collection to a primitive array first.
Creates a DoubleArray from a primitive double array. Use (double-array coll) to convert a collection to a primitive array first.
(->long-array arr)Creates a LongArray from a primitive long array. Use (long-array coll) to convert a collection to a primitive array first.
Creates a LongArray from a primitive long array. Use (long-array coll) to convert a collection to a primitive array first.
(->object-array arr)Creates an ObjectArray from an object array. Use (object-array coll) to convert a collection to an object array first.
Creates an ObjectArray from an object array. Use (object-array coll) to convert a collection to an object array first.
(array= arr expected)Returns true if typed array elements equal the expected sequence. Compares element-by-element using == for doubles/longs, = for objects.
Returns true if typed array elements equal the expected sequence. Compares element-by-element using == for doubles/longs, = for objects.
Returns the maximum capacity of a resizable array.
Returns the maximum capacity of a resizable array.
(dany? arr pred)Returns true if any element satisfies the predicate. pred must be (fn [^double x] ...) returning truthy/falsy. Works with DoubleArray and LongArray.
Returns true if any element satisfies the predicate. pred must be (fn [^double x] ...) returning truthy/falsy. Works with DoubleArray and LongArray.
(dfold arr f init)Reduces over elements with an object-returning function, receiving primitive doubles. Works with both DoubleArray and LongArray (longs are converted to doubles). f must be (fn [acc ^double val] ...) - receives primitive double, returns Object. Use this when accumulating into a collection.
Reduces over elements with an object-returning function, receiving primitive doubles. Works with both DoubleArray and LongArray (longs are converted to doubles). f must be (fn [acc ^double val] ...) - receives primitive double, returns Object. Use this when accumulating into a collection.
(dfold-skip arr skip-idx f init)Fold over elements skipping the element at skip-idx, returning Object. Used for jackknife resampling when accumulating into a collection. f must be (fn [acc ^double val] ...) - receives primitive double, returns Object. Works with DoubleArray and LongArray.
Fold over elements skipping the element at skip-idx, returning Object. Used for jackknife resampling when accumulating into a collection. f must be (fn [acc ^double val] ...) - receives primitive double, returns Object. Works with DoubleArray and LongArray.
(dmap arr f)Maps f over elements, returning a new DoubleArray. f must be (fn ^double [^double x] ...). Works with DoubleArray and LongArray.
Maps f over elements, returning a new DoubleArray. f must be (fn ^double [^double x] ...). Works with DoubleArray and LongArray.
(dmap-indexed arr f)Maps f over elements with index, returning a new DoubleArray. f must be (fn ^double [^long idx ^double x] ...). Works with DoubleArray and LongArray.
Maps f over elements with index, returning a new DoubleArray. f must be (fn ^double [^long idx ^double x] ...). Works with DoubleArray and LongArray.
(double-array? x)Returns true if x is a DoubleArray.
Returns true if x is a DoubleArray.
(doubles-fill n v)Creates a primitive double array of length n filled with value v.
Creates a primitive double array of length n filled with value v.
(elem-type arr)Returns the element type keyword: :double, :long, or :object.
Returns the element type keyword: :double, :long, or :object.
(fill! arr value)Fills an array with the specified value. Dispatches to the appropriate primitive fill method at compile time based on the array's type hint. Returns arr for chaining.
Fills an array with the specified value. Dispatches to the appropriate primitive fill method at compile time based on the array's type hint. Returns arr for chaining.
(filter-indices arr exclude-set)Returns a new typed array containing only elements at indices NOT in exclude-set. Returns the same type as input: DoubleArray returns DoubleArray, LongArray returns LongArray. exclude-set is a set of long indices to exclude.
Returns a new typed array containing only elements at indices NOT in exclude-set. Returns the same type as input: DoubleArray returns DoubleArray, LongArray returns LongArray. exclude-set is a set of long indices to exclude.
(first-double arr)Returns the first element from a DoubleArray as a primitive double.
Returns the first element from a DoubleArray as a primitive double.
(first-element arr)Returns the first element from a typed array. Dispatches based on runtime array type for cases where the type cannot be statically determined.
Returns the first element from a typed array. Dispatches based on runtime array type for cases where the type cannot be statically determined.
(first-long arr)Returns the first element from a LongArray as a primitive long.
Returns the first element from a LongArray as a primitive long.
(first-object arr)Returns the first element from an ObjectArray.
Returns the first element from an ObjectArray.
(fold arr f init)Reduces over the elements with function f and initial value init. f is called as (f acc elem) for each element. This is the generic version that boxes primitive values.
Reduces over the elements with function f and initial value init. f is called as (f acc elem) for each element. This is the generic version that boxes primitive values.
(fold-double arr f init)Reduces over elements with a primitive double function. Works with both DoubleArray and LongArray (longs are converted to doubles). f must be (fn ^double [^double acc ^double val] ...). Returns a primitive double.
Reduces over elements with a primitive double function. Works with both DoubleArray and LongArray (longs are converted to doubles). f must be (fn ^double [^double acc ^double val] ...). Returns a primitive double.
(fold-double-skip arr skip-idx f init)Fold over elements skipping the element at skip-idx. Used for jackknife resampling. f must be (fn ^double [^double acc ^double val] ...). Works with DoubleArray and LongArray. Returns a primitive double.
Fold over elements skipping the element at skip-idx. Used for jackknife resampling. f must be (fn ^double [^double acc ^double val] ...). Works with DoubleArray and LongArray. Returns a primitive double.
(fold-long arr f init)Reduces over long elements with a primitive long function. f must be (fn ^long [^long acc ^long val] ...). Returns a primitive long.
Reduces over long elements with a primitive long function. f must be (fn ^long [^long acc ^long val] ...). Returns a primitive long.
(get-at arr index)Returns the element at index. Works with DoubleArray, LongArray, and ObjectArray.
Returns the element at index. Works with DoubleArray, LongArray, and ObjectArray.
(get-double arr index)Returns the value at index as a primitive double.
Returns the value at index as a primitive double.
(get-long arr index)Returns the value at index as a primitive long.
Returns the value at index as a primitive long.
(indexed-dfold arr f init)Fold over elements with index, accumulating and returning Object. f must be (fn [acc ^long idx ^double val] ...). Uses .invokePrim to avoid boxing on the index and value arguments. Works with both DoubleArray and LongArray.
Fold over elements with index, accumulating and returning Object. f must be (fn [acc ^long idx ^double val] ...). Uses .invokePrim to avoid boxing on the index and value arguments. Works with both DoubleArray and LongArray.
(indexed-fold-double arr f init)Fold over elements with index, accumulating and returning primitive double. f must be (fn ^double [^double acc ^long idx ^double val] ...). Uses .invokePrim to avoid boxing. Works with both DoubleArray and LongArray.
Fold over elements with index, accumulating and returning primitive double. f must be (fn ^double [^double acc ^long idx ^double val] ...). Uses .invokePrim to avoid boxing. Works with both DoubleArray and LongArray.
(lany? arr pred)Returns true if any element satisfies the predicate. pred must be (fn [^long x] ...) returning truthy/falsy. Works only with LongArray.
Returns true if any element satisfies the predicate. pred must be (fn [^long x] ...) returning truthy/falsy. Works only with LongArray.
(last-double arr)Returns the last element from a DoubleArray as a primitive double.
Returns the last element from a DoubleArray as a primitive double.
(last-long arr)Returns the last element from a LongArray as a primitive long.
Returns the last element from a LongArray as a primitive long.
(last-object arr)Returns the last element from an ObjectArray.
Returns the last element from an ObjectArray.
(length arr)Returns the number of elements in the array.
Returns the number of elements in the array.
(lfold arr f init)Reduces over long elements with an object-returning function. f must be (fn [acc ^long val] ...) - receives primitive long, returns Object. Use this when accumulating into a collection from LongArray.
Reduces over long elements with an object-returning function. f must be (fn [acc ^long val] ...) - receives primitive long, returns Object. Use this when accumulating into a collection from LongArray.
(lmap arr f)Maps f over elements, returning a new LongArray. f must be (fn ^long [^long x] ...). Works only with LongArray.
Maps f over elements, returning a new LongArray. f must be (fn ^long [^long x] ...). Works only with LongArray.
(lmap-indexed arr f)Maps f over elements with index, returning a new LongArray. f must be (fn ^long [^long idx ^long x] ...). Works only with LongArray.
Maps f over elements with index, returning a new LongArray. f must be (fn ^long [^long idx ^long x] ...). Works only with LongArray.
(long-array? x)Returns true if x is a LongArray.
Returns true if x is a LongArray.
(longs-fill n v)Creates a primitive long array of length n filled with value v.
Creates a primitive long array of length n filled with value v.
(make-doubles a)(make-doubles a b)(make-doubles a b c)(make-doubles a b c d)Creates a primitive double array with 1-4 explicit values.
Avoids ISeq iteration overhead of (double-array [...]).
Creates a primitive double array with 1-4 explicit values. Avoids ISeq iteration overhead of `(double-array [...])`.
(make-longs a)(make-longs a b)(make-longs a b c)(make-longs a b c d)Creates a primitive long array with 1-4 explicit values.
Avoids ISeq iteration overhead of (long-array [...]).
Creates a primitive long array with 1-4 explicit values. Avoids ISeq iteration overhead of `(long-array [...])`.
(object-array? x)Returns true if x is an ObjectArray.
Returns true if x is an ObjectArray.
Creates a ResizableDoubleArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Creates a ResizableDoubleArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Returns true if x is a ResizableDoubleArray.
Returns true if x is a ResizableDoubleArray.
Creates a ResizableLongArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Creates a ResizableLongArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Returns true if x is a ResizableLongArray.
Returns true if x is a ResizableLongArray.
Creates a ResizableObjectArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Creates a ResizableObjectArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Returns true if x is a ResizableObjectArray.
Returns true if x is a ResizableObjectArray.
Resizes a resizable array to a new size. The new size must be between 0 and capacity (inclusive). Returns the new size.
Resizes a resizable array to a new size. The new size must be between 0 and capacity (inclusive). Returns the new size.
(set-at! arr index value)Returns the element at index. Works with DoubleArray, LongArray, and ObjectArray.
Returns the element at index. Works with DoubleArray, LongArray, and ObjectArray.
(sorted arr)Returns a new sorted DoubleArray. Uses Java's Arrays.sort for efficient primitive sorting. LongArray is converted to DoubleArray during sorting.
Returns a new sorted DoubleArray. Uses Java's Arrays.sort for efficient primitive sorting. LongArray is converted to DoubleArray during sorting.
(sum arr)Returns the sum of elements. For DoubleArray returns double, for LongArray returns long.
Returns the sum of elements. For DoubleArray returns double, for LongArray returns long.
(sum-double arr)Returns the sum of elements as a primitive double. Works with DoubleArray.
Returns the sum of elements as a primitive double. Works with DoubleArray.
(sum-long arr)Returns the sum of elements as a primitive long. Only works with LongArray.
Returns the sum of elements as a primitive long. Only works with LongArray.
Converts a resizable array to a fixed array of the same element type. Creates a new array containing only the active elements (0 to size-1). ResizableDoubleArray -> DoubleArray, ResizableLongArray -> LongArray, ResizableObjectArray -> ObjectArray.
Converts a resizable array to a fixed array of the same element type. Creates a new array containing only the active elements (0 to size-1). ResizableDoubleArray -> DoubleArray, ResizableLongArray -> LongArray, ResizableObjectArray -> ObjectArray.
(typed-array? x)Returns true if x is a typed array (DoubleArray, LongArray, or ObjectArray).
Returns true if x is a typed array (DoubleArray, LongArray, or ObjectArray).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |