Ejemplo n.º 1
0
 public fp4x4(fp4 c0, fp4 c1, fp4 c2, fp4 c3)
 {
     this.c0 = c0;
     this.c1 = c1;
     this.c2 = c2;
     this.c3 = c3;
 }
Ejemplo n.º 2
0
        public static void fp4_operator_equal_wide_scalar()
        {
            fp4   a0 = fp4(65.6712m, 404.415527m, -269.730164m, 83.6306152m);
            fp    b0 = (-155.815765m);
            bool4 r0 = bool4(false, false, false, false);

            TestUtils.AreEqual(a0 == b0, r0);

            fp4   a1 = fp4(152.9945m, 314.671265m, 386.365173m, 290.04895m);
            fp    b1 = (-155.868286m);
            bool4 r1 = bool4(false, false, false, false);

            TestUtils.AreEqual(a1 == b1, r1);

            fp4   a2 = fp4(-132.6352m, -69.68326m, -191.190765m, 186.845215m);
            fp    b2 = (-65.66748m);
            bool4 r2 = bool4(false, false, false, false);

            TestUtils.AreEqual(a2 == b2, r2);

            fp4   a3 = fp4(-232.895691m, -49.70108m, -300.8819m, 333.396851m);
            fp    b3 = (-319.144043m);
            bool4 r3 = bool4(false, false, false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
Ejemplo n.º 3
0
 public static void AreEqual(fp4 a, fp4 b, fp delta = default)
 {
     AreEqual(a.x, b.x, delta);
     AreEqual(a.y, b.y, delta);
     AreEqual(a.z, b.z, delta);
     AreEqual(a.w, b.w, delta);
 }
Ejemplo n.º 4
0
        public static void fp4_operator_equal_scalar_wide()
        {
            fp    a0 = (36.38391m);
            fp4   b0 = fp4(-400.4892m, -71.2868347m, 156.978088m, -225.238739m);
            bool4 r0 = bool4(false, false, false, false);

            TestUtils.AreEqual(a0 == b0, r0);

            fp    a1 = (499.141785m);
            fp4   b1 = fp4(-211.979919m, 428.311951m, -489.501343m, -5.691559m);
            bool4 r1 = bool4(false, false, false, false);

            TestUtils.AreEqual(a1 == b1, r1);

            fp    a2 = (-30.8659363m);
            fp4   b2 = fp4(-362.9831m, 184.503174m, -160.470612m, 316.668823m);
            bool4 r2 = bool4(false, false, false, false);

            TestUtils.AreEqual(a2 == b2, r2);

            fp    a3 = (390.369263m);
            fp4   b3 = fp4(505.1051m, -294.6487m, 443.1991m, 96.5592651m);
            bool4 r3 = bool4(false, false, false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
Ejemplo n.º 5
0
 public fp4x4(fp v)
 {
     this.c0 = v;
     this.c1 = v;
     this.c2 = v;
     this.c3 = v;
 }
Ejemplo n.º 6
0
        public static void fp4_operator_not_equal_wide_scalar()
        {
            fp4   a0 = fp4(-155.4411m, -19.4266052m, 174.633057m, 507.920715m);
            fp    b0 = (-393.413544m);
            bool4 r0 = bool4(true, true, true, true);

            TestUtils.AreEqual(a0 != b0, r0);

            fp4   a1 = fp4(59.177063m, -58.92328m, -398.176849m, 492.20105m);
            fp    b1 = (171.151489m);
            bool4 r1 = bool4(true, true, true, true);

            TestUtils.AreEqual(a1 != b1, r1);

            fp4   a2 = fp4(-165.241516m, -380.243256m, 501.899048m, -134.345459m);
            fp    b2 = (270.341m);
            bool4 r2 = bool4(true, true, true, true);

            TestUtils.AreEqual(a2 != b2, r2);

            fp4   a3 = fp4(458.400452m, 161.459961m, 261.514221m, -145.6124m);
            fp    b3 = (46.7709961m);
            bool4 r3 = bool4(true, true, true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
Ejemplo n.º 7
0
 public static fp3 mul(fp4 a, fp4x3 b)
 {
     return(fp3(
                a.x * b.c0.x + a.y * b.c0.y + a.z * b.c0.z + a.w * b.c0.w,
                a.x * b.c1.x + a.y * b.c1.y + a.z * b.c1.z + a.w * b.c1.w,
                a.x * b.c2.x + a.y * b.c2.y + a.z * b.c2.z + a.w * b.c2.w));
 }
Ejemplo n.º 8
0
 public static void AreEqual(fp4 a, fp4 b, long maxUlp, bool signedZeroEqual)
 {
     AreEqual(a.x, b.x, maxUlp, signedZeroEqual);
     AreEqual(a.y, b.y, maxUlp, signedZeroEqual);
     AreEqual(a.z, b.z, maxUlp, signedZeroEqual);
     AreEqual(a.w, b.w, maxUlp, signedZeroEqual);
 }
Ejemplo n.º 9
0
 public fpquaternion(fp4 value)
 {
     this.x = value.x;
     this.y = value.y;
     this.z = value.z;
     this.w = value.w;
 }
Ejemplo n.º 10
0
        public static void fp4_operator_not_equal_scalar_wide()
        {
            fp    a0 = (478.353149m);
            fp4   b0 = fp4(459.553223m, 436.453247m, -488.714172m, 392.767944m);
            bool4 r0 = bool4(true, true, true, true);

            TestUtils.AreEqual(a0 != b0, r0);

            fp    a1 = (-266.736633m);
            fp4   b1 = fp4(338.557861m, -338.100128m, -152.314545m, -452.820679m);
            bool4 r1 = bool4(true, true, true, true);

            TestUtils.AreEqual(a1 != b1, r1);

            fp    a2 = (209.439331m);
            fp4   b2 = fp4(50.10797m, 372.4344m, -488.0213m, 489.740784m);
            bool4 r2 = bool4(true, true, true, true);

            TestUtils.AreEqual(a2 != b2, r2);

            fp    a3 = (270.4001m);
            fp4   b3 = fp4(-472.846771m, -286.850464m, -384.691864m, 443.423523m);
            bool4 r3 = bool4(true, true, true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
Ejemplo n.º 11
0
 public fp4x4(uint4x4 v)
 {
     this.c0 = (fp4)v.c0;
     this.c1 = (fp4)v.c1;
     this.c2 = (fp4)v.c2;
     this.c3 = (fp4)v.c3;
 }
Ejemplo n.º 12
0
        public static void fp4_operator_equal_wide_wide()
        {
            fp4   a0 = fp4(-135.18924m, -49.0941162m, 169.129822m, 240.8053m);
            fp4   b0 = fp4(-220.014648m, 66.98004m, 499.2016m, -371.1131m);
            bool4 r0 = bool4(false, false, false, false);

            TestUtils.AreEqual(a0 == b0, r0);

            fp4   a1 = fp4(314.7392m, 442.393m, 177.924438m, 335.5334m);
            fp4   b1 = fp4(208.448669m, 390.8037m, -72.44382m, 362.97644m);
            bool4 r1 = bool4(false, false, false, false);

            TestUtils.AreEqual(a1 == b1, r1);

            fp4   a2 = fp4(168.15448m, 350.729553m, 367.178467m, 46.9414673m);
            fp4   b2 = fp4(194.678345m, 471.644836m, -404.044678m, -144.696747m);
            bool4 r2 = bool4(false, false, false, false);

            TestUtils.AreEqual(a2 == b2, r2);

            fp4   a3 = fp4(188.76416m, -97.2113953m, -293.320984m, -234.822937m);
            fp4   b3 = fp4(-494.446655m, -252.970367m, 234.417114m, 398.724m);
            bool4 r3 = bool4(false, false, false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
Ejemplo n.º 13
0
 public fp4x4(uint v)
 {
     this.c0 = (fp4)v;
     this.c1 = (fp4)v;
     this.c2 = (fp4)v;
     this.c3 = (fp4)v;
 }
Ejemplo n.º 14
0
        public static void fp4_operator_not_equal_wide_wide()
        {
            fp4   a0 = fp4(279.994141m, -43.34201m, -465.724731m, 317.466553m);
            fp4   b0 = fp4(-460.9121m, -476.009033m, 468.1364m, -341.012543m);
            bool4 r0 = bool4(true, true, true, true);

            TestUtils.AreEqual(a0 != b0, r0);

            fp4   a1 = fp4(85.7149658m, 360.8905m, 366.081543m, 154.542847m);
            fp4   b1 = fp4(-62.65805m, -458.801666m, -457.730225m, -59.5232544m);
            bool4 r1 = bool4(true, true, true, true);

            TestUtils.AreEqual(a1 != b1, r1);

            fp4   a2 = fp4(332.4262m, 397.11322m, -431.374969m, 489.0108m);
            fp4   b2 = fp4(3.024231m, 155.812744m, -19.8399048m, -6.01693726m);
            bool4 r2 = bool4(true, true, true, true);

            TestUtils.AreEqual(a2 != b2, r2);

            fp4   a3 = fp4(398.4336m, -489.817932m, 171.4049m, -67.82968m);
            fp4   b3 = fp4(-406.207916m, -102.420715m, -40.362915m, 452.6754m);
            bool4 r3 = bool4(true, true, true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
Ejemplo n.º 15
0
 public fp4x2(fp m00, fp m01,
              fp m10, fp m11,
              fp m20, fp m21,
              fp m30, fp m31)
 {
     this.c0 = new fp4(m00, m10, m20, m30);
     this.c1 = new fp4(m01, m11, m21, m31);
 }
Ejemplo n.º 16
0
 public static fp4 mul(fp4 a, fp4x4 b)
 {
     return(fp4(
                a.x * b.c0.x + a.y * b.c0.y + a.z * b.c0.z + a.w * b.c0.w,
                a.x * b.c1.x + a.y * b.c1.y + a.z * b.c1.z + a.w * b.c1.w,
                a.x * b.c2.x + a.y * b.c2.y + a.z * b.c2.z + a.w * b.c2.w,
                a.x * b.c3.x + a.y * b.c3.y + a.z * b.c3.z + a.w * b.c3.w));
 }
Ejemplo n.º 17
0
        public static void fp4_static_constructor()
        {
            fp4 a = fp4(1, 2, 3, 4);

            TestUtils.AreEqual(a.x, 1);
            TestUtils.AreEqual(a.y, 2);
            TestUtils.AreEqual(a.z, 3);
            TestUtils.AreEqual(a.w, 4);
        }
Ejemplo n.º 18
0
        public static void fp4_static_scalar_constructor()
        {
            fp4 a = fp4(17.0m);

            TestUtils.AreEqual(a.x, 17.0m);
            TestUtils.AreEqual(a.y, 17.0m);
            TestUtils.AreEqual(a.z, 17.0m);
            TestUtils.AreEqual(a.w, 17.0m);
        }
Ejemplo n.º 19
0
 public fp4x3(fp m00, fp m01, fp m02,
              fp m10, fp m11, fp m12,
              fp m20, fp m21, fp m22,
              fp m30, fp m31, fp m32)
 {
     this.c0 = new fp4(m00, m10, m20, m30);
     this.c1 = new fp4(m01, m11, m21, m31);
     this.c2 = new fp4(m02, m12, m22, m32);
 }
Ejemplo n.º 20
0
 public fp4x4(fp m00, fp m01, fp m02, fp m03,
              fp m10, fp m11, fp m12, fp m13,
              fp m20, fp m21, fp m22, fp m23,
              fp m30, fp m31, fp m32, fp m33)
 {
     this.c0 = new fp4(m00, m10, m20, m30);
     this.c1 = new fp4(m01, m11, m21, m31);
     this.c2 = new fp4(m02, m12, m22, m32);
     this.c3 = new fp4(m03, m13, m23, m33);
 }
Ejemplo n.º 21
0
        public static void fp4_shuffle_result_1()
        {
            fp4 a = fp4(0, 1, 2, 3);
            fp4 b = fp4(4, 5, 6, 7);

            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX), (0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY), (1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ), (2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW), (3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX), (4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY), (5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ), (6));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW), (7));
        }
Ejemplo n.º 22
0
        public static void fp4_shuffle_result_4()
        {
            fp4 a = fp4(0, 1, 2, 3);
            fp4 b = fp4(4, 5, 6, 7);

            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightX, ShuffleComponent.LeftZ), fp4(1, 3, 4, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftW, ShuffleComponent.RightZ, ShuffleComponent.RightZ), fp4(5, 3, 6, 6));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightZ, ShuffleComponent.RightW, ShuffleComponent.LeftZ), fp4(6, 6, 7, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.LeftZ, ShuffleComponent.LeftZ), fp4(4, 5, 2, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.LeftY, ShuffleComponent.LeftX), fp4(6, 1, 1, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.RightW), fp4(4, 5, 5, 7));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightW, ShuffleComponent.LeftX, ShuffleComponent.RightW), fp4(1, 7, 0, 7));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.LeftX), fp4(5, 0, 1, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightW, ShuffleComponent.LeftW, ShuffleComponent.LeftY), fp4(4, 7, 3, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp4(5, 4, 1, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX), fp4(0, 2, 6, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightW, ShuffleComponent.RightW), fp4(2, 5, 7, 7));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightX, ShuffleComponent.LeftZ, ShuffleComponent.RightX), fp4(3, 4, 2, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.LeftW), fp4(4, 0, 2, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(6, 4, 0, 5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp4(3, 7, 1, 5));
        }
Ejemplo n.º 23
0
        public static void fp4_shuffle_result_3()
        {
            fp4 a = fp4(0, 1, 2, 3);
            fp4 b = fp4(4, 5, 6, 7);

            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightW, ShuffleComponent.RightY), fp3(2, 7, 5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.LeftW), fp3(6, 0, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightW, ShuffleComponent.RightX), fp3(2, 7, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftZ), fp3(5, 0, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.RightZ, ShuffleComponent.LeftZ), fp3(7, 6, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp3(3, 1, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightY, ShuffleComponent.RightX), fp3(3, 5, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.RightW), fp3(3, 1, 7));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightY, ShuffleComponent.RightZ), fp3(6, 5, 6));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp3(5, 4, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.RightW, ShuffleComponent.LeftX), fp3(7, 7, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp3(6, 1, 5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.RightW), fp3(6, 1, 7));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightY, ShuffleComponent.RightY), fp3(3, 5, 5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp3(6, 0, 5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY, ShuffleComponent.RightW), fp3(5, 1, 7));
        }
