package linalg

This package contains everything relating to Vectors, Matrices, Tensors, etc.

If you're doing basic work, you probably want breeze.linalg.DenseVector and breeze.linalg.DenseMatrix, which support most operations. We also have breeze.linalg.SparseVectors and (basic!) support for a sparse matrix (breeze.linalg.CSCMatrix).

This package object contains Matlab-esque functions for interacting with tensors and matrices.

Linear Supertypes
AnyRef, Any
  1. Alphabetic
  2. By inheritance
  1. linalg
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
  1. Public
  2. All

Type Members

  1. sealed trait Axis extends AnyRef

    This trait is commonly used for breeze.linalg.sum and its kin for summing along a particular axis of a Matrix.

  2. class BitVector extends Vector[Boolean] with VectorLike[Boolean, BitVector]

    TODO @ dwhl: What does enforceLength exactly do?

  3. trait Broadcasted[+T, B] extends NumericOps[Broadcasted[T, B]]


  4. case class BroadcastedColumns[T, B](underlying: T) extends BroadcastedLike[T, B, BroadcastedColumns[T, B]] with Product with Serializable

    Class for classes that are broadcasting their columns.

  5. trait BroadcastedLike[T, B, Self <: Broadcasted[T, B]] extends Broadcasted[T, B] with NumericOps[Self]

  6. case class BroadcastedRows[T, RowType](underlying: T) extends BroadcastedLike[T, RowType, BroadcastedRows[T, RowType]] with Product with Serializable

    Class for classes that are broadcasting their rows.

  7. class Broadcaster extends AnyRef

  8. class CSCMatrix[V] extends Matrix[V] with MatrixLike[V, CSCMatrix[V]] with Serializable

    A compressed sparse column matrix, as used in Matlab and CSparse, etc.

  9. trait Counter[K, V] extends Tensor[K, V] with CounterLike[K, V, Map[K, V], Counter[K, V]]

  10. trait Counter2[K1, K2, V] extends Tensor[(K1, K2), V] with Counter2Like[K1, K2, V, [V]Map[K1, V], Counter[K2, V], Counter2[K1, K2, V]]

  11. trait Counter2Like[K1, K2, V, +M1[VV] <: Map[K1, VV], +T <: Counter[K2, V], +This <: Counter2[K1, K2, V]] extends TensorLike[(K1, K2), V, This]

    A map-like tensor that acts like a collection of key-value pairs where the set of values may grow arbitrarily.

  12. trait CounterLike[K, V, +M <: Map[K, V], +This <: Counter[K, V]] extends TensorLike[K, V, This] with Serializable

    A map-like tensor that acts like a collection of key-value pairs where the set of values may grow arbitrarily.

  13. final class DenseMatrix[V] extends Matrix[V] with MatrixLike[V, DenseMatrix[V]] with Serializable

    A DenseMatrix is a matrix with all elements found in an array.

  14. class DenseVector[E] extends StorageVector[E] with VectorLike[E, DenseVector[E]] with Serializable

    A DenseVector is the "obvious" implementation of a Vector, with one twist.

  15. class HashVector[E] extends Vector[E] with VectorLike[E, HashVector[E]]

    A HashVector is a sparse vector backed by an OpenAddressHashArray

  16. trait LinearAlgebraException extends RuntimeException

    Marker trait for exceptions thrown from the breeze.linalg package.

  17. trait LowPriorityCounter2 extends AnyRef

  18. trait Matrix[E] extends MatrixLike[E, Matrix[E]]

  19. trait MatrixConstructors[Vec[T] <: Matrix[T]] extends AnyRef

  20. class MatrixEmptyException extends IllegalArgumentException with LinearAlgebraException

  21. trait MatrixLike[E, +Self <: Matrix[E]] extends Tensor[(Int, Int), E] with TensorLike[(Int, Int), E, Self]

  22. class MatrixNotSquareException extends IllegalArgumentException with LinearAlgebraException

  23. class MatrixNotSymmetricException extends IllegalArgumentException with LinearAlgebraException

  24. class MatrixSingularException extends RuntimeException with LinearAlgebraException

    Thrown when trying to solve using a singular matrix.

  25. class NormCacheDecorator[E] extends Vector[E]

    This decorator automatically caches the norm and sums of a vector and invalidates the cache whenever the vector is updated.

  26. class NotConvergedException extends RuntimeException with LinearAlgebraException

    Exception thrown if a routine has not converged.

  27. trait NumericOps[+This] extends AnyRef

    In some sense, this is the real root of the linalg hierarchy.

  28. sealed trait QuasiTensor[K, V] extends AnyRef

    We occasionally need a Tensor that doesn't extend NumericOps directly.

  29. implicit final class RichIntMethods extends AnyVal

    for adding slicing

  30. class SliceMatrix[K1, K2, V] extends Matrix[V]

  31. class SliceVector[K, V] extends Vector[V]

    A SliceVector is a vector that is a view of another underlying tensor.

  32. class SparseVector[E] extends StorageVector[E] with VectorLike[E, SparseVector[E]] with Serializable

    A Binary-search backed vector.

  33. trait StorageVector[E] extends Vector[E] with Storage[E]

  34. trait Tensor[K, V] extends TensorLike[K, V, Tensor[K, V]]

    A Tensor defines a map from an index set to a set of values.

  35. trait TensorLike[K, V, +This <: Tensor[K, V]] extends QuasiTensor[K, V] with NumericOps[This]

  36. trait Vector[E] extends VectorLike[E, Vector[E]]

    A Vector represents the mathematical concept of a vector in math.

  37. class VectorBuilder[E] extends NumericOps[VectorBuilder[E]] with Serializable

    A VectorBuilder is basically an unsorted Sparse Vector.

  38. trait VectorConstructors[Vec[T] <: Vector[T]] extends AnyRef

    Trait that can mixed to companion objects to enable utility methods for creating vectors.

  39. trait VectorLike[E, +Self <: Vector[E]] extends Tensor[Int, E] with TensorLike[Int, E, Self]

    Trait for operators and such used in vectors.

  40. trait VectorOps extends AnyRef

  41. sealed trait View extends AnyRef

    Trait used for methods that can return a view or a copy.

  42. trait diagLowPrio extends UFunc

  43. trait diagLowPrio2 extends UFunc with diagLowPrio

