Added weighted median function and tests

Thanks! The docs for `sortrows` are not quite explicit.

If you want to test the performance of your function, use very large (random) vectors. This is how it will typically be used in real life.