/// <summary> /// WFG2 t3 transformation /// </summary> /// <param name="z"></param> /// <param name="k"></param> /// <param name="M"></param> /// <returns></returns> public float[] T3(float[] z, int k, int M) { float[] result = new float[M]; float[] w = new float[z.Length]; for (int i = 0; i < z.Length; i++) { w[i] = (float)1.0; } for (int i = 1; i <= M - 1; i++) { int head = (i - 1) * k / (M - 1) + 1; int tail = i * k / (M - 1); float[] subZ = SubVector(z, head - 1, tail - 1); float[] subW = SubVector(w, head - 1, tail - 1); result[i - 1] = Transformations.R_sum(subZ, subW); } int l = z.Length - k; int h = k + 1; int t = k + l / 2; float[] sZ = SubVector(z, h - 1, t - 1); float[] sW = SubVector(w, h - 1, t - 1); result[M - 1] = Transformations.R_sum(sZ, sW); return(result); }
/// <summary> /// WFG7 t1 transformation /// </summary> /// <param name="z"></param> /// <param name="k"></param> /// <returns></returns> public float[] T1(float[] z, int k) { float[] result = new float[z.Length]; float[] w = new float[z.Length]; for (int i = 0; i < w.Length; i++) { w[i] = 1; } for (int i = 0; i < k; i++) { int head = i + 1; int tail = z.Length - 1; float[] subZ = SubVector(z, head, tail); float[] subW = SubVector(w, head, tail); float aux = Transformations.R_sum(subZ, subW); result[i] = Transformations.B_param(z[i], aux, (float)0.98 / (float)49.98, (float)0.02, (float)50); } Array.Copy(z, k, result, k, z.Length - k); return(result); }