theochem / procrustes

Python library for finding the optimal transformation(s) that makes two matrices as close as possible to each other.
https://procrustes.qcdevs.org/
GNU General Public License v3.0
109 stars 20 forks source link

translation, scling, weighting for positive semi-definite Procrustes problem #172

Closed FanwangM closed 2 years ago

FanwangM commented 2 years ago

The psdp_woodgate (https://github.com/theochem/procrustes/pull/170) has set up a good starting point for implementing PSDP algorithms. Thanks! @banrovegrie

We are missing a few initial setting up such as scaling, translation, etc. You can add this code blocks like

 # check inputs
    new_a, new_b = setup_input_arrays(
        a,
        b,
        unpad_col,
        unpad_row,
        pad,
        translate,
        scale,
        check_finite,
        weight,
    )
    if new_a.shape != new_b.shape:
        raise ValueError(
            f"Shape of A and B does not match: {new_a.shape} != {new_b.shape} "
            "Check pad, unpad_col, and unpad_row arguments."
        )

And you will need to change the finial output accordingly, such as new_a=new_a and new_b=new_b. Sample codes can be found at https://github.com/theochem/procrustes/blob/5c58d97735bfe2ec298a868f35d501f943e1e41b/procrustes/orthogonal.py#L40-L169.

Given that you want the first PR to be merged in a quicker manner, I have merged #170. You can fix this in a new PR together with adding testing codes or you can just create a small PR for this.

banrovegrie commented 2 years ago

Yep, you can assign this to me. I will update it when I push my code for testing psdp modules. @FanwangM

FanwangM commented 2 years ago

This has been fixed in #173.