本文整理汇总了Python中sage.tensor.modules.free_module_tensor.FreeModuleTensor.__mul__方法的典型用法代码示例。如果您正苦于以下问题:Python FreeModuleTensor.__mul__方法的具体用法?Python FreeModuleTensor.__mul__怎么用?Python FreeModuleTensor.__mul__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.tensor.modules.free_module_tensor.FreeModuleTensor
的用法示例。
在下文中一共展示了FreeModuleTensor.__mul__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __mul__
# 需要导入模块: from sage.tensor.modules.free_module_tensor import FreeModuleTensor [as 别名]
# 或者: from sage.tensor.modules.free_module_tensor.FreeModuleTensor import __mul__ [as 别名]
def __mul__(self, other):
r"""
Redefinition of
:meth:`~sage.tensor.modules.free_module_tensor.FreeModuleTensor.__mul__`
so that * dispatches either to automorphism composition or to the
tensor product.
EXAMPLES:
Automorphism composition::
sage: M = FiniteRankFreeModule(ZZ, 2, name='M')
sage: e = M.basis('e')
sage: a = M.automorphism([[1,2],[1,3]])
sage: b = M.automorphism([[3,4],[5,7]])
sage: s = a*b ; s
Automorphism of the Rank-2 free module M over the Integer Ring
sage: s.matrix()
[13 18]
[18 25]
sage: s.matrix() == a.matrix() * b.matrix()
True
sage: s(e[0]) == a(b(e[0]))
True
sage: s(e[1]) == a(b(e[1]))
True
sage: s.display()
13 e_0*e^0 + 18 e_0*e^1 + 18 e_1*e^0 + 25 e_1*e^1
Tensor product::
sage: c = M.tensor((1,1)) ; c
Type-(1,1) tensor on the Rank-2 free module M over the Integer Ring
sage: c[:] = [[3,4],[5,7]]
sage: c[:] == b[:] # c and b have the same components
True
sage: s = a*c ; s
Type-(2,2) tensor on the Rank-2 free module M over the Integer Ring
sage: s.display()
3 e_0*e_0*e^0*e^0 + 4 e_0*e_0*e^0*e^1 + 6 e_0*e_0*e^1*e^0
+ 8 e_0*e_0*e^1*e^1 + 5 e_0*e_1*e^0*e^0 + 7 e_0*e_1*e^0*e^1
+ 10 e_0*e_1*e^1*e^0 + 14 e_0*e_1*e^1*e^1 + 3 e_1*e_0*e^0*e^0
+ 4 e_1*e_0*e^0*e^1 + 9 e_1*e_0*e^1*e^0 + 12 e_1*e_0*e^1*e^1
+ 5 e_1*e_1*e^0*e^0 + 7 e_1*e_1*e^0*e^1 + 15 e_1*e_1*e^1*e^0
+ 21 e_1*e_1*e^1*e^1
"""
if isinstance(other, FreeModuleAutomorphism):
return self._mul_(other) # general linear group law
else:
return FreeModuleTensor.__mul__(self, other) # tensor product