LU

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).

trait UFunc
trait HasOps
class Object
trait Matchable
class Any
LU.type

Type members

Classlikes

case class LU[M](P: M, L: M, U: M)
object primitive extends UFunc

Returns the raw lapack result, which is more memory efficient, but harder to work with.

Returns the raw lapack result, which is more memory efficient, but harder to work with.

Upon completion, a tuple consisting of a matrix A and an integer array P.

The upper triangular portion of A resembles U whereas the lower triangular portion of A resembles L up to but not including the diagonal elements of L which are all equal to 1.

For 0 <= i < M, each element P(i) denotes whether row i of the matrix X was exchanged with row P(i) - 1 during computation (the offset is caused by the internal call to LAPACK).

Types

type DenseLU[T] = LU[DenseMatrix[T]]

Inherited types

type Impl[V, VR] = UImpl[UFunc, V, VR]
Inherited from:
UFunc
type Impl2[V1, V2, VR] = UImpl2[UFunc, V1, V2, VR]
Inherited from:
UFunc
type Impl3[V1, V2, V3, VR] = UImpl3[UFunc, V1, V2, V3, VR]
Inherited from:
UFunc
type Impl4[V1, V2, V3, V4, VR] = UImpl4[UFunc, V1, V2, V3, V4, VR]
Inherited from:
UFunc
Inherited from:
UFunc
type InPlaceImpl2[V1, V2] = InPlaceImpl2[UFunc, V1, V2]
Inherited from:
UFunc
type InPlaceImpl3[V1, V2, V3] = InPlaceImpl3[UFunc, V1, V2, V3]
Inherited from:
UFunc
type SinkImpl[S, V] = SinkImpl[UFunc, S, V]
Inherited from:
UFunc
type SinkImpl2[S, V1, V2] = SinkImpl2[UFunc, S, V1, V2]
Inherited from:
UFunc
type SinkImpl3[S, V1, V2, V3] = SinkImpl3[UFunc, S, V1, V2, V3]
Inherited from:
UFunc

Value members

Concrete methods

def createPermutationMatrix[T : Semiring](ipiv: Array[Int], rows: Int, cols: Int): DenseMatrix[T]

Creates the permutation matrix from the IPIV (pivot) vector result from LAPACK Traditionally, the decomposition is represented as P * X = L * U Thus for a matrix with R rows and C columns, the matrix P should be of size RxR in order to preserve the original dimension of the matrix X.

Creates the permutation matrix from the IPIV (pivot) vector result from LAPACK Traditionally, the decomposition is represented as P * X = L * U Thus for a matrix with R rows and C columns, the matrix P should be of size RxR in order to preserve the original dimension of the matrix X.

Value parameters:
cols
  • The number of columns in the X matrix
ipiv
  • The pivot vector returned from LAPACK
rows
  • The number of rows in the X matrix
Returns:

The permutation matrix, P from the LU decomposition of the form (P * X = L * U) size RxR

def decompose[T : ClassTag](X: DenseMatrix[T], ipiv: Array[Int]): DenseLU[T]

Decomposes the output of the LAPACK LU decomposition

Decomposes the output of the LAPACK LU decomposition

Value parameters:
X
  • The packed upper/lower matrices from LAPACK
ipiv
  • The pivot vector from LAPACK
Returns:

(DenseMatrix, DenseMatrix, DenseMatrix) - Three matrices P, L, and U which give the original matrix when multiplied together i.e X, ipiv = LU(A), P, L, U = decompose(X, ipiv), P * L * U = A

Inherited methods

final def apply[V1, V2, V3, V4, VR](v1: V1, v2: V2, v3: V3, v4: V4)(implicit impl: Impl4[V1, V2, V3, V4, VR]): VR
Inherited from:
UFunc
final def apply[V1, @specialized(Int, Double, Float) V2, @specialized(Int, Double, Float) V3, @specialized(Int, Double, Float) VR](v1: V1, v2: V2, v3: V3)(implicit impl: Impl3[V1, V2, V3, VR]): VR
Inherited from:
UFunc
final def apply[@specialized(Int, Double, Float) V1, @specialized(Int, Double, Float) V2, @specialized(Int, Double, Float) VR](v1: V1, v2: V2)(implicit impl: Impl2[V1, V2, VR]): VR
Inherited from:
UFunc
final def apply[@specialized(Int, Double, Float) V, @specialized(Int, Double, Float) VR](v: V)(implicit impl: Impl[V, VR]): VR
Inherited from:
UFunc
final def inPlace[V, V2, V3](v: V, v2: V2, v3: V3)(implicit impl: InPlaceImpl3[LU.type, V, V2, V3]): V
Inherited from:
UFunc
final def inPlace[V, V2](v: V, v2: V2)(implicit impl: InPlaceImpl2[LU.type, V, V2]): V
Inherited from:
UFunc
final def inPlace[V](v: V)(implicit impl: InPlaceImpl[LU.type, V]): V
Inherited from:
UFunc
final def withSink[S](s: S): WithSinkHelp[LU.type, S]
Inherited from:
UFunc

Implicits

Implicits

implicit def fromPrimitiveDecomposition[T, U](implicit prim: Impl[DenseMatrix[T], (DenseMatrix[U], Array[Int])], ct: ClassTag[U], semi: Semiring[U]): Impl[DenseMatrix[T], DenseLU[U]]
implicit def fromPrimitiveDecompositionSimple[T](implicit prim: Impl[DenseMatrix[T], (DenseMatrix[T], Array[Int])], ct: ClassTag[T], semi: Semiring[T]): Impl[DenseMatrix[T], DenseLU[T]]