org.saddle.util
Additional utilities that need a home
Type members
Classlikes
Provides a way to append two arrays of possibly different types together by intelligently promoting primitive types where possible.
Provides a way to append two arrays of possibly different types together by intelligently promoting primitive types where possible.
Key method is Concat.append(array1, array2)
An Order[Double] instance which produces a total order by ordering NaNs above all other Doubles
An Order[Double] instance which produces a total order by ordering NaNs above all other Doubles
Contrary to the specification of cats, the DoubleOrdering in cats.kernel is not total because NaN is not ordered (all comparisons return false). This behaviour is consistent with IEEE-754, but not very practical.
java.lang.Double.compare orders NaN to be largest of all Doubles.
See https://github.com/scala/scala/pull/8721 See https://github.com/scala/scala/blob/39e82c3f904380f0b40d106723747faf881640d4/src/library/scala/math/Ordering.scala#L465
See DoubleTotalOrder
See DoubleTotalOrder
This class implements mutable maps with Long keys based on a hash table with open addressing.
This class implements mutable maps with Long keys based on a hash table with open addressing.
Basic map operations on single entries, including contains
and get
, are
typically substantially faster with LongMap
than HashMap. Methods that act
on the whole map, including foreach
and map
are not in general expected
to be faster than with a generic map, save for those that take particular
advantage of the internal structure of the map: foreachKey
,
foreachValue
, mapValuesNow
, and transformValues
.
Maps with open addressing may become less efficient at lookup after repeated
addition/removal of elements. Although LongMap
makes a decent attempt to
remain efficient regardless, calling repack
on a map that will no longer
have elements removed but will be used heavily may save both time and
storage space.
This map is not intended to contain more than 2^29 entries (approximately 500 million). The maximum capacity is 2^30, but performance will degrade rapidly as 2^30 is approached.
- Companion:
- object
Value members
Concrete methods
Creates a string out of ''count'' number of elements extracted from ''total'' elements between offsets [0 ... count / 2) and (total - count / 2 ... total), using a callback that generates a string at each offset, and inserting a break string if count > total.
Creates a string out of ''count'' number of elements extracted from ''total'' elements between offsets [0 ... count / 2) and (total - count / 2 ... total), using a callback that generates a string at each offset, and inserting a break string if count > total.
- Value parameters:
- break
Produces a string to insert as a break
- callback
Generates a string at each offset
- count
Number of elements to print
- total
Total number of elements in sequence