private unsafe double[] snorm(double[] input)
{
// Get the number of vectors in the sequence
int n = input.Length / length;
// Create the augmented sequence projection
double[] projection = new double[input.Length + n];
fixed (double* source = input)
fixed (double* result = projection)
{
double* src = source;
double* dst = result;
for (int i = 0; i < n; i++)
{
double norm = alpha * alpha;
for (int j = 0; j < length; j++)
norm += src[j] * src[j];
norm = Math.Sqrt(norm);
for (int j = 0; j < length; j++, src++, dst++)
*dst = *src / norm;
*(dst++) = alpha / norm;
}
}
return projection; // return the projected sequence
}