Use the tags “%{” and “%}”, e.g.:
%{
projective transformation notes:
[up vp wp] = [x y w] * tInv
u = up / wp
v = vp / wp
tInv = [ A D G
B E H
C F I]
u = (Ax + By + C) / (Gx + Hy + 1)
v = (Dx + Ey + F) / (Gx + Hy + 1)
%}
Use the tags “%{” and “%}”, e.g.:
%{
projective transformation notes:
[up vp wp] = [x y w] * tInv
u = up / wp
v = vp / wp
tInv = [ A D G
B E H
C F I]
u = (Ax + By + C) / (Gx + Hy + 1)
v = (Dx + Ey + F) / (Gx + Hy + 1)
%}
Here is a C++ function to find the correlation coefficient of two matrices:
float corr(float *x, float *y, int n)
{
float ax=0.0, ay=0.0;
float xt=0.0, yt=0.0;
float sxx=0.0, syy=0.0, sxy=0.0;
// find the means first
for (int i=0; i<n; i++) {
ax += x[i];
ay += y[i];
}
ax /= n;
ay /= n;
// compute the correlation coeffcient
for (int i=0; i<n; i++) {
xt = x[i]-ax;
yt = y[i]-ay;
sxx += xt*xt;
syy += yt*yt;
sxy += xt*yt;
}
return sxy/sqrt(sxx*syy);
} // end corr