module Bottle::LinAlg
Direct including types
Defined in:
linalg/fixed_dimension.crlinalg/reductions.cr
Instance Method Summary
- #dot(a : BaseArray(U), b : BaseArray(U)) forall U
-
#dot1d(dx : BaseArray(Float64), dy : BaseArray(Float64))
Dot product of two
Tensor
s. -
#dot1d(dx : BaseArray(Float32), dy : BaseArray(Float32))
Dot product of two
Tensor
s. -
#inner(dx : BaseArray(Float64), dy : BaseArray(Float64))
Inner product of two
Tensor
s without the complex conjugate. -
#inner(dx : BaseArray(Float32), dy : BaseArray(Float32))
Inner product of two
Tensor
s without the complex conjugate. - #inv(t : BaseArray)
-
#inv_helper(a : BaseArray(Float64))
Compute the (multiplicative) inverse of a `Matrix.
-
#inv_helper(a : BaseArray(Float32))
Compute the (multiplicative) inverse of a `Matrix.
- #matmul(dx : BaseArray(Float64), dy : BaseArray(Float64), dest : BaseArray(Float64))
- #matmul(dx : BaseArray(Float32), dy : BaseArray(Float32), dest : BaseArray(Float32))
-
#matmul(dx : BaseArray(Float64), dy : BaseArray(Float64))
Computes the Matrix product of two matrices.
-
#matmul(dx : BaseArray(Float32), dy : BaseArray(Float32))
Computes the Matrix product of two matrices.
- #matmul_helper(dx : BaseArray(Float64), dy : BaseArray(Float64), dest : BaseArray(Float64))
- #matmul_helper(dx : BaseArray(Float32), dy : BaseArray(Float32), dest : BaseArray(Float32))
-
#norm(x : Tensor(Float64))
Returns the euclidean norm of a vector via the function name, so that
-
#norm(x : Tensor(Float32))
Returns the euclidean norm of a vector via the function name, so that
-
#outer(dx : BaseArray(Float64), dy : BaseArray(Float64))
Compute the outer product of two
Tensor
s. -
#outer(dx : BaseArray(Float32), dy : BaseArray(Float32))
Compute the outer product of two
Tensor
s. - #validate_matrix_shape(dx, dy)
Macro Summary
Instance Method Detail
Dot product of two Tensor
s. Specifically, this is the inner
product of two Tensor
s without the complex conjugate.
t = Tensor.new [1.0, 2.0, 3.0]
dot(t, t) # => 14.0
Dot product of two Tensor
s. Specifically, this is the inner
product of two Tensor
s without the complex conjugate.
t = Tensor.new [1.0, 2.0, 3.0]
dot(t, t) # => 14.0
Inner product of two Tensor
s without the complex conjugate.
t = Tensor.new [1.0, 2.0, 3.0]
inner(t, t) # => 14.0
Inner product of two Tensor
s without the complex conjugate.
t = Tensor.new [1.0, 2.0, 3.0]
inner(t, t) # => 14.0
Compute the (multiplicative) inverse of a `Matrix.
Given a square matrix a, return the matrix ainv satisfying dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]).
m = Matrix.new [[1.0, 2.0], [3.0, 4.0]]
inv(m)
# Matrix[[ -2.0 1.0]
# [ 1.5 -0.5]]
Compute the (multiplicative) inverse of a `Matrix.
Given a square matrix a, return the matrix ainv satisfying dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]).
m = Matrix.new [[1.0, 2.0], [3.0, 4.0]]
inv(m)
# Matrix[[ -2.0 1.0]
# [ 1.5 -0.5]]
Computes the Matrix product of two matrices.
m = Matrix.new [[1.0, 2.0], [3.0, 4.0]]
matmul(m, m)
# Matrix[[ 7.0 10.0]
# [ 15.0 22.0]]
Computes the Matrix product of two matrices.
m = Matrix.new [[1.0, 2.0], [3.0, 4.0]]
matmul(m, m)
# Matrix[[ 7.0 10.0]
# [ 15.0 22.0]]
Returns the euclidean norm of a vector via the function name, so that
norm(x) := sqrt( x'*x )
t = Tensor.new [1.0, 2.0, 3.0]
norm(t) # => 3.7416573867739413
Returns the euclidean norm of a vector via the function name, so that
norm(x) := sqrt( x'*x )
t = Tensor.new [1.0, 2.0, 3.0]
norm(t) # => 3.7416573867739413
Compute the outer product of two Tensor
s.
Given two vectors, a = [a0, a1, ..., aM]
and
b = [b0, b1, ..., bN]
, the outer product is:
# [[a0*b0 a0*b1 ... a0*bN ]
# [a1*b0 .
# [ ... .
# [aM*b0 aM*bN ]]
Compute the outer product of two Tensor
s.
Given two vectors, a = [a0, a1, ..., aM]
and
b = [b0, b1, ..., bN]
, the outer product is:
# [[a0*b0 a0*b1 ... a0*bN ]
# [a1*b0 .
# [ ... .
# [aM*b0 aM*bN ]]