Пример #1
0
 def candidate_difference_squared(beta, index1, index2):
     B_betaJ, B_betaI, y_beta = calc_B_y_beta_selection(A,
                                                        y,
                                                        svdAAt_U,
                                                        svdAAt_S,
                                                        beta,
                                                        I=support,
                                                        J=[index1, index2])
     hit_candidates, used_signs = calc_hit_cand_selection(
         B_betaI, B_betaJ, y_beta, signum)
     return (hit_candidates[0] - hit_candidates[1])**2
Пример #2
0
 def get_substitute_for_last_entry_changed(beta):
     B_betaJ, B_betaI, y_beta = calc_B_y_beta_selection(
         A,
         y,
         svdAAt_U,
         svdAAt_S,
         beta,
         I=support,
         J=np.array([last_entry_changed]).astype('int'))
     return calc_hit_cand_selection(B_betaI,
                                    B_betaJ,
                                    y_beta,
                                    signum,
                                    prescribed_sign=sign_last_entry_changed)
Пример #3
0
 def candidate_difference_squared(beta, index1, index2):
     I_in_support = np.where(np.in1d(support, np.array([index1,
                                                        index2])))[0]
     J = np.setdiff1d([index1, index2], support[I_in_support])
     B_betaJ, B_betaI, y_beta = calc_B_y_beta_selection(A,
                                                        y,
                                                        svdAAt_U,
                                                        svdAAt_S,
                                                        beta,
                                                        I=support,
                                                        J=J)
     if index1 in support and index2 in support:
         candidates = calc_cross_cand_selection(B_betaI,
                                                y_beta,
                                                signum,
                                                indices=I_in_support)
     elif index1 in support:
         cross_cand = calc_cross_cand_selection(B_betaI,
                                                y_beta,
                                                signum,
                                                indices=I_in_support)
         hit_cand, used_signs = calc_hit_cand_selection(
             B_betaI, B_betaJ, y_beta, signum)
         candidates = [cross_cand, hit_cand]
     elif index2 in support:
         cross_cand = calc_cross_cand_selection(B_betaI,
                                                y_beta,
                                                signum,
                                                indices=I_in_support)
         hit_cand, used_signs = calc_hit_cand_selection(
             B_betaI, B_betaJ, y_beta, signum)
         candidates = [cross_cand, hit_cand]
     else:
         candidates, used_signs = calc_hit_cand_selection(
             B_betaI, B_betaJ, y_beta, signum)
     return (candidates[0] - candidates[1])**2