- a + b * c # dhas magnitude
sqrt( aa + bb + cc + dd - (2/3)(ab + ac + ad + bc + bd + cd)) .Likewise a three-signed value
- a + b * chas distance
sqrt( aa + bb + cc - ab - ac - bc )from the origin.
- a + bthe distance is
sqrt( aa + bb - 2ab ).
double nSigned::Magnitude() const
{
double d = 0;
double fac = - 1.0 / ( n - 1 );
for( int i = 0; i < n; i++ )
{
for( int j = 0; j < n; j++ )
{
if( i == j ) d += x[i] * x[j];
else d += fac * x[i] * x[j];
}
}
return sqrt(d);
}
where n is the signature and x[i] are
the magnitudes.