本文整理汇总了Python中sage.tensor.modules.free_module_tensor.FreeModuleTensor.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FreeModuleTensor.__init__方法的具体用法?Python FreeModuleTensor.__init__怎么用?Python FreeModuleTensor.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.tensor.modules.free_module_tensor.FreeModuleTensor
的用法示例。
在下文中一共展示了FreeModuleTensor.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.tensor.modules.free_module_tensor import FreeModuleTensor [as 别名]
# 或者: from sage.tensor.modules.free_module_tensor.FreeModuleTensor import __init__ [as 别名]
def __init__(self, fmodule, degree, name=None, latex_name=None):
r"""
Initialize ``self``.
TESTS::
sage: from sage.tensor.modules.free_module_alt_form import FreeModuleAltForm
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: a = FreeModuleAltForm(M, 2, name='a')
sage: a[e,0,1] = 2
sage: TestSuite(a).run(skip="_test_category") # see below
In the above test suite, _test_category fails because a is not an
instance of a.parent().category().element_class. Actually alternating
forms must be constructed via ExtPowerDualFreeModule.element_class and
not by a direct call to FreeModuleAltForm::
sage: a1 = M.dual_exterior_power(2).element_class(M, 2, name='a')
sage: a1[e,0,1] = 2
sage: TestSuite(a1).run()
"""
FreeModuleTensor.__init__(self, fmodule, (0,degree), name=name,
latex_name=latex_name,
antisym=range(degree),
parent=fmodule.dual_exterior_power(degree))
示例2: __init__
# 需要导入模块: from sage.tensor.modules.free_module_tensor import FreeModuleTensor [as 别名]
# 或者: from sage.tensor.modules.free_module_tensor.FreeModuleTensor import __init__ [as 别名]
def __init__(self, fmodule, name=None, latex_name=None, is_identity=False):
r"""
TESTS::
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: from sage.tensor.modules.free_module_automorphism import FreeModuleAutomorphism
sage: a = FreeModuleAutomorphism(M, name='a')
sage: a[e,:] = [[-1,0,0],[0,1,2],[0,1,3]]
sage: TestSuite(a).run(skip="_test_category") # see below
In the above test suite, _test_category fails because a is not an
instance of a.parent().category().element_class. Actually automorphism
must be constructed via FreeModuleLinearGroup.element_class and
not by a direct call to FreeModuleAutomorphism::
sage: a = M.general_linear_group().element_class(M, name='a')
sage: a[e,:] = [[-1,0,0],[0,1,2],[0,1,3]]
sage: TestSuite(a).run()
Test suite on the identity map::
sage: id = M.general_linear_group().one()
sage: TestSuite(id).run()
Test suite on the automorphism obtained as GL.an_element()::
sage: b = M.general_linear_group().an_element()
sage: TestSuite(b).run()
"""
if is_identity:
if name is None:
name = 'Id'
if latex_name is None:
if name == 'Id':
latex_name = r'\mathrm{Id}'
else:
latex_name = name
FreeModuleTensor.__init__(self, fmodule, (1,1), name=name,
latex_name=latex_name,
parent=fmodule.general_linear_group())
# MultiplicativeGroupElement attributes:
# - none
# Local attributes:
self._is_identity = is_identity
self._inverse = None # inverse automorphism not set yet
self._matrices = {}