3 using System
.Runtime
.CompilerServices
;
6 * Tests for the SIMD intrinsics in the System.Numerics.Vectors assembly.
8 public class VectorTests
{
11 public static int Main (string[] args
) {
12 return TestDriver
.RunTests (typeof (VectorTests
), args
);
20 public static int test_0_vector2_ctor_1 () {
21 var v
= new Vector2 (1.0f
);
30 public static int test_0_vector2_ctor_2 () {
31 var v
= new Vector2 (1.0f
, 2.0f
);
40 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
41 public static bool vector2_equals (Vector2 v1
, Vector2 v2
) {
43 return v1
.Equals (v2
);
46 public static int test_0_vector2_equals () {
47 var v1
= new Vector2 (1.0f
, 2.0f
);
48 var v2
= new Vector2 (2.0f
, 2.0f
);
50 if (vector2_equals (v1
, v2
))
52 if (!vector2_equals (v1
, v1
))
57 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
58 public static float vector2_dot (Vector2 v1
, Vector2 v2
) {
59 return Vector2
.Dot (v1
, v2
);
62 public static int test_0_vector2_dot () {
63 var v1
= new Vector2 (1.0f
, 1.0f
);
64 var v2
= new Vector2 (2.0f
, 2.0f
);
66 float f
= vector2_dot (v1
, v2
);
69 f
= vector2_dot (v1
, v1
);
75 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
76 public static Vector2
vector2_min (Vector2 v1
, Vector2 v2
) {
77 return Vector2
.Min (v1
, v2
);
80 public static int test_0_vector2_min () {
81 var v1
= new Vector2 (1.0f
, 1.0f
);
82 var v2
= new Vector2 (2.0f
, 2.0f
);
84 var v3
= vector2_min (v1
, v2
);
85 if (v3
.X
!= 1.0f
|| v3
.Y
!= 1.0f
)
87 v3
= vector2_min (v2
, v2
);
88 if (v3
.X
!= 2.0f
|| v3
.Y
!= 2.0f
)
93 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
94 public static Vector2
vector2_max (Vector2 v1
, Vector2 v2
) {
95 return Vector2
.Max (v1
, v2
);
98 public static int test_0_vector2_max () {
99 var v1
= new Vector2 (1.0f
, 1.0f
);
100 var v2
= new Vector2 (2.0f
, 2.0f
);
102 var v3
= vector2_max (v1
, v2
);
103 if (v3
.X
!= 2.0f
|| v3
.Y
!= 2.0f
)
105 v3
= vector2_min (v1
, v1
);
106 if (v3
.X
!= 1.0f
|| v3
.Y
!= 1.0f
)
111 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
112 public static Vector2
vector2_abs (Vector2 v1
) {
113 return Vector2
.Abs (v1
);
116 public static int test_0_vector2_abs () {
117 var v1
= new Vector2 (-1.0f
, -2.0f
);
118 var v2
= new Vector2 (1.0f
, 2.0f
);
120 var v3
= vector2_abs (v1
);
121 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
)
123 v3
= vector2_abs (v2
);
124 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
)
129 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
130 public static Vector2
vector2_sqrt (Vector2 v1
) {
131 return Vector2
.SquareRoot (v1
);
134 public static int test_0_vector2_sqrt () {
135 var v1
= new Vector2 (1.0f
, 0.0f
);
137 var v3
= vector2_sqrt (v1
);
138 if (v3
.X
!= 1.0f
|| v3
.Y
!= 0.0f
)
143 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
144 public static Vector2
vector2_add (Vector2 v1
, Vector2 v2
) {
148 public static int test_0_vector2_add () {
149 var v1
= new Vector2 (1.0f
, 2.0f
);
150 var v2
= new Vector2 (3.0f
, 4.0f
);
152 var v3
= vector2_add (v1
, v2
);
153 if (v3
.X
!= 4.0f
|| v3
.Y
!= 6.0f
)
158 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
159 public static Vector2
vector2_sub (Vector2 v1
, Vector2 v2
) {
163 public static int test_0_vector2_sub () {
164 var v1
= new Vector2 (1.0f
, 2.0f
);
165 var v2
= new Vector2 (3.0f
, 5.0f
);
167 var v3
= vector2_sub (v2
, v1
);
168 if (v3
.X
!= 2.0f
|| v3
.Y
!= 3.0f
)
173 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
174 public static Vector2
vector2_mul (Vector2 v1
, Vector2 v2
) {
178 public static int test_0_vector2_mul () {
179 var v1
= new Vector2 (1.0f
, 2.0f
);
180 var v2
= new Vector2 (3.0f
, 5.0f
);
182 var v3
= vector2_mul (v2
, v1
);
183 if (v3
.X
!= 3.0f
|| v3
.Y
!= 10.0f
)
188 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
189 public static Vector2
vector2_mul_left (float v1
, Vector2 v2
) {
193 public static int test_0_vector2_mul_left () {
194 var v1
= new Vector2 (3.0f
, 5.0f
);
196 var v3
= vector2_mul_left (2.0f
, v1
);
197 if (v3
.X
!= 6.0f
|| v3
.Y
!= 10.0f
)
202 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
203 public static Vector2
vector2_mul_right (Vector2 v1
, float v2
) {
207 public static int test_0_vector2_mul_right () {
208 var v1
= new Vector2 (3.0f
, 5.0f
);
210 var v3
= vector2_mul_right (v1
, 2.0f
);
211 if (v3
.X
!= 6.0f
|| v3
.Y
!= 10.0f
)
216 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
217 public static Vector2
vector2_div (Vector2 v1
, Vector2 v2
) {
221 public static int test_0_vector2_div () {
222 var v1
= new Vector2 (9.0f
, 10.0f
);
223 var v2
= new Vector2 (3.0f
, 5.0f
);
225 var v3
= vector2_div (v1
, v2
);
226 if (v3
.X
!= 3.0f
|| v3
.Y
!= 2.0f
)
231 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
232 public static Vector2
vector2_div_right (Vector2 v1
, float v2
) {
236 public static int test_0_vector2_div_right () {
237 var v1
= new Vector2 (9.0f
, 15.0f
);
239 var v3
= vector2_div_right (v1
, 3.0f
);
240 if (v3
.X
!= 3.0f
|| v3
.Y
!= 5.0f
)
249 public static int test_0_vector4_ctor_1 () {
250 var v
= new Vector4 (1.0f
);
263 public static int test_0_vector4_ctor_2 () {
264 var v
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
277 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
278 public static bool vector4_equals (Vector4 v1
, Vector4 v2
) {
280 return v1
.Equals (v2
);
283 public static int test_0_vector4_equals () {
284 var v1
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
285 var v2
= new Vector4 (2.0f
, 2.0f
, 2.0f
, 2.0f
);
287 if (vector4_equals (v1
, v2
))
289 if (!vector4_equals (v1
, v1
))
294 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
295 public static float vector4_dot (Vector4 v1
, Vector4 v2
) {
296 return Vector4
.Dot (v1
, v2
);
299 public static int test_0_vector4_dot () {
300 var v1
= new Vector4 (1.0f
, 1.0f
, 1.0f
, 1.0f
);
301 var v2
= new Vector4 (2.0f
, 2.0f
, 2.0f
, 2.0f
);
303 float f
= vector4_dot (v1
, v2
);
306 f
= vector4_dot (v1
, v1
);
312 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
313 public static Vector4
vector4_min (Vector4 v1
, Vector4 v2
) {
314 return Vector4
.Min (v1
, v2
);
317 public static int test_0_vector4_min () {
318 var v1
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
319 var v2
= new Vector4 (5.0f
, 6.0f
, 7.0f
, 8.0f
);
321 var v3
= vector4_min (v1
, v2
);
322 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
|| v3
.W
!= 4.0f
)
324 v3
= vector4_min (v2
, v2
);
325 if (v3
.X
!= 5.0f
|| v3
.Y
!= 6.0f
|| v3
.Z
!= 7.0f
|| v3
.W
!= 8.0f
)
330 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
331 public static Vector4
vector4_max (Vector4 v1
, Vector4 v2
) {
332 return Vector4
.Max (v1
, v2
);
335 public static int test_0_vector4_max () {
336 var v1
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
337 var v2
= new Vector4 (5.0f
, 6.0f
, 7.0f
, 8.0f
);
339 var v3
= vector4_max (v1
, v2
);
340 if (v3
.X
!= 5.0f
|| v3
.Y
!= 6.0f
|| v3
.Z
!= 7.0f
|| v3
.W
!= 8.0f
)
342 v3
= vector4_max (v1
, v1
);
343 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
|| v3
.W
!= 4.0f
)
348 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
349 public static Vector4
vector4_abs (Vector4 v1
) {
350 return Vector4
.Abs (v1
);
353 public static int test_0_vector4_abs () {
354 var v1
= new Vector4 (-1.0f
, -2.0f
, -3.0f
, -4.0f
);
355 var v2
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
357 var v3
= vector4_abs (v1
);
358 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
|| v3
.W
!= 4.0f
)
360 v3
= vector4_abs (v2
);
361 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
|| v3
.W
!= 4.0f
)
366 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
367 public static Vector4
vector4_sqrt (Vector4 v1
) {
368 return Vector4
.SquareRoot (v1
);
371 public static int test_0_vector4_sqrt () {
372 var v1
= new Vector4 (1.0f
, 0.0f
, 1.0f
, 0.0f
);
374 var v3
= vector4_sqrt (v1
);
375 if (v3
.X
!= 1.0f
|| v3
.Y
!= 0.0f
|| v3
.Z
!= 1.0f
|| v3
.W
!= 0.0f
)
380 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
381 public static Vector4
vector4_add (Vector4 v1
, Vector4 v2
) {
385 public static int test_0_vector4_add () {
386 var v1
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
387 var v2
= new Vector4 (5.0f
, 6.0f
, 7.0f
, 8.0f
);
389 var v3
= vector4_add (v1
, v2
);
390 if (v3
.X
!= 6.0f
|| v3
.Y
!= 8.0f
|| v3
.Z
!= 10.0f
|| v3
.W
!= 12.0f
)
395 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
396 public static Vector4
vector4_sub (Vector4 v1
, Vector4 v2
) {
400 public static int test_0_vector4_sub () {
401 var v1
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
402 var v2
= new Vector4 (3.0f
, 5.0f
, 7.0f
, 9.0f
);
404 var v3
= vector4_sub (v2
, v1
);
405 if (v3
.X
!= 2.0f
|| v3
.Y
!= 3.0f
|| v3
.Z
!= 4.0f
|| v3
.W
!= 5.0f
)
410 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
411 public static Vector4
vector4_mul (Vector4 v1
, Vector4 v2
) {
415 public static int test_0_vector4_mul () {
416 var v1
= new Vector4 (1.0f
, 2.0f
, 3.0f
, 4.0f
);
417 var v2
= new Vector4 (3.0f
, 5.0f
, 6.0f
, 7.0f
);
419 var v3
= vector4_mul (v2
, v1
);
420 if (v3
.X
!= 3.0f
|| v3
.Y
!= 10.0f
|| v3
.Z
!= 18.0f
|| v3
.W
!= 28.0f
)
425 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
426 public static Vector4
vector4_mul_left (float v1
, Vector4 v2
) {
430 public static int test_0_vector4_mul_left () {
431 var v1
= new Vector4 (3.0f
, 5.0f
, 6.0f
, 7.0f
);
433 var v3
= vector4_mul_left (2.0f
, v1
);
434 if (v3
.X
!= 6.0f
|| v3
.Y
!= 10.0f
|| v3
.Z
!= 12.0f
|| v3
.W
!= 14.0f
)
439 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
440 public static Vector4
vector4_mul_right (Vector4 v1
, float v2
) {
444 public static int test_0_vector4_mul_right () {
445 var v1
= new Vector4 (3.0f
, 5.0f
, 6.0f
, 7.0f
);
447 var v3
= vector4_mul_right (v1
, 2.0f
);
448 if (v3
.X
!= 6.0f
|| v3
.Y
!= 10.0f
|| v3
.Z
!= 12.0f
|| v3
.W
!= 14.0f
)
453 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
454 public static Vector4
vector4_div (Vector4 v1
, Vector4 v2
) {
458 public static int test_0_vector4_div () {
459 var v1
= new Vector4 (9.0f
, 10.0f
, 12.0f
, 21.0f
);
460 var v2
= new Vector4 (3.0f
, 5.0f
, 6.0f
, 7.0f
);
462 var v3
= vector4_div (v1
, v2
);
463 if (v3
.X
!= 3.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 2.0f
|| v3
.W
!= 3.0f
)
468 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
469 public static Vector4
vector4_div_right (Vector4 v1
, float v2
) {
473 public static int test_0_vector4_div_right () {
474 var v1
= new Vector4 (9.0f
, 15.0f
, 21.0f
, 30.0f
);
476 var v3
= vector4_div_right (v1
, 3.0f
);
477 if (v3
.X
!= 3.0f
|| v3
.Y
!= 5.0f
|| v3
.Z
!= 7.0f
|| v3
.W
!= 10.0f
)
482 public static int test_0_vector4_length () {
483 var v
= new Vector4 (2.0f
, 2.0f
, 2.0f
, 2.0f
);
484 return v
.Length () == 4.0f
? 0 : 1;
491 public static int test_0_vector3_ctor_1 () {
492 var v
= new Vector3 (1.0f
);
503 public static int test_0_vector3_ctor_2 () {
504 var v
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
515 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
516 public static bool vector3_equals (Vector3 v1
, Vector3 v2
) {
518 return v1
.Equals (v2
);
521 public static int test_0_vector3_equals () {
522 var v1
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
523 var v2
= new Vector3 (2.0f
, 2.0f
, 2.0f
);
525 if (vector3_equals (v1
, v2
))
527 if (!vector3_equals (v1
, v1
))
532 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
533 public static float vector3_dot (Vector3 v1
, Vector3 v2
) {
534 return Vector3
.Dot (v1
, v2
);
537 public static int test_0_vector3_dot () {
538 var v1
= new Vector3 (1.0f
, 1.0f
, 1.0f
);
539 var v2
= new Vector3 (2.0f
, 2.0f
, 2.0f
);
541 float f
= vector3_dot (v1
, v2
);
544 f
= vector3_dot (v1
, v1
);
550 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
551 public static Vector3
vector3_min (Vector3 v1
, Vector3 v2
) {
552 return Vector3
.Min (v1
, v2
);
555 public static int test_0_vector3_min () {
556 var v1
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
557 var v2
= new Vector3 (5.0f
, 6.0f
, 7.0f
);
559 var v3
= vector3_min (v1
, v2
);
560 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
)
562 v3
= vector3_min (v2
, v2
);
563 if (v3
.X
!= 5.0f
|| v3
.Y
!= 6.0f
|| v3
.Z
!= 7.0f
)
568 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
569 public static Vector3
vector3_max (Vector3 v1
, Vector3 v2
) {
570 return Vector3
.Max (v1
, v2
);
573 public static int test_0_vector3_max () {
574 var v1
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
575 var v2
= new Vector3 (5.0f
, 6.0f
, 7.0f
);
577 var v3
= vector3_max (v1
, v2
);
578 if (v3
.X
!= 5.0f
|| v3
.Y
!= 6.0f
|| v3
.Z
!= 7.0f
)
580 v3
= vector3_max (v1
, v1
);
581 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
)
586 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
587 public static Vector3
vector3_abs (Vector3 v1
) {
588 return Vector3
.Abs (v1
);
591 public static int test_0_vector3_abs () {
592 var v1
= new Vector3 (-1.0f
, -2.0f
, -3.0f
);
593 var v2
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
595 var v3
= vector3_abs (v1
);
596 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
)
598 v3
= vector3_abs (v2
);
599 if (v3
.X
!= 1.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 3.0f
)
604 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
605 public static Vector3
vector3_sqrt (Vector3 v1
) {
606 return Vector3
.SquareRoot (v1
);
609 public static int test_0_vector3_sqrt () {
610 var v1
= new Vector3 (1.0f
, 0.0f
, 1.0f
);
612 var v3
= vector3_sqrt (v1
);
613 if (v3
.X
!= 1.0f
|| v3
.Y
!= 0.0f
|| v3
.Z
!= 1.0f
)
618 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
619 public static Vector3
vector3_add (Vector3 v1
, Vector3 v2
) {
623 public static int test_0_vector3_add () {
624 var v1
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
625 var v2
= new Vector3 (5.0f
, 6.0f
, 7.0f
);
627 var v3
= vector3_add (v1
, v2
);
628 if (v3
.X
!= 6.0f
|| v3
.Y
!= 8.0f
|| v3
.Z
!= 10.0f
)
633 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
634 public static Vector3
vector3_sub (Vector3 v1
, Vector3 v2
) {
638 public static int test_0_vector3_sub () {
639 var v1
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
640 var v2
= new Vector3 (3.0f
, 5.0f
, 7.0f
);
642 var v3
= vector3_sub (v2
, v1
);
643 if (v3
.X
!= 2.0f
|| v3
.Y
!= 3.0f
|| v3
.Z
!= 4.0f
)
648 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
649 public static Vector3
vector3_mul (Vector3 v1
, Vector3 v2
) {
653 public static int test_0_vector3_mul () {
654 var v1
= new Vector3 (1.0f
, 2.0f
, 3.0f
);
655 var v2
= new Vector3 (3.0f
, 5.0f
, 6.0f
);
657 var v3
= vector3_mul (v2
, v1
);
658 if (v3
.X
!= 3.0f
|| v3
.Y
!= 10.0f
|| v3
.Z
!= 18.0f
)
663 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
664 public static Vector3
vector3_mul_left (float v1
, Vector3 v2
) {
668 public static int test_0_vector3_mul_left () {
669 var v1
= new Vector3 (3.0f
, 5.0f
, 6.0f
);
671 var v3
= vector3_mul_left (2.0f
, v1
);
672 if (v3
.X
!= 6.0f
|| v3
.Y
!= 10.0f
|| v3
.Z
!= 12.0f
)
677 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
678 public static Vector3
vector3_mul_right (Vector3 v1
, float v2
) {
682 public static int test_0_vector3_mul_right () {
683 var v1
= new Vector3 (3.0f
, 5.0f
, 6.0f
);
685 var v3
= vector3_mul_right (v1
, 2.0f
);
686 if (v3
.X
!= 6.0f
|| v3
.Y
!= 10.0f
|| v3
.Z
!= 12.0f
)
691 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
692 public static Vector3
vector3_div (Vector3 v1
, Vector3 v2
) {
696 public static int test_0_vector3_div () {
697 var v1
= new Vector3 (9.0f
, 10.0f
, 12.0f
);
698 var v2
= new Vector3 (3.0f
, 5.0f
, 6.0f
);
700 var v3
= vector3_div (v1
, v2
);
701 if (v3
.X
!= 3.0f
|| v3
.Y
!= 2.0f
|| v3
.Z
!= 2.0f
)
706 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
707 public static Vector3
vector3_div_right (Vector3 v1
, float v2
) {
711 public static int test_0_vector3_div_right () {
712 var v1
= new Vector3 (9.0f
, 15.0f
, 21.0f
);
714 var v3
= vector3_div_right (v1
, 3.0f
);
715 if (v3
.X
!= 3.0f
|| v3
.Y
!= 5.0f
|| v3
.Z
!= 7.0f
)
724 public static int test_0_vector_t_count () {
725 // This assumes a 16 byte simd register size
726 if (Vector
<byte>.Count
!= 16)
728 if (Vector
<short>.Count
!= 8)
730 if (Vector
<int>.Count
!= 4)
732 if (Vector
<long>.Count
!= 2)
737 public static int test_0_vector_t_zero () {
738 var v
= Vector
<byte>.Zero
;
739 for (int i
= 0; i
< Vector
<byte>.Count
; ++i
)
742 var v2
= Vector
<double>.Zero
;
743 for (int i
= 0; i
< Vector
<double>.Count
; ++i
)
749 public static int test_0_vector_t_i1_accessor () {
750 var elems
= new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
;
751 var v
= new Vector
<byte> (elems
, 0);
752 for (int i
= 0; i
< Vector
<byte>.Count
; ++i
)
764 } catch (IndexOutOfRangeException
) {
769 } catch (IndexOutOfRangeException
) {
774 public static int test_0_vector_t_i4_accessor () {
775 var elems
= new int [] { 1, 2, 3, 4 }
;
776 var v
= new Vector
<int> (elems
, 0);
777 for (int i
= 0; i
< Vector
<int>.Count
; ++i
)
789 } catch (IndexOutOfRangeException
) {
792 int r
= v
[Vector
<int>.Count
];
794 } catch (IndexOutOfRangeException
) {
799 public static int test_0_vector_t_i8_accessor () {
800 var elems
= new long [] { 1, 2 }
;
801 var v
= new Vector
<long> (elems
, 0);
802 for (int i
= 0; i
< Vector
<long>.Count
; ++i
)
812 } catch (IndexOutOfRangeException
) {
815 var r
= v
[Vector
<long>.Count
];
817 } catch (IndexOutOfRangeException
) {
822 public static int test_0_vector_t_r8_accessor () {
823 var elems
= new double [] { 1.0, 2.0 }
;
824 var v
= new Vector
<double> (elems
, 0);
825 for (int i
= 0; i
< Vector
<double>.Count
; ++i
)
826 if (v
[i
] != (double)i
+ 1.0)
835 } catch (IndexOutOfRangeException
) {
838 var r
= v
[Vector
<double>.Count
];
840 } catch (IndexOutOfRangeException
) {
845 public static int test_0_vector_t_i1_ctor_3 () {
846 var v
= new Vector
<byte> (5);
847 for (int i
= 0; i
< 16; ++i
)
853 public static int test_0_vector_t_i2_ctor_3 () {
854 var v
= new Vector
<short> (5);
855 for (int i
= 0; i
< 8; ++i
)
861 public static int test_0_vector_t_i4_ctor_3 () {
862 var v
= new Vector
<int> (0xffffeee);
863 for (int i
= 0; i
< 4; ++i
)
864 if (v
[i
] != 0xffffeee)
869 public static int test_0_vector_t_i8_ctor_3 () {
870 var v
= new Vector
<long> (0xffffeeeeabcdefL
);
871 for (int i
= 0; i
< 2; ++i
)
872 if (v
[i
] != 0xffffeeeeabcdefL
)
877 public static int test_0_vector_t_r4_ctor_3 () {
878 var v
= new Vector
<float> (0.5f
);
879 for (int i
= 0; i
< 4; ++i
) {
886 public static int test_0_vector_t_r8_ctor_3 () {
887 var v
= new Vector
<double> (0.5f
);
888 for (int i
= 0; i
< 2; ++i
) {
895 public static int test_0_vector_t_i1_ctor () {
896 var elems
= new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
897 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 };
898 var v
= new Vector
<byte> (elems
, 16);
899 for (int i
= 0; i
< 16; ++i
)
903 var v2
= new Vector
<byte> (elems
, 16 + 4);
905 } catch (IndexOutOfRangeException
) {
910 public static int test_0_vector_t_i1_ctor_2 () {
911 var elems
= new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
;
912 var v
= new Vector
<byte> (elems
);
913 for (int i
= 0; i
< 16; ++i
)
917 var elems2
= new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
;
918 var v2
= new Vector
<byte> (elems2
);
920 } catch (IndexOutOfRangeException
) {
925 public static int test_0_vector_t_r4_equal () {
926 var elems1
= new float [4] { 1.0f, 1.0f, 1.0f, 1.0f }
;
927 var v1
= new Vector
<float> (elems1
);
928 var elems2
= new float [4] { 1.0f, 2.0f, 1.0f, 2.0f }
;
929 var v2
= new Vector
<float> (elems2
);
930 Vector
<int> v
= Vector
.Equals (v1
, v2
);
931 if (v
[0] != -1 || v
[1] != 0 || v
[2] != -1 || v
[3] != 0)
936 public static int test_0_vector_t_r8_equal () {
937 var elems1
= new double [] { 1.0f, 1.0f }
;
938 var v1
= new Vector
<double> (elems1
);
939 var elems2
= new double [] { 1.0f, 2.0f }
;
940 var v2
= new Vector
<double> (elems2
);
941 Vector
<long> v
= Vector
.Equals (v1
, v2
);
942 if (v
[0] != -1 || v
[1] != 0)
947 public static int test_0_vector_t_i8_equal () {
948 var elems1
= new long [] { 1, 1 }
;
949 var v1
= new Vector
<long> (elems1
);
950 var elems2
= new long [] { 1, 2 }
;
951 var v2
= new Vector
<long> (elems2
);
952 Vector
<long> v
= Vector
.Equals (v1
, v2
);
953 if (v
[0] != -1 || v
[1] != 0)
958 public static int test_0_vector_t_i4_equal () {
959 var elems1
= new int [] { 1, 1, 1, 1 }
;
960 var v1
= new Vector
<int> (elems1
);
961 var elems2
= new int [] { 1, 2, 1, 2 }
;
962 var v2
= new Vector
<int> (elems2
);
963 Vector
<int> v
= Vector
.Equals (v1
, v2
);
964 if (v
[0] != -1 || v
[1] != 0 || v
[2] != -1 || v
[3] != 0)
970 public static int test_0_vector_t_u4_equal () {
971 var elems1 = new uint [] { 1, 1, 1, 1 };
972 var v1 = new Vector<uint> (elems1);
973 var elems2 = new uint [] { 1, 2, 1, 2 };
974 var v2 = new Vector<uint> (elems2);
975 Vector<uint> v = Vector.Equals (v1, v2);
976 if (v [0] != 0xffffffff || v [1] != 0 || v [2] != 0xffffffff || v[3] != 0)
982 public static int test_0_vector_t_i2_equal () {
983 var elems1
= new short [] { 1, 1, 1, 1, 1, 1, 1, 1 }
;
984 var v1
= new Vector
<short> (elems1
);
985 var elems2
= new short [] { 1, 2, 1, 2, 1, 2, 1, 2 }
;
986 var v2
= new Vector
<short> (elems2
);
987 Vector
<short> v
= Vector
.Equals (v1
, v2
);
988 for (int i
= 0; i
< Vector
<short>.Count
; ++i
) {
989 if (i
% 2 == 0 && v
[i
] != -1)
991 if (i
% 2 == 1 && v
[i
] != 0)
997 public static int test_0_vector_t_u2_equal () {
998 var elems1
= new ushort [] { 1, 1, 1, 1, 1, 1, 1, 1 }
;
999 var v1
= new Vector
<ushort> (elems1
);
1000 var elems2
= new ushort [] { 1, 2, 1, 2, 1, 2, 1, 2 }
;
1001 var v2
= new Vector
<ushort> (elems2
);
1002 Vector
<ushort> v
= Vector
.Equals (v1
, v2
);
1003 for (int i
= 0; i
< Vector
<ushort>.Count
; ++i
) {
1004 if (i
% 2 == 0 && v
[i
] != 0xffff)
1006 if (i
% 2 == 1 && v
[i
] != 0)
1012 public static int test_0_vector_t_i1_equal () {
1013 var elems1
= new sbyte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
;
1014 var v1
= new Vector
<sbyte> (elems1
);
1015 var elems2
= new sbyte [] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
;
1016 var v2
= new Vector
<sbyte> (elems2
);
1017 Vector
<sbyte> v
= Vector
.Equals (v1
, v2
);
1018 for (int i
= 0; i
< Vector
<sbyte>.Count
; ++i
) {
1019 if (i
% 2 == 0 && v
[i
] != -1)
1021 if (i
% 2 == 1 && v
[i
] != 0)
1027 public static int test_0_vector_t_u1_equal () {
1028 var elems1
= new byte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
;
1029 var v1
= new Vector
<byte> (elems1
);
1030 var elems2
= new byte [] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
;
1031 var v2
= new Vector
<byte> (elems2
);
1032 Vector
<byte> v
= Vector
.Equals (v1
, v2
);
1033 for (int i
= 0; i
< Vector
<byte>.Count
; ++i
) {
1034 if (i
% 2 == 0 && v
[i
] != 0xff)
1036 if (i
% 2 == 1 && v
[i
] != 0)
1042 /* op_Explicit () -> Vector<int32> */
1044 public static int test_0_vector_t_cast_vector_int32 () {
1045 var v1
= new Vector
<long> (new long [] { 0x123456789abcdef0L, 0x23456789abcdef01L }
);
1046 var v
= (Vector
<int>)v1
;
1047 if (BitConverter
.IsLittleEndian
) {
1048 if ((uint)v
[0] != 0x9abcdef0 || (uint)v
[1] != 0x12345678)
1050 if ((uint)v
[2] != 0xabcdef01 || (uint)v
[3] != 0x23456789)
1053 if ((uint)v
[1] != 0x9abcdef0 || (uint)v
[0] != 0x12345678)
1055 if ((uint)v
[3] != 0xabcdef01 || (uint)v
[2] != 0x23456789)
1061 /* Vector.GreaterThanOrEqual */
1063 public static int test_0_vector_t_i1_ge () {
1064 var elems1
= new sbyte [] { 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 }
;
1065 var v1
= new Vector
<sbyte> (elems1
);
1066 var elems2
= new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1067 var v2
= new Vector
<sbyte> (elems2
);
1068 Vector
<sbyte> v
= Vector
.GreaterThanOrEqual (v1
, v2
);
1069 for (int i
= 0; i
< Vector
<sbyte>.Count
; ++i
) {
1070 if (i
% 2 == 0 && v
[i
] != -1)
1072 if (i
% 2 == 1 && v
[i
] != 0)
1078 public static int test_0_vector_t_i2_ge () {
1079 var elems1
= new short [] { 1, 1, 0, 1, 1, 1, 0, 1 }
;
1080 var v1
= new Vector
<short> (elems1
);
1081 var elems2
= new short [] { 0, 2, 0, 2, 0, 2, 0, 2 }
;
1082 var v2
= new Vector
<short> (elems2
);
1083 Vector
<short> v
= Vector
.GreaterThanOrEqual (v1
, v2
);
1084 for (int i
= 0; i
< Vector
<short>.Count
; ++i
) {
1085 if (i
% 2 == 0 && v
[i
] != -1)
1087 if (i
% 2 == 1 && v
[i
] != 0)
1093 public static int test_0_vector_t_i4_ge () {
1094 var elems1
= new int [] { 1, 1, 0, 1 }
;
1095 var v1
= new Vector
<int> (elems1
);
1096 var elems2
= new int [] { 0, 2, 0, 2 }
;
1097 var v2
= new Vector
<int> (elems2
);
1098 Vector
<int> v
= Vector
.GreaterThanOrEqual (v1
, v2
);
1099 if (v
[0] != -1 || v
[1] != 0 || v
[2] != -1 || v
[3] != 0)
1104 public static int test_0_vector_t_i8_ge () {
1105 var elems1
= new long [] { 1, 1 }
;
1106 var v1
= new Vector
<long> (elems1
);
1107 var elems2
= new long [] { 0, 1 }
;
1108 var v2
= new Vector
<long> (elems2
);
1109 Vector
<long> v
= Vector
.GreaterThanOrEqual (v1
, v2
);
1110 if (v
[0] != -1 || v
[1] != -1)
1115 /* Vector.LessThan */
1117 public static int test_0_vector_t_i1_lt () {
1118 var elems1
= new sbyte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
;
1119 var v1
= new Vector
<sbyte> (elems1
);
1120 var elems2
= new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1121 var v2
= new Vector
<sbyte> (elems2
);
1122 Vector
<sbyte> v
= Vector
.LessThan (v2
, v1
);
1123 for (int i
= 0; i
< Vector
<sbyte>.Count
; ++i
) {
1124 if (i
% 2 == 0 && v
[i
] != -1)
1126 if (i
% 2 == 1 && v
[i
] != 0)
1132 /* Vector.GreaterThan */
1134 public static int test_0_vector_t_i1_gt () {
1135 var elems1
= new sbyte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
;
1136 var v1
= new Vector
<sbyte> (elems1
);
1137 var elems2
= new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1138 var v2
= new Vector
<sbyte> (elems2
);
1139 Vector
<sbyte> v
= Vector
.GreaterThan (v1
, v2
);
1140 for (int i
= 0; i
< Vector
<sbyte>.Count
; ++i
) {
1141 if (i
% 2 == 0 && v
[i
] != -1)
1143 if (i
% 2 == 1 && v
[i
] != 0)
1149 /* Vector.LessThanOrEqual */
1150 public static int test_0_vector_t_i1_le () {
1151 var elems1
= new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1152 var v1
= new Vector
<sbyte> (elems1
);
1153 var elems2
= new sbyte [] { 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 }
;
1154 var v2
= new Vector
<sbyte> (elems2
);
1155 Vector
<sbyte> v
= Vector
.LessThanOrEqual (v1
, v2
);
1156 for (int i
= 0; i
< Vector
<sbyte>.Count
; ++i
) {
1157 if (i
% 2 == 0 && v
[i
] != -1)
1159 if (i
% 2 == 1 && v
[i
] != 0)
1167 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
1168 public static Vector
<T
> vector_t_abs
<T
> (Vector
<T
> v1
) where T
: struct {
1169 return Vector
.Abs (v1
);
1172 public static int test_0_vector_t_u1_abs () {
1173 var elems1
= new byte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1174 var v1
= new Vector
<byte> (elems1
);
1176 if (vector_t_abs (v1
) != v1
)
1181 public static int test_0_vector_t_u2_abs () {
1182 var elems1
= new ushort [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1183 var v1
= new Vector
<ushort> (elems1
);
1185 if (vector_t_abs (v1
) != v1
)
1190 public static int test_0_vector_t_u4_abs () {
1191 var elems1
= new uint [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1192 var v1
= new Vector
<uint> (elems1
);
1194 if (vector_t_abs (v1
) != v1
)
1199 public static int test_0_vector_t_u8_abs () {
1200 var elems1
= new ulong [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 }
;
1201 var v1
= new Vector
<ulong> (elems1
);
1203 if (vector_t_abs (v1
) != v1
)
1208 public static int test_0_vector_t_i1_abs () {
1209 var elems1
= new sbyte [] { 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2 }
;
1210 var v1
= new Vector
<sbyte> (elems1
);
1211 var elems2
= new sbyte [] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
;
1212 var v2
= new Vector
<sbyte> (elems2
);
1214 if (vector_t_abs (v1
) != v2
)
1220 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
1221 public static Vector
<T
> vector_add
<T
> (Vector
<T
> v1
, Vector
<T
> v2
) where T
: struct {
1225 public static int test_0_vector_byte_add () {
1226 var v1
= new Vector
<byte> (new byte[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
);
1227 var v2
= new Vector
<byte> (new byte[] { 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 }
);
1229 var res
= vector_add (v1
, v1
);
1235 public static int test_0_vector_sbyte_add () {
1236 var v1
= new Vector
<sbyte> (new sbyte[] { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 }
);
1237 var v2
= new Vector
<sbyte> (new sbyte[] { 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2 }
);
1239 var res
= vector_add (v1
, v1
);
1245 public static int test_0_vector_ushort_add () {
1246 var v1
= new Vector
<ushort> (new ushort[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
);
1247 var v2
= new Vector
<ushort> (new ushort[] { 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 }
);
1249 var res
= vector_add (v1
, v1
);
1255 public static int test_0_vector_short_add () {
1256 var v1
= new Vector
<short> (new short[] { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 }
);
1257 var v2
= new Vector
<short> (new short[] { 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2 }
);
1259 var res
= vector_add (v1
, v1
);
1265 public static int test_0_vector_uint_add () {
1266 var v1
= new Vector
<uint> (new uint[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
);
1267 var v2
= new Vector
<uint> (new uint[] { 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 }
);
1269 var res
= vector_add (v1
, v1
);
1275 public static int test_0_vector_int_add () {
1276 var v1
= new Vector
<int> (new int[] { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 }
);
1277 var v2
= new Vector
<int> (new int[] { 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, 2, 2, -2, 2, -2 }
);
1279 var res
= vector_add (v1
, v1
);
1285 public static int test_0_vector_double_add () {
1286 var v1
= new Vector
<double> (new double[] { 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0 }
);
1287 var v2
= new Vector
<double> (new double[] { 2.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0, 2.0, 2.0, -2.0, 2.0, -2.0 }
);
1289 var res
= vector_add (v1
, v1
);
1295 public static int test_0_vector_float_add () {
1296 var v1
= new Vector
<float> (new float[] { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f }
);
1297 var v2
= new Vector
<float> (new float[] { 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, 2.0f, 2.0f, -2.0f, 2.0f, -2.0f }
);
1299 var res
= vector_add (v1
, v1
);
1305 // Vector<T>.op_Subtraction
1307 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
1308 public static Vector
<T
> vector_sub
<T
> (Vector
<T
> v1
, Vector
<T
> v2
) where T
: struct {
1312 public static int test_0_vector_byte_sub () {
1313 var v1
= new Vector
<byte> (new byte[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }
);
1315 var res
= vector_sub (v1
, v1
);
1316 if (res
!= Vector
<byte>.Zero
)
1321 public static int test_0_vector_double_sub () {
1322 var v1
= new Vector
<double> (new double[] { 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0 }
);
1324 var res
= vector_sub (v1
, v1
);
1325 if (res
!= Vector
<double>.Zero
)
1330 public static int test_0_vector_float_sub () {
1331 var v1
= new Vector
<float> (new float[] { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f }
);
1333 var res
= vector_sub (v1
, v1
);
1334 if (res
!= Vector
<float>.Zero
)
1339 // Vector<T>.op_Multiply
1340 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
1341 public static Vector
<T
> vector_mul
<T
> (Vector
<T
> v1
, Vector
<T
> v2
) where T
: struct {
1345 public static int test_0_vector_int_mul () {
1346 var v1
= new Vector
<int> (new int[] { 1, 2, -1, 2, 1, 2, -1, 2, 1, -2, 1, 2, 1, 2, -1, 2 }
);
1347 var v2
= new Vector
<int> (new int[] { 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4 }
);
1349 var res
= vector_mul (v1
, v1
);
1355 public static int test_0_vector_double_mul () {
1356 var v1
= new Vector
<double> (new double[] { 2.0, -1.0, 2.0, -1.0 }
);
1357 var v2
= new Vector
<double> (new double[] { 4.0, 1.0, 4.0, 1.0 }
);
1359 var res
= vector_mul (v1
, v1
);
1365 public static int test_0_vector_float_mul () {
1366 var v1
= new Vector
<float> (new float[] { 2.0f, -1.0f, 2.0f, -1.0f }
);
1367 var v2
= new Vector
<float> (new float[] { 4.0f, 1.0f, 4.0f, 1.0f }
);
1369 var res
= vector_mul (v1
, v1
);
1375 // Vector<T>.op_Division
1376 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
1377 public static Vector
<T
> vector_div
<T
> (Vector
<T
> v1
, Vector
<T
> v2
) where T
: struct {
1381 public static int test_0_vector_double_div () {
1382 var v1
= new Vector
<double> (new double[] { 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0 }
);
1383 var v2
= new Vector
<double> (new double[] { 1.0, 1.0, 1.0, 1.0 }
);
1385 var res
= vector_div (v1
, v1
);
1391 public static int test_0_vector_float_div () {
1392 var v1
= new Vector
<float> (new float[] { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f }
);
1393 var v2
= new Vector
<float> (new float[] { 1.0f, 1.0f, 1.0f, 1.0f }
);
1395 var res
= vector_div (v1
, v1
);
1402 [MethodImplAttribute (MethodImplOptions
.NoInlining
)]
1403 public static void vector_copyto
<T
> (Vector
<T
> v1
, T
[] array
, int index
) where T
: struct {
1404 v1
.CopyTo (array
, index
);
1407 public static int test_0_vector_byte_copyto () {
1408 var v1
= new Vector
<byte> (new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
);
1410 byte[] arr
= new byte [256];
1411 vector_copyto (v1
, arr
, 1);
1412 for (int i
= 0; i
< 16; ++i
)
1413 if (arr
[i
+ 1] != (i
+ 1))
1415 vector_copyto (v1
, arr
, 240);
1417 vector_copyto (v1
, arr
, 241);
1419 } catch (ArgumentException
) {