Ejemplo n.º 24
0
        public static void fp4_shuffle_result_2()
        {
            fp4 a = fp4(0, 1, 2, 3);
            fp4 b = fp4(4, 5, 6, 7);

            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightZ), fp2(5, 6));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightX), fp2(6, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp2(1, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftW), fp2(7, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftZ), fp2(7, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.LeftW), fp2(2, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftW), fp2(5, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftX), fp2(7, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightW), fp2(6, 7));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftZ), fp2(5, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightZ), fp2(6, 6));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftX), fp2(7, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX), fp2(5, 4));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.RightY), fp2(7, 5));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX), fp2(4, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftW), fp2(1, 3));
        }
Ejemplo n.º 25
0
 public static fp4 mul(fp4x4 a, fp4 b)
 {
     return(a.c0 * b.x + a.c1 * b.y + a.c2 * b.z + a.c3 * b.w);
 }
Ejemplo n.º 26
0
 public fp4x2(fp v)
 {
     this.c0 = v;
     this.c1 = v;
 }
Ejemplo n.º 27
0
 public fp4x2(uint v)
 {
     this.c0 = (fp4)v;
     this.c1 = (fp4)v;
 }
Ejemplo n.º 28
0
 public fp4x2(uint4x2 v)
 {
     this.c0 = (fp4)v.c0;
     this.c1 = (fp4)v.c1;
 }
Ejemplo n.º 29
0
 public static fp2 mul(fp4 a, fp4x2 b)
 {
     return(fp2(
                a.x * b.c0.x + a.y * b.c0.y + a.z * b.c0.z + a.w * b.c0.w,
                a.x * b.c1.x + a.y * b.c1.y + a.z * b.c1.z + a.w * b.c1.w));
 }
Ejemplo n.º 30
0
 public static fp mul(fp4 a, fp4 b)
 {
     return(a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w);
 }