# Scaling

#### trait Scaling extends AnyRef

Scaling utilities.

Often, in order to avoid underflow, we can offload some of the exponent of a double into an int. To make things more efficient, we can actually share that exponent between doubles.

The scales used in this trait are in log space: they can be safely added and subtracted.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
1. Alphabetic
2. By inheritance
Inherited
1. Scaling
2. AnyRef
3. Any
1. Hide All
2. Show all
Visibility
1. Public
2. All

### Abstract Value Members

1. #### abstract val scaleConstant: Int

the largest (log) power of two we want to deal with

### Concrete Value Members

1. #### final def !=(arg0: AnyRef): Boolean

Definition Classes
AnyRef
2. #### final def !=(arg0: Any): Boolean

Definition Classes
Any
3. #### final def ##(): Int

Definition Classes
AnyRef → Any
4. #### final def ==(arg0: AnyRef): Boolean

Definition Classes
AnyRef
5. #### final def ==(arg0: Any): Boolean

Definition Classes
Any
6. #### final def asInstanceOf[T0]: T0

Definition Classes
Any
7. #### def clone(): AnyRef

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( ... )
8. #### def computeScaleDelta(scores: Array[Double]): Int

Computes the log power of two we'd need to scale by so that the max double is between (2 ** scaleConstant, 2 ** -scaleConstant).

Computes the log power of two we'd need to scale by so that the max double is between (2 ** scaleConstant, 2 ** -scaleConstant).

scores
returns

10. #### final def eq(arg0: AnyRef): Boolean

Definition Classes
AnyRef
11. #### def equals(arg0: Any): Boolean

Definition Classes
AnyRef → Any
12. #### def finalize(): Unit

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( classOf[java.lang.Throwable] )
13. #### final def getClass(): Class[_]

Definition Classes
AnyRef → Any
14. #### def hashCode(): Int

Definition Classes
AnyRef → Any
15. #### final def isInstanceOf[T0]: Boolean

Definition Classes
Any
16. #### final def ne(arg0: AnyRef): Boolean

Definition Classes
AnyRef
17. #### final def notify(): Unit

Definition Classes
AnyRef
18. #### final def notifyAll(): Unit

Definition Classes
AnyRef
19. #### def scaleArray(scores: Array[Double], currentScale: Int): Int

Ensures that the max double is between (2**scaleConstant,2**-scaleConstant), scaling the array as necessary.

Ensures that the max double is between (2**scaleConstant,2**-scaleConstant), scaling the array as necessary.

scores
currentScale
returns

newScale

21. #### def scaleValue(score: Double, currentScale: Int, targetScale: Int): Double

Converts the scaled value into "normal" space

22. #### def sumArrays(src: Array[Double], srcScale: Int, dest: Array[Double], destScale: Int): Int

Sums `src` into `dest` assuming they're at different scales.

Sums `src` into `dest` assuming they're at different scales. `src` may be longer than `dest`, which is useful for allocating a large work buffer.

src
srcScale
dest
destScale
returns

the new scale

23. #### final def synchronized[T0](arg0: ⇒ T0): T0

Definition Classes
AnyRef

25. #### def toString(): String

Definition Classes
AnyRef → Any
26. #### def unscaleValue(score: Double, currentScale: Int): Double

Converts the scaled value into "normal" space

27. #### final def wait(): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
28. #### final def wait(arg0: Long, arg1: Int): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
29. #### final def wait(arg0: Long): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )