本文整理汇总了Python中helper.Helper.join方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.join方法的具体用法?Python Helper.join怎么用?Python Helper.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper.Helper
的用法示例。
在下文中一共展示了Helper.join方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_matrix_block
# 需要导入模块: from helper import Helper [as 别名]
# 或者: from helper.Helper import join [as 别名]
def compute_matrix_block(self, start_row, start_column, num_rows, num_columns):
"""
Computes a given block of the result matrix.
The method invoked by FEP nodes.
@param start_row: the index of the first row in the block
@param start_column: the index of the first column in the block
@param num_rows: number of rows in the block
@param num_columns: number of columns in the block
@return: the block of the result matrix encoded as a row-order list of lists of integers
"""
"""
This method is searching for the elements that this node needs in order to compute his block.
Firstly finds the node from where a element should be taken, starts a thread which will obtain the element, and then
puts that element in a matrix.
Those are made twice, for each matrix.
After calculating the two matrixes, the method 'multiply' gives the result that is returning the result.
"""
A = [[0 for i in range(self.matrix_size)] for j in range(num_rows)];
B = [[0 for j in range(num_columns)] for j in range(self.matrix_size)];
for i in range(num_rows):
for j in range(self.matrix_size):
row = start_row + i;
id_row = row / self.block_size;
id_column = j / self.block_size;
node = self.nodes[(self.matrix_size / self.block_size) * id_row + id_column];
i_a = node.node_ID[0];
j_a = node.node_ID[1];
size = node.block_size;
helper = Helper(node, row - i_a * size, j - j_a * size, "a");
helper.start();
helper.join();
A[i][j] = helper.element;
for i in range(self.matrix_size):
for j in range(num_columns):
column = start_column + j;
id_row = i / self.block_size;
id_column = column / self.block_size;
node = self.nodes[(self.matrix_size / self.block_size) * id_row + id_column];
i_b = node.node_ID[0];
j_b = node.node_ID[1];
size = node.block_size;
helper = Helper(node, i - i_b * size, column - j_b * size, "b");
helper.start();
helper.join();
B[i][j] = helper.element;
return self.multiply(A, B, num_rows, num_columns);