Class/Object

breeze.collection.mutable

SparseArray

Related Docs: object SparseArray | package mutable

Permalink

final class SparseArray[V] extends ArrayLike[V] with Storage[V] with Serializable

A SparseArray is a sparse representation of an array using a two-array binary-search approach. There are two arrays: index and data, which together are pairs (i, v) of indices into the array and the value at that position.

The default value is assumed to be null for AnyRef, and 0 for AnyVal types.

Annotations
@SerialVersionUID()
Linear Supertypes
Serializable, Serializable, Storage[V], ArrayLike[V], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SparseArray
  2. Serializable
  3. Serializable
  4. Storage
  5. ArrayLike
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SparseArray(size: Int)(implicit manElem: ClassTag[V], zero: Zero[V])

    Permalink
  2. new SparseArray(size: Int, default: V)(implicit manElem: ClassTag[V])

    Permalink
  3. new SparseArray(index: Array[Int], data: Array[V], used: Int, size: Int, default: V)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def activeSize: Int

    Permalink

    How many elements are stored in terms of space.

    How many elements are stored in terms of space. In HashVectors, activeSize is the number of non-zero elements, while iterableSize is the number of buckets currently allocated. (activeSize <= iterableSize in general, activeSize == iterableSize for everything except hashing implementations.)

    Definition Classes
    SparseArrayStorageArrayLike
  5. def allVisitableIndicesActive: Boolean

    Permalink

    Only gives true if isActive would return true for all i.

    Only gives true if isActive would return true for all i. (May be false anyway)

    Definition Classes
    SparseArrayStorage
  6. final def apply(i: Int): V

    Permalink
    Definition Classes
    SparseArrayArrayLike
    Annotations
    @inline()
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def compact(): Unit

    Permalink

    Compacts the array by removing all stored default values.

  10. def concatenate(that: SparseArray[V])(implicit man: ClassTag[V]): SparseArray[V]

    Permalink
  11. def contains(i: Int): Boolean

    Permalink
  12. var data: Array[V]

    Permalink

    Returns the actual flat array of elements used.

    Returns the actual flat array of elements used.

    Definition Classes
    SparseArrayStorage
  13. val default: V

    Permalink
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def filter(f: (V) ⇒ Boolean): SparseArray[V]

    Permalink

    Filter's the array by removing all values for which f is false.

  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def findOffset(i: Int): Int

    Permalink

    Returns the offset into index and data for the requested vector index.

    Returns the offset into index and data for the requested vector index. If the requested index is not found, the value is negative and can be converted into an insertion point with ~rv.

    Attributes
    protected
  19. def foreach[U](f: (V) ⇒ U): Unit

    Permalink

    Only iterates "active" elements.

    Only iterates "active" elements. I'm not sure how I feel about this behavior, since it's inconsistent with the rest of Breeze. I will think on it.

    Definition Classes
    ArrayLike
  20. def get(i: Int): Option[V]

    Permalink
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def getOrElse(i: Int, value: ⇒ V): V

    Permalink
  23. def getOrElseUpdate(i: Int, value: ⇒ V): V

    Permalink
  24. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  25. var index: Array[Int]

    Permalink
  26. final def indexAt(i: Int): Int

    Permalink

    Gives the logical index from the physical index.

    Gives the logical index from the physical index.

    Definition Classes
    SparseArrayStorage
  27. def isActive(i: Int): Boolean

    Permalink

    Some storages (namely HashStorage) won't have active indices packed.

    Some storages (namely HashStorage) won't have active indices packed. This lets you know if the bin is actively in use.

    i

    index into index/data arrays

    Definition Classes
    SparseArrayStorage
  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. def iterableSize: Int

    Permalink

    How many elements must be iterated over using valueAt/indexAt.

    How many elements must be iterated over using valueAt/indexAt. In HashVectors, activeSize is the number of non-zero elements, while iterableSize is the number of buckets currently allocated. (activeSize <= iterableSize in general, activeSize == iterableSize for everything except hashing implementations.)

    Definition Classes
    Storage
  30. def iterator: Iterator[(Int, V)]

    Permalink

    Only iterates "active" elements

    Only iterates "active" elements

    Definition Classes
    ArrayLike
  31. def keysIterator: Iterator[Int]

    Permalink

    Only iterates "active" keys

    Only iterates "active" keys

    Definition Classes
    SparseArrayArrayLike
  32. def length: Int

    Permalink
    Definition Classes
    ArrayLike
  33. def map[B](f: (V) ⇒ B)(implicit arg0: ClassTag[B], arg1: Zero[B]): SparseArray[B]

    Permalink

    Maps all values.

    Maps all values. If f(this.default) is not equal to the new default value, the result may be an efficiently dense (or almost dense) paired array.

  34. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  35. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  36. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. def quickCompact(): Unit

    Permalink

    Like compact, but doesn't look for defaultValues that can be removed.

  38. def reserve(nnz: Int): Unit

    Permalink
  39. val size: Int

    Permalink

    How many elements are logically stored here.

    How many elements are logically stored here. This may be <= activeSize.

    Definition Classes
    SparseArrayStorageArrayLike
  40. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  41. def toArray[U >: V](implicit arg0: ClassTag[U]): Array[U]

    Permalink
    Definition Classes
    ArrayLike
  42. def toIndexedSeq: List[V]

    Permalink
    Definition Classes
    ArrayLike
  43. def toList: List[V]

    Permalink
    Definition Classes
    ArrayLike
  44. def toMap: Map[Int, V]

    Permalink
    Definition Classes
    ArrayLike
  45. def toString(): String

    Permalink
    Definition Classes
    SparseArray → AnyRef → Any
  46. final def update(i: Int, value: V): Unit

    Permalink

    Sets the given value at the given index if the value is not equal to the current default.

    Sets the given value at the given index if the value is not equal to the current default. The data and index arrays will be grown to support the insertion if necessary. The growth schedule doubles the amount of allocated memory at each allocation request up until the sparse array contains 1024 values, at which point the growth is additive: an additional n * 1024 spaces will be allocated for n in 1,2,4,8,16. The largest amount of space added to this vector will be an additional 16*1024*(sizeof(Elem)+4), which is 196608 bytes at a time for a SparseVector[Double], although more space is needed temporarily while moving to the new arrays.

    Definition Classes
    SparseArrayArrayLike
    Annotations
    @inline()
  47. def use(index: Array[Int], data: Array[V], used: Int): Unit

    Permalink
  48. final def valueAt(i: Int): V

    Permalink

    same as data(i).

    same as data(i). Gives the value at the underlying offset.

    i

    index into the data array

    Definition Classes
    SparseArrayStorage
  49. def valuesIterator: Iterator[V]

    Permalink

    Only iterates "active" elements

    Only iterates "active" elements

    Definition Classes
    SparseArrayArrayLike
  50. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Storage[V]

Inherited from ArrayLike[V]

Inherited from AnyRef

Inherited from Any

Ungrouped