Esempio n. 1
0
def power(a: AbstractMatrix, b: B.Numeric):
    if structured(a):
        warn_upmodule(
            f"Taking an element-wise power of {a}: converting to dense.",
            category=ToDenseWarning,
        )
    return Dense(B.power(B.dense(a), b))
Esempio n. 2
0
def power(a: Kronecker, b: B.Numeric):
    return Kronecker(B.power(a.left, b), B.power(a.right, b))
Esempio n. 3
0
def power(a: UpperTriangular, b: B.Numeric):
    return UpperTriangular(B.power(a.mat, b))
Esempio n. 4
0
def power(a: Constant, b: B.Numeric):
    return Constant(B.power(a.const, b), a.rows, a.cols)
Esempio n. 5
0
def power(a: Diagonal, b: B.Numeric):
    return Diagonal(B.power(a.diag, b))
Esempio n. 6
0
 def __pow__(self, power, modulo=None):
     # TODO: Implement this.
     assert modulo is None, "Modulo in powers is not yet supported."
     return B.power(self, power)
Esempio n. 7
0
def power2(x):
    return B.power(x, 2)