本文整理汇总了Python中Matrix.matrix方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.matrix方法的具体用法?Python Matrix.matrix怎么用?Python Matrix.matrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix
的用法示例。
在下文中一共展示了Matrix.matrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddParseResults
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import matrix [as 别名]
def AddParseResults(self, tokenList, POSList, conTree, depTokenPos, depGraph):
try:
self.parseResult = Matrix.matrix(tokenList)
self.parseResult.add_row(self.__alignTokensToOrigSent(tokenList))
self.parseResult.add_row(POSList)
except:
print >> sys.stderr, "token"
raise
# conTree -> nltk.tree.ParentedTree
# parseResut[CON] row contains treepositions of the leaves
try:
self.conTree = conTree
self.parseResult.add_row(conTree.treepositions('leaves'))
except:
print >> sys.stderr, "con"
raise
# depGraph -> pygraph.classes.digraph
# parseResult[DEP] row contains identifiers of the leaves
try:
self.depGraph = depGraph
self.parseResult.add_row(self.__GenerateConMatchingDep(depTokenPos))
except:
print >> sys.stderr, "dep"
raise
示例2: Schet
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import matrix [as 别名]
def Schet(self):
col = int(self.ui.lineEdit.text())
a = Matrix.matrix(col,col)
for i in range(col):
for j in range(col):
a.set_value(i,j,self.ui.tableWidget.item(i,j).text())
if a.determinant() :
b = a.Gauss_Jordan_inverse()
for i in range(col):
for j in range(col):
self.ui.tableWidget_2.setItem(i,j,QtGui.QTableWidgetItem(str(b[i][j])))
示例3:
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import matrix [as 别名]
#!usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'avezhenya'
import Matrix
b = Matrix.matrix(3,3)
b.set_value(0,0,-4)
b.set_value(0,1,3)
b.set_value(0,2,6)
b.set_value(1,0,5)
b.set_value(1,1,-10)
b.set_value(1,2,4)
b.set_value(2,0,-9)
b.set_value(2,1,-1)
b.set_value(2,2,1)
print b.determinant()
b.Gauss_Jordan_inverse()
b.show_Matrix()