本文整理汇总了Python中vector.Vector.split方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.split方法的具体用法?Python Vector.split怎么用?Python Vector.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.split方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_quarters
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import split [as 别名]
def get_quarters(self):
'''
Get all 4 quarters of the matrix - get the left-right split
Then split each part into top and bottom
Return the 4 parts - topleft, topright, bottomleft, bottomright - in that order
'''
first_half_mat = []
second_half_mat = []
for vector in self.mat_values:
vector_obj6 = Vector(vector , zero_test = lambda x : (x == 0))
(first , last) = vector_obj6.split()
first_half_mat.append(first)
second_half_mat.append(last)
vector_obj7 = Vector(first_half_mat , zero_test = lambda x : (x == 0))
(topleft , topright) = vector_obj7.split()
vector_obj8 = Vector(first_half_mat , zero_test = lambda x : (x == 0))
(bottomleft , bottomright) = vector_obj8.split()
return topleft , topright , bottomleft , bottomright
开发者ID:Amit-Tomar,项目名称:Parametrized-String-Matching-Implementation-for-Software-Plagiarism-Check,代码行数:20,代码来源:IMT2013031_matrix.py
示例2: left_right_split
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import split [as 别名]
def left_right_split(self):
'''
Split the matrix into two halves - left and right - and return the two matrices
Split each row (use the split method of Vector) and put them together into the
left and right matrices
Use the make_matrix method for forming the new matrices
'''
first_half_mat = []
second_half_mat = []
for vector in self.rows:
vector_obj = Vector(vector, zero_test = lambda x : (x == 0))
(first , last) = vector_obj.split()
first_half_mat.append(first)
second_half_mat.append(last)
make_matrix(first_half_mat)
make_matrix(second_half_mat)
开发者ID:Amit-Tomar,项目名称:Parametrized-String-Matching-Implementation-for-Software-Plagiarism-Check,代码行数:18,代码来源:IMT2013031_matrix.py
示例3: left_right_split
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import split [as 别名]
def left_right_split(self):
'''
Split the matrix into two halves - left and right - and return the two matrices
Split each row (use the split method of Vector) and put them together into the
left and right matrices
Use the make_matrix method for forming the new matrices
'''
# Your Code
ref=0
mat_left=[]
mat_right=[]
var=len(self.row)
while(ref<var):
obj=Vector(self.row[ref],zero_test)
split=obj.split()
mat_left.append(make_matrix(split[0]))
mat_right.append(make_matrix(split[1]))
ref+=1
return mat_left,mat_right
开发者ID:Amit-Tomar,项目名称:Parametrized-String-Matching-Implementation-for-Software-Plagiarism-Check,代码行数:22,代码来源:IMT2013003_matrix.py