scalation.linalgebra_gen

VectorN

class VectorN[T] extends PartiallyOrdered[VectorN[T]] with Error with Serializable

The VectorN class stores and operates on Numeric Vectors of various sizes and types. The element type may be any subtype of Numeric. Some methods only work for Fractional types. When/if Scala adds 'sqrt' and 'pow' to Fractional types the following methods will be implemented: ~, ~=, normalizeU.

Linear Supertypes
Serializable, Serializable, Error, PartiallyOrdered[VectorN[T]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. VectorN
  2. Serializable
  3. Serializable
  4. Error
  5. PartiallyOrdered
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new VectorN(u: VectorN[T])(implicit arg0: (T) ⇒ Ordered[T], arg1: ClassManifest[T], arg2: Numeric[T])

    Construct a vector and assign values from vector u.

    Construct a vector and assign values from vector u.

    u

    the other vector

  2. new VectorN(u: Array[T])(implicit arg0: (T) ⇒ Ordered[T], arg1: ClassManifest[T], arg2: Numeric[T])

    Construct a vector from an array of values.

    Construct a vector from an array of values.

    u

    the array of values

  3. new VectorN(dim: Int, v: Array[T] = null)(implicit arg0: (T) ⇒ Ordered[T], arg1: ClassManifest[T], arg2: Numeric[T])

    dim

    the dimension/size of the vector

    v

    the 1D array used to store vector elements

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. def *(m: Matrix[T]): VectorN[T]

    Multiply this 'row' vector by matrix m.

    Multiply this 'row' vector by matrix m.

    m

    the matrix to multiply by

  5. def *(b: VectorN[T]): VectorN[T]

    Multiply this vector by vector b.

    Multiply this vector by vector b.

    b

    the vector to multiply by

  6. def *(s: T): VectorN[T]

    Multiply this vector by scalar s.

    Multiply this vector by scalar s.

    s

    the scalar to multiply by

  7. def *=(s: T): VectorN[T]

    Multiply in-place this vector and scalar s.

    Multiply in-place this vector and scalar s.

    s

    the scalar to add

  8. def *=(b: VectorN[T]): VectorN[T]

    Multiply in-place this vector and vector b.

    Multiply in-place this vector and vector b.

    b

    the vector to add

  9. def +(s: (T, Int)): VectorN[T]

    Add this vector and scalar s.

    Add this vector and scalar s._1 only at position s._2.

    s

    the (scalar, position) to add

  10. def +(s: T): VectorN[T]

    Add this vector and scalar s.

    Add this vector and scalar s.

    s

    the scalar to add

  11. def +(b: VectorN[T]): VectorN[T]

    Add this vector and vector b.

    Add this vector and vector b.

    b

    the vector to add

  12. def ++(b: VectorN[T]): VectorN[T]

    Concatenate this vector and vector b.

    Concatenate this vector and vector b.

    b

    the vector to be concatenated

  13. def ++(b: T): VectorN[T]

    Concatenate this vector and scalar b.

    Concatenate this vector and scalar b.

    b

    the vector to be concatenated

  14. def +=(s: T): VectorN[T]

    Add in-place this vector and scalar s.

    Add in-place this vector and scalar s.

    s

    the scalar to add

  15. def +=(b: VectorN[T]): VectorN[T]

    Add in-place this vector and vector b.

    Add in-place this vector and vector b.

    b

    the vector to add

  16. def -(s: (T, Int)): VectorN[T]

    From this vector subtract scalar s.

    From this vector subtract scalar s._1 only at position s._2.

    s

    the (scalar, position) to subtract

  17. def -(s: T): VectorN[T]

    From this vector subtract scalar s.

    From this vector subtract scalar s.

    s

    the scalar to subtract

  18. def -(b: VectorN[T]): VectorN[T]

    From this vector subtract vector b.

    From this vector subtract vector b.

    b

    the vector to subtract

  19. def -=(s: T): VectorN[T]

    From this vector subtract in-place scalar s.

    From this vector subtract in-place scalar s.

    s

    the scalar to add

  20. def -=(b: VectorN[T]): VectorN[T]

    From this vector subtract in-place vector b.

    From this vector subtract in-place vector b.

    b

    the vector to add

  21. def /(s: T)(implicit fr: Fractional[T]): VectorN[T]

    Divide this vector by scalar s.

    Divide this vector by scalar s.

    s

    the scalar to divide by

  22. def /(b: VectorN[T])(implicit fr: Fractional[T]): VectorN[T]

    Divide this vector by vector b (element-by-element).

    Divide this vector by vector b (element-by-element).

    b

    the vector to divide by

  23. def /=(s: T)(implicit fr: Fractional[T]): VectorN[T]

    Divide in-place this vector and scalar s.

    Divide in-place this vector and scalar s.

    s

    the scalar to add

  24. def /=(b: VectorN[T])(implicit fr: Fractional[T]): VectorN[T]

    Divide in-place this vector and vector b.

    Divide in-place this vector and vector b.

    b

    the vector to add

  25. def <[B >: VectorN[T]](that: B)(implicit arg0: (B) ⇒ PartiallyOrdered[B]): Boolean

    Definition Classes
    PartiallyOrdered
  26. def <=[B >: VectorN[T]](that: B)(implicit arg0: (B) ⇒ PartiallyOrdered[B]): Boolean

    Definition Classes
    PartiallyOrdered
  27. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  29. def >[B >: VectorN[T]](that: B)(implicit arg0: (B) ⇒ PartiallyOrdered[B]): Boolean

    Definition Classes
    PartiallyOrdered
  30. def >=[B >: VectorN[T]](that: B)(implicit arg0: (B) ⇒ PartiallyOrdered[B]): Boolean

    Definition Classes
    PartiallyOrdered
  31. val _0: T

    Numeric zero (0)

  32. val _1: T

    Numeric one (1)

  33. val _1n: T

    Numeric minus one (-1)

  34. def _oneAt(j: Int, size: Int = dim): VectorN[T]

    Create a vector of the form (0, .

    Create a vector of the form (0, ... -1, ... 0) where the -1 is at position j.

    j

    the position to place the 1

    size

    the size of the vector (upper bound = size - 1)

  35. def abs: VectorN[T]

    Return the vector that is the element-wise absolute value of this vector.

  36. def apply(): Array[T]

    Get this vector's entire array.

  37. def apply(r: Range): VectorN[T]

    Get this vector's elements within the given range (vector slicing).

    Get this vector's elements within the given range (vector slicing).

    r

    the given range

  38. def apply(i: Int): T

    Get this vector's element at the i-th index position.

    Get this vector's element at the i-th index position.

    i

    the given index

  39. def argmax(e: Int = dim): Int

    Find the argument maximum of this vector (index of maximum element).

    Find the argument maximum of this vector (index of maximum element).

    e

    the ending index (exclusive) for the search

  40. def argmaxPos(e: Int = dim): Int

    Return the argument maximum of this vector (-1 if its not positive).

    Return the argument maximum of this vector (-1 if its not positive).

    e

    the ending index (exclusive) for the search

  41. def argmin(e: Int = dim): Int

    Find the argument minimum of this vector (index of minimum element).

    Find the argument minimum of this vector (index of minimum element).

    e

    the ending index (exclusive) for the search

  42. def argminNeg(e: Int = dim): Int

    Return the argument minimum of this vector (-1 if its not negative).

    Return the argument minimum of this vector (-1 if its not negative).

    e

    the ending index (exclusive) for the search

  43. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  44. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  45. def contains(x: T): Boolean

    Determine whether x is contained in this vector.

    Determine whether x is contained in this vector.

    x

    the element to be checked

  46. def countNeg: Int

    Count the number of strictly negative entries in this vector.

  47. def countPos: Int

    Count the number of strictly positive entries in this vector.

  48. def cumulate: VectorN[T]

    Cumulate the values of this vector from left to right (e.

    Cumulate the values of this vector from left to right (e.g., create a cdf from a pmf). Example: (4, 2, 3, 1) --> (4, 6, 9, 10)

  49. val dim: Int

    the dimension/size of the vector

  50. def dot(b: VectorN[T]): T

    Compute the dot product (or inner product) of this vector with vector b.

    Compute the dot product (or inner product) of this vector with vector b.

    b

    the other vector

  51. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  52. def equals(b: Any): Boolean

    Override equals to determine whether vector this equals vector b.

    Override equals to determine whether vector this equals vector b.

    b

    the vector to compare with this

    Definition Classes
    VectorN → AnyRef → Any
  53. def exists(pred: (T) ⇒ Boolean): Boolean

    Determine whether the predicate pred holds for some element in this vector.

    Determine whether the predicate pred holds for some element in this vector.

    pred

    the predicate to test (e.g., "_ == 5.")

  54. def expand(more: Int = dim): VectorN[T]

    Expand the size (dim) of this vector by 'more' elements.

  55. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  56. def firstNeg(e: Int = dim): Int

    Return the index of the first negative element in this vector (-1 otherwise).

    Return the index of the first negative element in this vector (-1 otherwise).

    e

    the ending index (exclusive) for the search

  57. def firstPos(e: Int = dim): Int

    Return the index of the first positive element in this vector (-1 otherwise).

    Return the index of the first positive element in this vector (-1 otherwise).

    e

    the ending index (exclusive) for the search

  58. def flaw(method: String, message: String): Unit

    Show the flaw by printing the error message.

    Show the flaw by printing the error message.

    method

    the method where the error occurred

    message

    the error message

    Definition Classes
    Error
  59. def foreach[U](f: (T) ⇒ U): Unit

    Iterate over the vector element by element.

    Iterate over the vector element by element.

    f

    the function to apply

  60. final def getClass(): java.lang.Class[_]

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

    Must also override hashCode to be be compatible with equals.

    Must also override hashCode to be be compatible with equals.

    Definition Classes
    VectorN → AnyRef → Any
  62. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  63. def isNonnegative: Boolean

    Check whether this vector is nonnegative (has no negative elements).

  64. def mag: T

    Find the element with the greatest magnitude in this vector.

  65. def max(b: VectorN[T]): VectorN[T]

    Take the maximum of this vector with vector b (element-by element).

    Take the maximum of this vector with vector b (element-by element).

    b

    the other vector

  66. def max(e: Int = dim): T

    Find the maximum element in this vector.

    Find the maximum element in this vector.

    e

    the ending index (exclusive) for the search

  67. def min(b: VectorN[T]): VectorN[T]

    Take the minimum of this vector with vector b (element-by element).

    Take the minimum of this vector with vector b (element-by element).

    b

    the other vector

  68. def min(e: Int = dim): T

    Find the minimum element in this vector.

    Find the minimum element in this vector.

    e

    the ending index (exclusive) for the search

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

    Definition Classes
    AnyRef
  70. def norm(implicit fr: Fractional[T]): Double

    Compute the Euclidean norm (2-norm) of this vector (requires Fractional type).

  71. def norm1: T

    Compute the Manhattan norm (1-norm) of this vector.

  72. def normSq: T

    Compute the Euclidean norm (2-norm) squared of this vector.

  73. def normalize(implicit fr: Fractional[T]): VectorN[T]

    Normalize this vector so that it sums to one (like a probability vector).

  74. def normalize1(implicit fr: Fractional[T]): VectorN[T]

    Normalize this vector to have a maximum of one.

  75. final def notify(): Unit

    Definition Classes
    AnyRef
  76. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  77. def oneAt(j: Int, size: Int = dim): VectorN[T]

    Create a vector of the form (0, .

    Create a vector of the form (0, ... 1, ... 0) where the 1 is at position j.

    j

    the position to place the 1

    size

    the size of the vector (upper bound = size - 1)

  78. def ramp(size: Int = dim): VectorN[T]

    Create a ramp-up vector of increasing values: 0, 1, 2, .

    Create a ramp-up vector of increasing values: 0, 1, 2, ..., size - 1.

    size

    the size of the vector (upper bound = size - 1)

  79. def sameDimensions(b: VectorN[T]): Boolean

    Check whether the other vector is at least as long as this vector.

    Check whether the other vector is at least as long as this vector.

    b

    the other vector

  80. def select(index: Array[Int]): VectorN[T]

    Select a subset of elements of this vector corresponding to a index/basis.

    Select a subset of elements of this vector corresponding to a index/basis.

    index

    the set of index positions (e.g., 0, 2, 5)

  81. def set(x: T): Unit

    Set each value in this vector to x.

    Set each value in this vector to x.

    x

    the value to be assigned

  82. def setAll(u: Array[T]): Unit

    Set the values in this vector to the values in array u.

    Set the values in this vector to the values in array u.

    u

    the array of values to be assigned

  83. def slice(from: Int, till: Int): VectorN[T]

    Slice this vector from to end.

    Slice this vector from to end.

    from

    the start of the slice (included)

    till

    the end of the slice (excluded)

  84. def sort(): Unit

    Sort this vector in-place in non-decreasing order.

  85. def sq: VectorN[T]

    Square each element of this vector.

  86. def sum: T

    Sum the elements of this vector.

  87. def sum_ne(i: Int): T

    Sum the elements of this vector skipping the i-th element.

    Sum the elements of this vector skipping the i-th element.

    i

    the index of the element to skip

  88. def sum_pos: T

    Sum the positive (> 0) elements of this vector.

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

    Definition Classes
    AnyRef
  90. def toDouble: VectorD

    Convert a VectorN [T] into a VectorN [Double] (VectorD).

  91. def toInt: VectorI

    Convert a VectorN [T] into a VectorN [Int] (VectorI).

  92. def toString(): String

    Convert this vector to a string.

    Convert this vector to a string.

    Definition Classes
    VectorN → AnyRef → Any
  93. def tryCompareTo[B >: VectorN[T]](b: B)(implicit arg0: (B) ⇒ PartiallyOrdered[B]): Option[Int]

    Compare this vector with vector b.

    Compare this vector with vector b.

    b

    the other vector

    Definition Classes
    VectorN → PartiallyOrdered
  94. def unary_-(): VectorN[T]

    Return the negative of this vector (unary minus).

  95. def update(r: Range, u: VectorN[T]): Unit

    Set this vector's elements over the given range (vector slicing).

    Set this vector's elements over the given range (vector slicing).

    r

    the given range

    u

    the vector to assign

  96. def update(r: Range, x: T): Unit

    Set this vector's elements over the given range (vector slicing).

    Set this vector's elements over the given range (vector slicing).

    r

    the given range

    x

    the value to assign

  97. def update(i: Int, x: T): Unit

    Set this vector's element at the i-th index position.

    Set this vector's element at the i-th index position.

    i

    the given index

    x

    the value to assign

  98. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Serializable

Inherited from Serializable

Inherited from Error

Inherited from PartiallyOrdered[VectorN[T]]

Inherited from AnyRef

Inherited from Any