LinearOpsTensorAlgebra

Common linear algebra operations. Operates on Tensor.

Parameters

T

the type of items closed under division in the tensors.

Inheritors

Functions

Link copied to clipboard
open override fun add(left: StructureND<T>, right: StructureND<T>): Tensor<T>
Link copied to clipboard
abstract fun StructureND<T>.argMax(dim: Int, keepDim: Boolean): Tensor<Int>

Returns the index of maximum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract fun StructureND<T>.argMin(dim: Int, keepDim: Boolean): Tensor<Int>

Returns the index of minimum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
open fun binaryOperation(operation: String, left: StructureND<T>, right: StructureND<T>): StructureND<T>
Link copied to clipboard
open override fun binaryOperationFunction(operation: String): (left: StructureND<T>, right: StructureND<T>) -> StructureND<T>
Link copied to clipboard
open fun bindSymbol(value: String): StructureND<T>
Link copied to clipboard
open fun bindSymbolOrNull(value: String): StructureND<T>?
Link copied to clipboard
abstract fun cholesky(structureND: StructureND<T>): StructureND<T>

Cholesky decomposition.

Link copied to clipboard
abstract fun StructureND<T>.det(): StructureND<T>

Computes the determinant of a square matrix input, or of each square matrix in a batched input. For more information: https://pytorch.org/docs/stable/linalg.html#torch.linalg.det

Link copied to clipboard
abstract fun diagonalEmbedding(diagonalEntries: StructureND<T>, offset: Int = 0, dim1: Int = -2, dim2: Int = -1): Tensor<T>

Creates a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) are filled by diagonalEntries. To facilitate creating batched diagonal matrices, the 2D planes formed by the last two dimensions of the returned tensor are chosen by default.

Link copied to clipboard
open operator fun StructureND<T>.div(k: Number): StructureND<T>

