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


Python Matrix.rank方法代码示例

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


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

示例1: is_scalar_multiple

# 需要导入模块: from sympy.matrices import Matrix [as 别名]
# 或者: from sympy.matrices.Matrix import rank [as 别名]
 def is_scalar_multiple(p1, p2):
     """Returns whether `p1` and `p2` are scalar multiples
     of eachother.
     """
     # if the vectors p1 and p2 are linearly dependent, then they must
     # be scalar multiples of eachother
     m = Matrix([p1.args, p2.args])
     # XXX: issue #9480 we need `simplify=True` otherwise the
     # rank may be computed incorrectly
     return m.rank(simplify=True) < 2
开发者ID:peterstangl,项目名称:sympy,代码行数:12,代码来源:point.py

示例2: is_scalar_multiple

# 需要导入模块: from sympy.matrices import Matrix [as 别名]
# 或者: from sympy.matrices.Matrix import rank [as 别名]
    def is_scalar_multiple(self, p):
        """Returns whether each coordinate of `self` is a scalar
        multiple of the corresponding coordinate in point p.
        """
        s, o = Point._normalize_dimension(self, Point(p))
        # 2d points happen a lot, so optimize this function call
        if s.ambient_dimension == 2:
            (x1, y1), (x2, y2) = s.args, o.args
            rv = (x1*y2 - x2*y1).equals(0)
            if rv is None:
                raise Undecidable(filldedent(
                    '''can't determine if %s is a scalar multiple of
                    %s''' % (s, o)))

        # if the vectors p1 and p2 are linearly dependent, then they must
        # be scalar multiples of each other
        m = Matrix([s.args, o.args])
        return m.rank() < 2
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:20,代码来源:point.py

示例3: affine_rank

# 需要导入模块: from sympy.matrices import Matrix [as 别名]
# 或者: from sympy.matrices.Matrix import rank [as 别名]
    def affine_rank(*args):
        """The affine rank of a set of points is the dimension
        of the smallest affine space containing all the points.
        For example, if the points lie on a line (and are not all
        the same) their affine rank is 1.  If the points lie on a plane
        but not a line, their affine rank is 2.  By convention, the empty
        set has affine rank -1."""

        if len(args) == 0:
            return -1
        # make sure we're genuinely points
        # and translate every point to the origin
        points = Point._normalize_dimension(*[Point(i) for i in args])
        origin = points[0]
        points = [i - origin for i in points[1:]]

        m = Matrix([i.args for i in points])
        return m.rank()
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:20,代码来源:point.py


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