Value Members

  1. object * extends Broadcaster

  2. object Axis

  3. object BitVector extends BitVectorOps

  4. object BroadcastedColumns extends Serializable

  5. object BroadcastedRows extends Serializable

  6. object Broadcaster

  7. object CSCMatrix extends MatrixConstructors[CSCMatrix] with CSCMatrixOps with Serializable

  8. object Counter extends CounterOps with Serializable

  9. object Counter2 extends LowPriorityCounter2 with Counter2Ops

  10. object DenseMatrix extends LowPriorityDenseMatrix with DenseMatrixOps with DenseMatrixMultOps with DenseMatrixMultiplyStuff with MatrixConstructors[DenseMatrix] with Serializable

  11. object DenseVector extends VectorConstructors[DenseVector] with DenseVector_GenericOps with DenseVectorOps with DenseVector_OrderingOps with DenseVector_SpecialOps with Serializable

  12. object HashVector extends HashVectorOps with DenseVector_HashVector_Ops with HashVector_DenseVector_Ops with HashVector_SparseVector_Ops with SparseVector_HashVector_Ops

  13. object LU extends UFunc

    Computes the LU factorization of the given real M-by-N matrix X such that X = P * L * U where P is a permutation matrix (row exchanges).

  14. object Matrix extends MatrixConstructors[Matrix] with MatrixGenericOps with MatrixOpsLowPrio with MatrixOps with MatrixMultOps

  15. object MutableInnerProductSpaceDenseMatrixDouble

    Import this to provide access to a DenseMatrix[Double] as a MutableInnerProductSpace, so it can be used in optimization.

  16. object NormCacheDecorator

  17. object NotConvergedException extends Serializable

  18. object NumericOps

  19. object SparseVector extends SparseVectorOps with DenseVector_SparseVector_Ops with SparseVector_DenseVector_Ops with Serializable

  20. object Tensor

  21. object Vector extends VectorConstructors[Vector] with VectorOps

  22. object VectorBuilder extends VectorBuilderOps with Serializable

  23. object View

  24. object all extends UFunc

    Returns true if all elements are non-zero

  25. object any extends UFunc

    Returns true if any element is non-zero

  26. def axpy[A, X, Y](a: A, x: X, y: Y)(implicit axpy: CanAxpy[A, X, Y]): Unit

    Computes y += x * a, possibly doing less work than actually doing that operation

  27. object cholesky extends UFunc

    Computes the cholesky decomposition A of the given real symmetric positive definite matrix X such that X = A A.

  28. object clip extends UFunc

    clip(a, lower, upper) returns an array such that all elements are "clipped" at the range (lower, upper)

  29. def copy[T](t: T)(implicit canCopy: CanCopy[T]): T

    Copy a T.

    Copy a T. Most tensor objects have a CanCopy implicit, which is what this farms out to.

  30. def cross[V1](a: DenseVector[V1], b: DenseVector[V1])(implicit ring: Ring[V1], man: ClassTag[V1]): DenseVector[V1]

    Vector cross product of 3D vectors a and b.

  31. def csvread(file: File, separator: Char = ',', quote: Char = '"', escape: Char = '\\', skipLines: Int = 0): DenseMatrix[Double]

    Reads in a DenseMatrix from a CSV File

  32. def csvwrite(file: File, mat: Matrix[Double], separator: Char = ',', quote: Char = '\0', escape: Char = '\\', skipLines: Int = 0): Unit

  33. object det extends UFunc

    Computes the determinant of the given real matrix.

  34. object diag extends UFunc with diagLowPrio2

    returns a vector along the diagonal of v.

  35. object diff extends UFunc

    Differences between adjacent elements and discrete derivatives.

  36. object eig extends UFunc

    Eigenvalue decomposition (right eigenvectors)

  37. object eigSym extends UFunc

    Computes all eigenvalues (and optionally right eigenvectors) of the given real symmetric matrix X.

  38. object fliplr extends UFunc

    mirrors the columns (left<->right).

  39. object flipud extends UFunc

    mirrors the rows (up down)

  40. object inv extends UFunc

    Computes the inverse of a given real matrix.

  41. object kron extends UFunc

    Returns the Kronecker product of two matrices a and b, usually denoted a ⊗ b.

  42. def linspace(a: Double, b: Double, length: Int = 100): DenseVector[Double]

    Generates a vector of linearly spaced values between a and b (inclusive).

    Generates a vector of linearly spaced values between a and b (inclusive). The returned vector will have length elements, defaulting to 100.

  43. object logAndNormalize extends UFunc

  44. object logDiff extends UFunc

  45. object logNormalize extends UFunc

  46. def lowerTriangular[T](X: Matrix[T])(implicit arg0: Semiring[T], arg1: ClassTag[T], arg2: DefaultArrayValue[T]): DenseMatrix[T]

    The lower triangular portion of the given real quadratic matrix X.

    The lower triangular portion of the given real quadratic matrix X. Note that no check will be performed regarding the symmetry of X.

  47. object max extends UFunc

  48. object mean extends UFunc

    A breeze.generic.UFunc for computing the mean of objects

  49. object meanAndVariance extends UFunc

    A breeze.generic.UFunc for computing the mean and variance of objects.

  50. object min extends UFunc

    Computes the minimum.

  51. object mpow extends UFunc

    Raises m to the exp'th power via eigenvalue decomposition.

  52. object norm extends UFunc

    Computes the norm of an object.

  53. object normalize extends UFunc

    Normalizes the argument such that its norm is 1.

  54. package operators

  55. object pinv extends UFunc

    Computes the Moore-Penrose pseudo inverse of the given real matrix X.

  56. object product extends UFunc

    Computes the product

  57. object qr extends UFunc

    QR Factorization

  58. object qrp extends UFunc

    QR Factorization with pivoting

  59. object rank extends UFunc

    Computes the rank of a matrix.

  60. def ranks[V](x: Vector[V])(implicit arg0: Ordering[V]): Array[Double]

    Returns the rank of each element in the given vector, adjusting for ties.

  61. object reverse extends UFunc

    Returns a reversed copy of the DenseVector.

  62. object rot90 extends UFunc

    Rotates a matrix by 90 * k degrees counter clockwise.

  63. object softmax extends UFunc

    Computes the softmax (a.

  64. object stddev extends UFunc

    Computes the standard deviation by calling variance and then sqrt'ing

  65. object sum extends UFunc

  66. package support

  67. object svd extends UFunc

    Computes the SVD of a m by n matrix Returns an m*m matrix U, a vector of singular values, and a n*n matrix V'

  68. def upperTriangular[T](X: Matrix[T])(implicit arg0: Semiring[T], arg1: ClassTag[T], arg2: DefaultArrayValue[T]): DenseMatrix[T]

    The upper triangular portion of the given real quadratic matrix X.

    The upper triangular portion of the given real quadratic matrix X. Note that no check will be performed regarding the symmetry of X.

  69. object variance extends UFunc

    A breeze.generic.UFunc for computing the variance of objects.

Inherited from AnyRef

Inherited from Any