Matching several indexes

I have a large set of data in which I need to compare several samples in different tests and under varying conditions. I am looking for a way to pair and analyze these easily. As an example, lets say I have Samples (S) a, b, and c, which undergo tests (T) 1 and 2, under conditions (C) x, y and z, which output results (R) R1 and R2.

S   T   C   R1  R2 a   1   x   2.9 a   1   y   2.6 a   1   z   8.7 a   2   x   9.4 0.372 a   2   y   8.1 0.208 a   2   z   7.6 0.154 b   1   x   7.5 b   1   y   7.3 b   1   z   1.7 b   2   x   3.9 0.213 b   2   y   7.9 0.435 b   2   z   2.5 0.294 c   1   x   6.2 c   1   y   1.8 c   1   z   6.3 c   2   x   1.5 0.246 c   2   y   6.0 0.496 c   2   z   1.7 0.167 

The tests have different outputs, and I need to apply specific functions depending on the test. Such as:

Test1[a,b] = R1a/R1b Test2[a,b] = R1a/R2a - R1b/R2b 

The tests should only be applied to samples with matching conditions, but each sample should be paired. So a result would be:

S1  S2  T   C   R a   b   1   x   2.9/7.5 a   c   1   x   2.9/6.2 a   b   2   x   9.4/0.372-3.9/0.213 a   c   2   x   9.4/0.372-1.5/0.246 a   b   1   y   2.6/7.3 ... 

I’ve been trying to get this right for a while and just end up confusing myself. Anyone have a solution or suggestions? If you want an easily copyable format of the example:


Must I two-weapon fight with different weapon types or can they be matching?

I think I’m clear on two-weapon fighting (thanks to Two-Weapon Fighting & Bonus Action in 5e) except for one thing. The PHB says (p. 195):

When you take the Attack action and attack with a light melee weapon that you’re holding in one hand, you can use a bonus action to attack with a different light melee weapon that you’re holding in the other hand. [emphasis mine]

Does a “different” weapon mean a different type of weapon, or just a different physical instance of a weapon? In other words, can I fight with two shortswords (one in each hand), or would I have to use a dagger or some other type of light weapon in my off hand?

No route was found matching the URL and request method. I don’t understand where the problem is

When I send parameters, I get this: No route was found matching the URL and request method.

