module Bottle::BMath

Extended Modules

Direct including types

Defined in:

arrayops/math.cr

Instance Method Summary

Macro Summary

Instance Method Detail

def add(x1 : BaseArray, x2 : BaseArray) forall U #

adds two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.add(t1, t2)

[View source]
def add(x1 : BaseArray, x2 : Number) #

adds a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.add(t1, t2)

[View source]
def add(x1 : Number, x2 : BaseArray) #

adds a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.add(x, t)

[View source]
def add #

Returns the universal add function. Used to apply outer operations, reductions, and accumulations to tensors

B.add # => add


[View source]
def divide(x1 : BaseArray, x2 : BaseArray) forall U #

divides two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.divide(t1, t2)

[View source]
def divide(x1 : BaseArray, x2 : Number) #

divides a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.divide(t1, t2)

[View source]
def divide(x1 : Number, x2 : BaseArray) #

divides a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.divide(x, t)

[View source]
def divide #

Returns the universal divide function. Used to apply outer operations, reductions, and accumulations to tensors

B.divide # => divide


[View source]
def equal(x1 : BaseArray, x2 : BaseArray) forall U #

equals two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.equal(t1, t2)

[View source]
def equal(x1 : BaseArray, x2 : Number) #

equals a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.equal(t1, t2)

[View source]
def equal(x1 : Number, x2 : BaseArray) #

equals a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.equal(x, t)

[View source]
def equal #

Returns the universal equal function. Used to apply outer operations, reductions, and accumulations to tensors

B.equal # => equal


[View source]
def floordiv(x1 : BaseArray, x2 : BaseArray) forall U #

floordivs two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.floordiv(t1, t2)

[View source]
def floordiv(x1 : BaseArray, x2 : Number) #

floordivs a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.floordiv(t1, t2)

[View source]
def floordiv(x1 : Number, x2 : BaseArray) #

floordivs a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.floordiv(x, t)

[View source]
def floordiv #

Returns the universal floordiv function. Used to apply outer operations, reductions, and accumulations to tensors

B.floordiv # => floordiv


[View source]
def greater(x1 : BaseArray, x2 : BaseArray) forall U #

greaters two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.greater(t1, t2)

[View source]
def greater(x1 : BaseArray, x2 : Number) #

greaters a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.greater(t1, t2)

[View source]
def greater(x1 : Number, x2 : BaseArray) #

greaters a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.greater(x, t)

[View source]
def greater #

Returns the universal greater function. Used to apply outer operations, reductions, and accumulations to tensors

B.greater # => greater


[View source]
def greater_equal(x1 : BaseArray, x2 : BaseArray) forall U #

greater_equals two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.greater_equal(t1, t2)

[View source]
def greater_equal(x1 : BaseArray, x2 : Number) #

greater_equals a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.greater_equal(t1, t2)

[View source]
def greater_equal(x1 : Number, x2 : BaseArray) #

greater_equals a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.greater_equal(x, t)

[View source]
def greater_equal #

Returns the universal greater_equal function. Used to apply outer operations, reductions, and accumulations to tensors

B.greater_equal # => greater_equal


[View source]
def less(x1 : BaseArray, x2 : BaseArray) forall U #

lesss two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.less(t1, t2)

[View source]
def less(x1 : BaseArray, x2 : Number) #

lesss a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.less(t1, t2)

[View source]
def less(x1 : Number, x2 : BaseArray) #

lesss a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.less(x, t)

[View source]
def less #

Returns the universal less function. Used to apply outer operations, reductions, and accumulations to tensors

B.less # => less


[View source]
def less_equal(x1 : BaseArray, x2 : BaseArray) forall U #

less_equals two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.less_equal(t1, t2)

[View source]
def less_equal(x1 : BaseArray, x2 : Number) #

less_equals a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.less_equal(t1, t2)

[View source]
def less_equal(x1 : Number, x2 : BaseArray) #

less_equals a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.less_equal(x, t)

[View source]
def less_equal #

Returns the universal less_equal function. Used to apply outer operations, reductions, and accumulations to tensors

B.less_equal # => less_equal


[View source]
def modulo(x1 : BaseArray, x2 : BaseArray) forall U #

modulos two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.modulo(t1, t2)

[View source]
def modulo(x1 : BaseArray, x2 : Number) #

modulos a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.modulo(t1, t2)

[View source]
def modulo(x1 : Number, x2 : BaseArray) #

modulos a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.modulo(x, t)

[View source]
def modulo #

Returns the universal modulo function. Used to apply outer operations, reductions, and accumulations to tensors

B.modulo # => modulo


[View source]
def multiply(x1 : BaseArray, x2 : BaseArray) forall U #

multiplys two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.multiply(t1, t2)

[View source]
def multiply(x1 : BaseArray, x2 : Number) #

multiplys a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.multiply(t1, t2)

[View source]
def multiply(x1 : Number, x2 : BaseArray) #

multiplys a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.multiply(x, t)

[View source]
def multiply #

Returns the universal multiply function. Used to apply outer operations, reductions, and accumulations to tensors

B.multiply # => multiply


[View source]
def power(x1 : BaseArray, x2 : BaseArray) forall U #

powers two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.power(t1, t2)

[View source]
def power(x1 : BaseArray, x2 : Number) #

powers a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.power(t1, t2)

[View source]
def power(x1 : Number, x2 : BaseArray) #

powers a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.power(x, t)

[View source]
def power #

Returns the universal power function. Used to apply outer operations, reductions, and accumulations to tensors

B.power # => power


[View source]
def subtract(x1 : BaseArray, x2 : BaseArray) forall U #

subtracts two tensors with each other elementwise

t1 = Tensor.new [1, 2, 3]
t2 = Tensor.new [4, 5, 6]

B.subtract(t1, t2)

[View source]
def subtract(x1 : BaseArray, x2 : Number) #

subtracts a tensor with a scalar elementwise.

t1 = Tensor.new [1, 2, 3]
t2 = 5

B.subtract(t1, t2)

[View source]
def subtract(x1 : Number, x2 : BaseArray) #

subtracts a scalar with a tensor elementwise.

x = 5
t = Tensor.new [1, 2, 3]

B.subtract(x, t)

[View source]
def subtract #

Returns the universal subtract function. Used to apply outer operations, reductions, and accumulations to tensors

B.subtract # => subtract


[View source]

Macro Detail

macro ufunc(operator, name) #

[View source]