当前位置: 首页>>代码示例>>Python>>正文


Python LinearOperator.__call__方法代码示例

本文整理汇总了Python中scipy.sparse.linalg.LinearOperator.__call__方法的典型用法代码示例。如果您正苦于以下问题:Python LinearOperator.__call__方法的具体用法?Python LinearOperator.__call__怎么用?Python LinearOperator.__call__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.sparse.linalg.LinearOperator的用法示例。


在下文中一共展示了LinearOperator.__call__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeOperator

# 需要导入模块: from scipy.sparse.linalg import LinearOperator [as 别名]
# 或者: from scipy.sparse.linalg.LinearOperator import __call__ [as 别名]
def makeOperator( operatorInput, expectedShape ):
    """Internal. Takes a dense numpy array or a sparse matrix or
    a function and makes an operator performing matrix * blockvector
    products.

    Example
    -------

    >>> A = makeOperator( arrayA, (n, n) )
    >>> vectorB = A( vectorX )

    """
    if operatorInput is None:
        def ident(x):
            return x
        operator = LinearOperator(expectedShape, ident, matmat=ident)
    else:
        operator = aslinearoperator(operatorInput)

    if operator.shape != expectedShape:
        raise ValueError('operator has invalid shape')

    operator.__call__ = operator.matmat

    return operator
开发者ID:decarlin,项目名称:stuartlab-scripts,代码行数:27,代码来源:lobpcg.py

示例2: makeOperator

# 需要导入模块: from scipy.sparse.linalg import LinearOperator [as 别名]
# 或者: from scipy.sparse.linalg.LinearOperator import __call__ [as 别名]
def makeOperator( operatorInput, expectedShape ):
    """Internal. Takes a dense numpy array or a sparse matrix or
    a function and makes an operator performing matrix * blockvector
    products.

    Examples
    --------
    >>> A = makeOperator( arrayA, (n, n) )
    >>> vectorB = A( vectorX )

    """
    if operatorInput is None:
        def ident(x):
            return x
        operator = LinearOperator(expectedShape, ident, matmat=ident)
    else:
        operator = aslinearoperator(operatorInput)

    if operator.shape != expectedShape:
        raise ValueError('operator has invalid shape')

    if sys.version_info[0] >= 3:
        # special methods are looked up on the class -- so make a new one
        operator.__class__ = CallableLinearOperator
    else:
        operator.__call__ = operator.matmat

    return operator
开发者ID:gcasey,项目名称:scipy,代码行数:30,代码来源:lobpcg.py

示例3: Operator

# 需要导入模块: from scipy.sparse.linalg import LinearOperator [as 别名]
# 或者: from scipy.sparse.linalg.LinearOperator import __call__ [as 别名]
def Operator(f, size=None):
	"""Create a stacked version of the function f, casted as a LinearOperator.
	
	size is the dimension of the operator f."""
	
	if size == None: size = f.Size
	
	operator = LinearOperator((size,size), matvec = StackFunction(f), dtype=float64)
	operator.__call__ = lambda x: operator * x
	
	return operator
开发者ID:Haider-BA,项目名称:Implicit-Immersed-Boundary,代码行数:13,代码来源:KrylovFuncs.py


注:本文中的scipy.sparse.linalg.LinearOperator.__call__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。