/**   * Add json data on plugin.  *   * */ add_action('rest_api_init', 'register_api_hooks'); function register_api_hooks() {   register_rest_route(     'passwordless_register/v0', '/register/(?P<name>[a-zA-Z0-9-]+)/(?P<email>[a-zA-Z0-9-]+)/?aam-jwt=(?P<token>[a-zA-Z0-9-]+)',     array(       'methods'  => 'POST',       'callback' => 'wc_rest_user_endpoint_handler',     )   ); }  /**  * Register a new user  *  * @param  WP_REST_Request $  request Full details about the request.  * @return array $  args.  **/ function wc_rest_user_endpoint_handler($  request) {   $  request = new WP_REST_Request( 'POST', 'passwordless_register/v0/register/(?P<name>[a-zA-Z0-9-]+)/(?P<email>[a-zA-Z0-9-]+)/?aam-jwt=(?P<token>[a-zA-Z0-9-]+)' );   $  username = $  request['name'];   $  email = $  request['email'];   $  response = array();   $  error = new WP_Error();   if (empty($  username)) {     $  error->add(400, __("name field 'username' is required.", 'wp-rest-user'), array('status' => 400));     return $  error;   }   if (empty($  email)) {     $  error->add(401, __("Email field 'email' is required.", 'wp-rest-user'), array('status' => 400));     return $  error;   }   $  user_id = username_exists($  username);   if (!$  user_id && email_exists($  email) == false) {       $  password = wp_generate_password( 20, false );     $  user_id = wp_create_user($  username, $  password, $  email);     if (!is_wp_error($  user_id)) {       // Ger User Meta Data (Sensitive, Password included. DO NOT pass to front end.)       $  user = get_user_by('id', $  user_id);       // $  user->set_role($  role);       $  user->set_role('subscriber');       // WooCommerce specific code       if (class_exists('WooCommerce')) {         $  user->set_role('customer');       }       // Ger User Data (Non-Sensitive, Pass to front end.)       wp_nonce_field( 'wpa_passwordless_login_request', 'nonce', false );       $  unique_url = wpa_generate_url( $  email , $  nonce );       $  response['code'] = 200;       $  response['message'] = __("User '" . $  username . "' Registration was Successful", "wp-rest-user");       $  response['mail'] = __("Mail '" . $  email . "' Registration was Successful", "wp-rest-email");       $  response['password'] =  __("Pass '" . $  password . "' Registration was Successful", "wp-rest-pass");       $  response['url'] =  __("Link '" . $  unique_url . "' Registration was Successful", "wp-rest-url");     } else {       return $  user_id;     }   } else {     $  error->add(406, __("Email already exists, please try 'Reset Password'", 'wp-rest-user'), array('status' => 400));     return $  error;   }   return new WP_REST_Response($  response, 123);           } add_action( 'after_setup_theme', 'passwordless_register/v0' ); 

SSL not working fine, Home url not matching with site url wordpress errors

I deployed WordPress through Bitnami so after adding an SSL certification I started getting warnings from my WordPress dashboard of my site URL not matching with Home URL I was directed to my WordPress settings To reset back to instead of http but I saw that I could not do that on the my settings, I had to login my Myphpadmin to do it there but WP-OPTION still has the correct URL which is but still not reflecting on my WordPress

My problem now is why is the URL on my WordPress General settings is instead of and still cannot be changed from there or why is the site URL on my wp-option not same with the one on my WordPress General settings.

Thank you

Combinatorial Problem similar in nature to a special version of max weighted matching problem

I have a problem and want to know if there is any combinatorial optimization that is similar in nature to this problem or how to solve this special version of the max weight matching problem.

I have a general graph $ G(\mathcal{V},\mathcal{E},\mathcal{W})$ . I want to find a maximum weight matching of the graph $ G$ that must cover a certain subset of vertices and has a specific size. For example, if I have a graph with eight vertices, I want to find a max weighted matching that must cover the subset of vertices $ \mathcal{V}’=\{1,2,3\}$ and the size of the matching is $ \lceil{|\mathcal{V}’|/2}\rceil$ . So one more vertex needs to be chosen that maximizes the weighted matching. How to find the optimal solution in polynomial time if possible?

Why Burrow’s Wheeler Matching (FM-Index) is favored for DNA read matching

I noticed that FM-indexing is a preferred way to match strings in large data sets, and in particular DNA sequencing wiki-article. I know that with this method, it can eliminate space dependencies thanks to compression methods. However, alternatives like Knuth-Morris-Pratt Algorithm or Rabin-karp are highly effective in terms of extra space complexity with $ O(|Pattern| + 1)$ and $ O(1)$ respectively. These, are the complexity that would take if I were to code them so there might be better ways.

Overall, Burrows-Wheeler transform doesn’t do all that much both in terms of time and space. So why is it favored? My current assumption is that it can be modified to do approximate pattern matching. Does that imply Rabin-karp or KMP cannot be modified to efficiently calculate approximate matches?

leetcode 10. Regular Expression Matching edge cases

Please tell me how to deal with edge case such as s:"aa", p:"a*"in else if (p[j] == '*') branch. One way I know is to increase the size of dp like vector<vector<bool>> dp(s.size() + 1, vector<bool>(p.size() + 1, false) ); However, in that case the index of dp will not be the same with the index of for loop.

The problem is as follows:
Given an input string (s) and a pattern (p), implement regular expression matching with support for ‘.’ and ‘*’.

'.' Matches any single character. '*' Matches zero or more of the preceding element. 

The matching should cover the entire input string (not partial).

Here is the code:

class Solution { public:     bool isMatch(string s, string p) {         vector<vector<bool>> dp(s.size(), vector<bool>(p.size(), false) );         dp[0][0] = (s[0] == p[0] ? true : false);                  for (int i = 1; i < s.size(); i++) {             for (int j = 1; j < p.size(); j++) {                 if (s[i] == p[j] || p[j] == '.') {                     dp[i][j] = dp[i - 1][j - 1];                 } else if (p[j] == '*') {                     dp[i][j] = dp[i - 1][j] || dp[i][j - 2];                 } else if (s[i] != p[j]) {                     dp[i][j] = false;                 }             }         }                  return dp[s.size() - 1][p.size() - 1];     } }; 

Matching superimposed image

We are given two grayscale images, one of which contains a large, mostly contiguous patch from the other one. The patch can be altered with noise, its levels may be stretched, etc.

Here’s an example image with copied patch original image

We would like to determine the region of the image which was copied onto the other image.

My first instinct was to look at the local correlation. I first apply a little bit of blur to eliminate some of the noise. Then, around each point, I can subtract a gaussian average, then look at the covariance weighted by that same Gaussian kernel. I normalize by the variances, measured in the same way, to get a correlation. If $ G$ is the Gaussian blur operator, this is:

$ $ \frac{G(A \times B) – G(A)G(B)}{\sqrt{(G(A^2)-G(A)^2)(G(B^2)-G(B)^2)} $ $

The result is… not too bad, not great:


Playing with the width of the kernel can help a bit. I’ve also try correlating Laplacians instead of the images themselves, but it seems to hurt more than it helps. I’ve also tried using the watershed algorithm on the correlation, and it just didn’t give very good results.

I’m thinking part of my problem is not having a strong enough prior for what the patch should be like, perhaps a MRF would help here? Besides MRF, are there some other techniques, perhaps more lightweight that would apply? The other part is that correlation doesn’t seem to be all that great at measuring the distance. There are places where the correlation is very high despite the images being very visually distinct. What other metrics could be of use?