http://bioinformatics.oxfordjournals.or ... 2.full.pdf

In particular, note the projection operator, section 2.3, and equation (2) and equation (3).

Given a couple of vectors, u and v (well, nu actually, but can't be bothered typesetting it, and LaTeX makes the page too slow) we want to actually implement this projection operator to exclude the phylogenetic relationship, using a bit of basic Python or something.

Suppose we already have these two vectors, they're equal length, real, floating point.

P = I - |u><u|

P |v

_{i}> = |v

_{i}> - |u> <u|v

_{i}>

Now, how to implement this, in terms of code?

Calculate <u|v

_{i}> as simply the dot product of the two vectors.

Take vector |u> multiplied by that scalar product, and subtract that from vector |v

_{i}>, to generate the result vector.

Is that correct? Is it sort of on the right track, in terms of taking their operation as described and translating it into code in the easiest way?