ordering.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:atomorder 作者: larsbratholm 项目源码 文件源码
def initialize_match_matrix(self):
        """
        Construct the initial match matrix.

        Returns:
        --------
        match_matrix: array
            The match matrix

        """
        # TODO add possibility for slack

        match_matrix = np.zeros((self.reactants_elements.size, self.products_elements.size))

        # set sub blocks of the match matrix to one plus random pertubation
        # followed by column normalization
        for indices in self.element_type_subset_indices:
            match_matrix[indices] = 1 + 1e-3 * np.random.random(match_matrix[indices].shape)
            match_matrix[indices] /= match_matrix[indices].sum(0)

        #match_matrix = np.eye(match_matrix.shape[0])
        #for i,j in [(0,0),(0,4),(1,1),(1,3),(4,0),(4,4),(3,3),(3,1),(7,7),(7,11),(8,8),(8,10),(20,20),(20,24),(21,21),(21,23),(11,7),(11,11),(10,8),(10,10),(24,20),(24,24),(23,23),(23,21)]:
        #    match_matrix[i,j] = 0.5

        return match_matrix
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号