abstract operator override fun T.div(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is divided by this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.div(arg: T): Tensor<T>

Divide by the scalar arg each element of this tensor returns a new resulting tensor.

abstract operator override fun StructureND<T>.div(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is divided by each element of this tensor. The resulting tensor is returned.

Link copied to clipboard
abstract operator fun Tensor<T>.divAssign(value: T)

Divides by the scalar value each element of this tensor.

abstract operator fun Tensor<T>.divAssign(arg: StructureND<T>)

Each element of this tensor is divided by each element of the arg tensor.

Link copied to clipboard
open override fun divide(left: StructureND<T>, right: StructureND<T>): StructureND<T>
Link copied to clipboard
abstract infix fun StructureND<T>.dot(other: StructureND<T>): Tensor<T>

Matrix product of two tensors.

Link copied to clipboard
open fun export(arg: StructureND<T>): StructureND<T>
Link copied to clipboard
open fun <F : StructureFeature> getFeature(structure: StructureND<T>, type: KClass<out F>): F?
Link copied to clipboard
abstract fun Tensor<T>.getTensor(i: Int): Tensor<T>

Returns the tensor at index i For more information: https://pytorch.org/cppdocs/notes/tensor_indexing.html

open fun Tensor<T>.getTensor(first: Int, second: Int): Tensor<T>
Link copied to clipboard
abstract fun StructureND<T>.inv(): StructureND<T>

Computes the multiplicative inverse matrix of a square matrix input, or of each square matrix in a batched input. Given a square matrix A, return the matrix AInv satisfying A dot AInv == AInv dot A == eye(a.shape[0]). For more information: https://pytorch.org/docs/stable/linalg.html#torch.linalg.inv

Link copied to clipboard
open operator fun (T) -> T.invoke(structure: StructureND<T>): StructureND<T>
Link copied to clipboard
abstract fun lu(structureND: StructureND<T>): Triple<StructureND<T>, StructureND<T>, StructureND<T>>

LUP decomposition

Link copied to clipboard
open fun StructureND<T>.map(transform: A.(T) -> T): StructureND<T>
Link copied to clipboard
open fun StructureND<T>.mapIndexed(transform: A.(index: IntArray, T) -> T): StructureND<T>
Link copied to clipboard
abstract fun StructureND<T>.max(): T?

Returns the maximum value of all elements in the input tensor or null if there are no values

abstract fun StructureND<T>.max(dim: Int, keepDim: Boolean): Tensor<T>

Returns the maximum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract fun StructureND<T>.min(): T?

abstract fun StructureND<T>.min(dim: Int, keepDim: Boolean): Tensor<T>

Returns the minimum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract operator override fun T.minus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is subtracted from this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.minus(arg: T): Tensor<T>

Subtracts the scalar arg from each element of this tensor and returns a new resulting tensor.

abstract operator override fun StructureND<T>.minus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is subtracted from each element of this tensor. The resulting tensor is returned.

Link copied to clipboard
abstract operator fun Tensor<T>.minusAssign(value: T)

Subtracts the scalar value from each element of this tensor.

abstract operator fun Tensor<T>.minusAssign(arg: StructureND<T>)

Each element of the tensor arg is subtracted from each element of this tensor.

Link copied to clipboard
open override fun multiply(left: StructureND<T>, right: StructureND<T>): Tensor<T>
Link copied to clipboard
abstract operator override fun T.plus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is added to this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.plus(arg: T): Tensor<T>

Adds the scalar arg to each element of this tensor and returns a new resulting tensor.

abstract operator override fun StructureND<T>.plus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is added to each element of this tensor. The resulting tensor is returned.

Link copied to clipboard
abstract operator fun Tensor<T>.plusAssign(value: T)

Adds the scalar value to each element of this tensor.

abstract operator fun Tensor<T>.plusAssign(arg: StructureND<T>)

Each element of the tensor arg is added to each element of this tensor.

Link copied to clipboard
abstract fun qr(structureND: StructureND<T>): Pair<StructureND<T>, StructureND<T>>

QR decomposition.

Link copied to clipboard
open override fun scale(a: StructureND<T>, value: Double): StructureND<T>
Link copied to clipboard
abstract fun structureND(shape: ShapeND, initializer: A.(IntArray) -> T): StructureND<T>
Link copied to clipboard
abstract fun StructureND<T>.sum(): T

abstract fun StructureND<T>.sum(dim: Int, keepDim: Boolean): Tensor<T>

Returns the sum of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract fun svd(structureND: StructureND<T>): Triple<StructureND<T>, StructureND<T>, StructureND<T>>

Singular Value Decomposition.

Link copied to clipboard
abstract fun symEig(structureND: StructureND<T>): Pair<StructureND<T>, StructureND<T>>

Returns eigenvalues and eigenvectors of a real symmetric matrix input or a batch of real symmetric matrices, represented by a pair eigenvalues to eigenvectors. For more information: https://pytorch.org/docs/stable/generated/torch.symeig.html

Link copied to clipboard
open operator fun Number.times(arg: StructureND<T>): StructureND<T>
open operator fun StructureND<T>.times(k: Number): StructureND<T>

abstract operator override fun T.times(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is multiplied by this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.times(arg: T): Tensor<T>

Multiplies the scalar arg by each element of this tensor and returns a new resulting tensor.

abstract operator override fun StructureND<T>.times(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is multiplied by each element of this tensor. The resulting tensor is returned.

Link copied to clipboard
abstract operator fun Tensor<T>.timesAssign(value: T)

Multiplies the scalar value by each element of this tensor.

abstract operator fun Tensor<T>.timesAssign(arg: StructureND<T>)

Each element of the tensor arg is multiplied by each element of this tensor.

Link copied to clipboard
abstract fun StructureND<T>.transposed(i: Int = shape.size - 2, j: Int = shape.size - 1): Tensor<T>

Returns a tensor that is a transposed version of this tensor. The given dimensions i and j are swapped. For more information: https://pytorch.org/docs/stable/generated/torch.transpose.html

Link copied to clipboard
abstract operator override fun StructureND<T>.unaryMinus(): Tensor<T>

Numerical negative, element-wise.

Link copied to clipboard
open fun unaryOperation(operation: String, arg: StructureND<T>): StructureND<T>
Link copied to clipboard
open override fun unaryOperationFunction(operation: String): (arg: StructureND<T>) -> StructureND<T>
Link copied to clipboard
open operator fun StructureND<T>.unaryPlus(): StructureND<T>
Link copied to clipboard
open fun StructureND<T>.value(): T

Returns a single tensor value of unit dimension. The tensor shape must be equal to 1.

Link copied to clipboard
abstract fun StructureND<T>.valueOrNull(): T?

Returns a single tensor value of unit dimension if tensor shape equals to 1.

Link copied to clipboard
abstract fun Tensor<T>.view(shape: ShapeND): Tensor<T>

Returns a new tensor with the same data as the self tensor but of a different shape. The returned tensor shares the same data and must have the same number of elements, but may have a different size For more information: https://pytorch.org/docs/stable/tensor_view.html

Link copied to clipboard
abstract fun Tensor<T>.viewAs(other: StructureND<T>): Tensor<T>

View this tensor as the same size as other. this.viewAs(other) is equivalent to this.view(other.shape). For more information: https://pytorch.org/cppdocs/notes/tensor_indexing.html

Link copied to clipboard
open fun zip(left: StructureND<T>, right: StructureND<T>, transform: A.(T, T) -> T): StructureND<T>

Properties

Link copied to clipboard
Link copied to clipboard
abstract val elementAlgebra: A