forked from OpenRA/OpenRA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
umat2.cs
684 lines (572 loc) · 24.9 KB
/
umat2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Numerics;
using System.Linq;
using GlmSharp.Swizzle;
// ReSharper disable InconsistentNaming
namespace GlmSharp
{
/// <summary>
/// A matrix of type uint with 2 columns and 2 rows.
/// </summary>
[Serializable]
[DataContract(Namespace = "mat")]
[StructLayout(LayoutKind.Sequential)]
public struct umat2 : IReadOnlyList<uint>, IEquatable<umat2>
{
#region Fields
/// <summary>
/// Column 0, Rows 0
/// </summary>
[DataMember]
public uint m00;
/// <summary>
/// Column 0, Rows 1
/// </summary>
[DataMember]
public uint m01;
/// <summary>
/// Column 1, Rows 0
/// </summary>
[DataMember]
public uint m10;
/// <summary>
/// Column 1, Rows 1
/// </summary>
[DataMember]
public uint m11;
#endregion
#region Constructors
/// <summary>
/// Component-wise constructor
/// </summary>
public umat2(uint m00, uint m01, uint m10, uint m11)
{
this.m00 = m00;
this.m01 = m01;
this.m10 = m10;
this.m11 = m11;
}
/// <summary>
/// Constructs this matrix from a umat2. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat2 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat3x2. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat3x2 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat4x2. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat4x2 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat2x3. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat2x3 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat3. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat3 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat4x3. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat4x3 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat2x4. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat2x4 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat3x4. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat3x4 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a umat4. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(umat4 m)
{
this.m00 = m.m00;
this.m01 = m.m01;
this.m10 = m.m10;
this.m11 = m.m11;
}
/// <summary>
/// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
/// </summary>
public umat2(uvec2 c0, uvec2 c1)
{
this.m00 = c0.x;
this.m01 = c0.y;
this.m10 = c1.x;
this.m11 = c1.y;
}
#endregion
#region Properties
/// <summary>
/// Creates a 2D array with all values (address: Values[x, y])
/// </summary>
public uint[,] Values => new[,] { { m00, m01 }, { m10, m11 } };
/// <summary>
/// Creates a 1D array with all values (internal order)
/// </summary>
public uint[] Values1D => new[] { m00, m01, m10, m11 };
/// <summary>
/// Gets or sets the column nr 0
/// </summary>
public uvec2 Column0
{
get
{
return new uvec2(m00, m01);
}
set
{
m00 = value.x;
m01 = value.y;
}
}
/// <summary>
/// Gets or sets the column nr 1
/// </summary>
public uvec2 Column1
{
get
{
return new uvec2(m10, m11);
}
set
{
m10 = value.x;
m11 = value.y;
}
}
/// <summary>
/// Gets or sets the row nr 0
/// </summary>
public uvec2 Row0
{
get
{
return new uvec2(m00, m10);
}
set
{
m00 = value.x;
m10 = value.y;
}
}
/// <summary>
/// Gets or sets the row nr 1
/// </summary>
public uvec2 Row1
{
get
{
return new uvec2(m01, m11);
}
set
{
m01 = value.x;
m11 = value.y;
}
}
#endregion
#region Static Properties
/// <summary>
/// Predefined all-zero matrix
/// </summary>
public static umat2 Zero { get; } = new umat2(0u, 0u, 0u, 0u);
/// <summary>
/// Predefined all-ones matrix
/// </summary>
public static umat2 Ones { get; } = new umat2(1u, 1u, 1u, 1u);
/// <summary>
/// Predefined identity matrix
/// </summary>
public static umat2 Identity { get; } = new umat2(1u, 0u, 0u, 1u);
/// <summary>
/// Predefined all-MaxValue matrix
/// </summary>
public static umat2 AllMaxValue { get; } = new umat2(uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue);
/// <summary>
/// Predefined diagonal-MaxValue matrix
/// </summary>
public static umat2 DiagonalMaxValue { get; } = new umat2(uint.MaxValue, 0u, 0u, uint.MaxValue);
/// <summary>
/// Predefined all-MinValue matrix
/// </summary>
public static umat2 AllMinValue { get; } = new umat2(uint.MinValue, uint.MinValue, uint.MinValue, uint.MinValue);
/// <summary>
/// Predefined diagonal-MinValue matrix
/// </summary>
public static umat2 DiagonalMinValue { get; } = new umat2(uint.MinValue, 0u, 0u, uint.MinValue);
#endregion
#region Functions
/// <summary>
/// Returns an enumerator that iterates through all fields.
/// </summary>
public IEnumerator<uint> GetEnumerator()
{
yield return m00;
yield return m01;
yield return m10;
yield return m11;
}
/// <summary>
/// Returns an enumerator that iterates through all fields.
/// </summary>
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion
/// <summary>
/// Returns the number of Fields (2 x 2 = 4).
/// </summary>
public int Count => 4;
/// <summary>
/// Gets/Sets a specific indexed component (a bit slower than direct access).
/// </summary>
public uint this[int fieldIndex]
{
get
{
switch (fieldIndex)
{
case 0: return m00;
case 1: return m01;
case 2: return m10;
case 3: return m11;
default: throw new ArgumentOutOfRangeException("fieldIndex");
}
}
set
{
switch (fieldIndex)
{
case 0: this.m00 = value; break;
case 1: this.m01 = value; break;
case 2: this.m10 = value; break;
case 3: this.m11 = value; break;
default: throw new ArgumentOutOfRangeException("fieldIndex");
}
}
}
/// <summary>
/// Gets/Sets a specific 2D-indexed component (a bit slower than direct access).
/// </summary>
public uint this[int col, int row]
{
get
{
return this[col * 2 + row];
}
set
{
this[col * 2 + row] = value;
}
}
/// <summary>
/// Returns true iff this equals rhs component-wise.
/// </summary>
public bool Equals(umat2 rhs) => ((m00.Equals(rhs.m00) && m01.Equals(rhs.m01)) && (m10.Equals(rhs.m10) && m11.Equals(rhs.m11)));
/// <summary>
/// Returns true iff this equals rhs type- and component-wise.
/// </summary>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is umat2 && Equals((umat2) obj);
}
/// <summary>
/// Returns true iff this equals rhs component-wise.
/// </summary>
public static bool operator ==(umat2 lhs, umat2 rhs) => lhs.Equals(rhs);
/// <summary>
/// Returns true iff this does not equal rhs (component-wise).
/// </summary>
public static bool operator !=(umat2 lhs, umat2 rhs) => !lhs.Equals(rhs);
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
public override int GetHashCode()
{
unchecked
{
return ((((((m00.GetHashCode()) * 397) ^ m01.GetHashCode()) * 397) ^ m10.GetHashCode()) * 397) ^ m11.GetHashCode();
}
}
/// <summary>
/// Returns a transposed version of this matrix.
/// </summary>
public umat2 Transposed => new umat2(m00, m10, m01, m11);
/// <summary>
/// Returns the minimal component of this matrix.
/// </summary>
public uint MinElement => Math.Min(Math.Min(Math.Min(m00, m01), m10), m11);
/// <summary>
/// Returns the maximal component of this matrix.
/// </summary>
public uint MaxElement => Math.Max(Math.Max(Math.Max(m00, m01), m10), m11);
/// <summary>
/// Returns the euclidean length of this matrix.
/// </summary>
public float Length => (float)Math.Sqrt(((m00*m00 + m01*m01) + (m10*m10 + m11*m11)));
/// <summary>
/// Returns the squared euclidean length of this matrix.
/// </summary>
public float LengthSqr => ((m00*m00 + m01*m01) + (m10*m10 + m11*m11));
/// <summary>
/// Returns the sum of all fields.
/// </summary>
public uint Sum => ((m00 + m01) + (m10 + m11));
/// <summary>
/// Returns the euclidean norm of this matrix.
/// </summary>
public float Norm => (float)Math.Sqrt(((m00*m00 + m01*m01) + (m10*m10 + m11*m11)));
/// <summary>
/// Returns the one-norm of this matrix.
/// </summary>
public float Norm1 => ((m00 + m01) + (m10 + m11));
/// <summary>
/// Returns the two-norm of this matrix.
/// </summary>
public float Norm2 => (float)Math.Sqrt(((m00*m00 + m01*m01) + (m10*m10 + m11*m11)));
/// <summary>
/// Returns the max-norm of this matrix.
/// </summary>
public uint NormMax => Math.Max(Math.Max(Math.Max(m00, m01), m10), m11);
/// <summary>
/// Returns the p-norm of this matrix.
/// </summary>
public double NormP(double p) => Math.Pow(((Math.Pow((double)m00, p) + Math.Pow((double)m01, p)) + (Math.Pow((double)m10, p) + Math.Pow((double)m11, p))), 1 / p);
/// <summary>
/// Returns determinant of this matrix.
/// </summary>
public uint Determinant => m00 * m11 - m10 * m01;
/// <summary>
/// Executes a matrix-matrix-multiplication umat2 * umat2 -> umat2.
/// </summary>
public static umat2 operator*(umat2 lhs, umat2 rhs) => new umat2((lhs.m00 * rhs.m00 + lhs.m10 * rhs.m01), (lhs.m01 * rhs.m00 + lhs.m11 * rhs.m01), (lhs.m00 * rhs.m10 + lhs.m10 * rhs.m11), (lhs.m01 * rhs.m10 + lhs.m11 * rhs.m11));
/// <summary>
/// Executes a matrix-matrix-multiplication umat2 * umat3x2 -> umat3x2.
/// </summary>
public static umat3x2 operator*(umat2 lhs, umat3x2 rhs) => new umat3x2((lhs.m00 * rhs.m00 + lhs.m10 * rhs.m01), (lhs.m01 * rhs.m00 + lhs.m11 * rhs.m01), (lhs.m00 * rhs.m10 + lhs.m10 * rhs.m11), (lhs.m01 * rhs.m10 + lhs.m11 * rhs.m11), (lhs.m00 * rhs.m20 + lhs.m10 * rhs.m21), (lhs.m01 * rhs.m20 + lhs.m11 * rhs.m21));
/// <summary>
/// Executes a matrix-matrix-multiplication umat2 * umat4x2 -> umat4x2.
/// </summary>
public static umat4x2 operator*(umat2 lhs, umat4x2 rhs) => new umat4x2((lhs.m00 * rhs.m00 + lhs.m10 * rhs.m01), (lhs.m01 * rhs.m00 + lhs.m11 * rhs.m01), (lhs.m00 * rhs.m10 + lhs.m10 * rhs.m11), (lhs.m01 * rhs.m10 + lhs.m11 * rhs.m11), (lhs.m00 * rhs.m20 + lhs.m10 * rhs.m21), (lhs.m01 * rhs.m20 + lhs.m11 * rhs.m21), (lhs.m00 * rhs.m30 + lhs.m10 * rhs.m31), (lhs.m01 * rhs.m30 + lhs.m11 * rhs.m31));
/// <summary>
/// Executes a matrix-vector-multiplication.
/// </summary>
public static uvec2 operator*(umat2 m, uvec2 v) => new uvec2((m.m00 * v.x + m.m10 * v.y), (m.m01 * v.x + m.m11 * v.y));
/// <summary>
/// Executes a component-wise * (multiply).
/// </summary>
public static umat2 CompMul(umat2 A, umat2 B) => new umat2(A.m00 * B.m00, A.m01 * B.m01, A.m10 * B.m10, A.m11 * B.m11);
/// <summary>
/// Executes a component-wise / (divide).
/// </summary>
public static umat2 CompDiv(umat2 A, umat2 B) => new umat2(A.m00 / B.m00, A.m01 / B.m01, A.m10 / B.m10, A.m11 / B.m11);
/// <summary>
/// Executes a component-wise + (add).
/// </summary>
public static umat2 CompAdd(umat2 A, umat2 B) => new umat2(A.m00 + B.m00, A.m01 + B.m01, A.m10 + B.m10, A.m11 + B.m11);
/// <summary>
/// Executes a component-wise - (subtract).
/// </summary>
public static umat2 CompSub(umat2 A, umat2 B) => new umat2(A.m00 - B.m00, A.m01 - B.m01, A.m10 - B.m10, A.m11 - B.m11);
/// <summary>
/// Executes a component-wise + (add).
/// </summary>
public static umat2 operator+(umat2 lhs, umat2 rhs) => new umat2(lhs.m00 + rhs.m00, lhs.m01 + rhs.m01, lhs.m10 + rhs.m10, lhs.m11 + rhs.m11);
/// <summary>
/// Executes a component-wise + (add) with a scalar.
/// </summary>
public static umat2 operator+(umat2 lhs, uint rhs) => new umat2(lhs.m00 + rhs, lhs.m01 + rhs, lhs.m10 + rhs, lhs.m11 + rhs);
/// <summary>
/// Executes a component-wise + (add) with a scalar.
/// </summary>
public static umat2 operator+(uint lhs, umat2 rhs) => new umat2(lhs + rhs.m00, lhs + rhs.m01, lhs + rhs.m10, lhs + rhs.m11);
/// <summary>
/// Executes a component-wise - (subtract).
/// </summary>
public static umat2 operator-(umat2 lhs, umat2 rhs) => new umat2(lhs.m00 - rhs.m00, lhs.m01 - rhs.m01, lhs.m10 - rhs.m10, lhs.m11 - rhs.m11);
/// <summary>
/// Executes a component-wise - (subtract) with a scalar.
/// </summary>
public static umat2 operator-(umat2 lhs, uint rhs) => new umat2(lhs.m00 - rhs, lhs.m01 - rhs, lhs.m10 - rhs, lhs.m11 - rhs);
/// <summary>
/// Executes a component-wise - (subtract) with a scalar.
/// </summary>
public static umat2 operator-(uint lhs, umat2 rhs) => new umat2(lhs - rhs.m00, lhs - rhs.m01, lhs - rhs.m10, lhs - rhs.m11);
/// <summary>
/// Executes a component-wise / (divide) with a scalar.
/// </summary>
public static umat2 operator/(umat2 lhs, uint rhs) => new umat2(lhs.m00 / rhs, lhs.m01 / rhs, lhs.m10 / rhs, lhs.m11 / rhs);
/// <summary>
/// Executes a component-wise / (divide) with a scalar.
/// </summary>
public static umat2 operator/(uint lhs, umat2 rhs) => new umat2(lhs / rhs.m00, lhs / rhs.m01, lhs / rhs.m10, lhs / rhs.m11);
/// <summary>
/// Executes a component-wise * (multiply) with a scalar.
/// </summary>
public static umat2 operator*(umat2 lhs, uint rhs) => new umat2(lhs.m00 * rhs, lhs.m01 * rhs, lhs.m10 * rhs, lhs.m11 * rhs);
/// <summary>
/// Executes a component-wise * (multiply) with a scalar.
/// </summary>
public static umat2 operator*(uint lhs, umat2 rhs) => new umat2(lhs * rhs.m00, lhs * rhs.m01, lhs * rhs.m10, lhs * rhs.m11);
/// <summary>
/// Executes a component-wise % (modulo).
/// </summary>
public static umat2 operator%(umat2 lhs, umat2 rhs) => new umat2(lhs.m00 % rhs.m00, lhs.m01 % rhs.m01, lhs.m10 % rhs.m10, lhs.m11 % rhs.m11);
/// <summary>
/// Executes a component-wise % (modulo) with a scalar.
/// </summary>
public static umat2 operator%(umat2 lhs, uint rhs) => new umat2(lhs.m00 % rhs, lhs.m01 % rhs, lhs.m10 % rhs, lhs.m11 % rhs);
/// <summary>
/// Executes a component-wise % (modulo) with a scalar.
/// </summary>
public static umat2 operator%(uint lhs, umat2 rhs) => new umat2(lhs % rhs.m00, lhs % rhs.m01, lhs % rhs.m10, lhs % rhs.m11);
/// <summary>
/// Executes a component-wise ^ (xor).
/// </summary>
public static umat2 operator^(umat2 lhs, umat2 rhs) => new umat2(lhs.m00 ^ rhs.m00, lhs.m01 ^ rhs.m01, lhs.m10 ^ rhs.m10, lhs.m11 ^ rhs.m11);
/// <summary>
/// Executes a component-wise ^ (xor) with a scalar.
/// </summary>
public static umat2 operator^(umat2 lhs, uint rhs) => new umat2(lhs.m00 ^ rhs, lhs.m01 ^ rhs, lhs.m10 ^ rhs, lhs.m11 ^ rhs);
/// <summary>
/// Executes a component-wise ^ (xor) with a scalar.
/// </summary>
public static umat2 operator^(uint lhs, umat2 rhs) => new umat2(lhs ^ rhs.m00, lhs ^ rhs.m01, lhs ^ rhs.m10, lhs ^ rhs.m11);
/// <summary>
/// Executes a component-wise | (bitwise-or).
/// </summary>
public static umat2 operator|(umat2 lhs, umat2 rhs) => new umat2(lhs.m00 | rhs.m00, lhs.m01 | rhs.m01, lhs.m10 | rhs.m10, lhs.m11 | rhs.m11);
/// <summary>
/// Executes a component-wise | (bitwise-or) with a scalar.
/// </summary>
public static umat2 operator|(umat2 lhs, uint rhs) => new umat2(lhs.m00 | rhs, lhs.m01 | rhs, lhs.m10 | rhs, lhs.m11 | rhs);
/// <summary>
/// Executes a component-wise | (bitwise-or) with a scalar.
/// </summary>
public static umat2 operator|(uint lhs, umat2 rhs) => new umat2(lhs | rhs.m00, lhs | rhs.m01, lhs | rhs.m10, lhs | rhs.m11);
/// <summary>
/// Executes a component-wise & (bitwise-and).
/// </summary>
public static umat2 operator&(umat2 lhs, umat2 rhs) => new umat2(lhs.m00 & rhs.m00, lhs.m01 & rhs.m01, lhs.m10 & rhs.m10, lhs.m11 & rhs.m11);
/// <summary>
/// Executes a component-wise & (bitwise-and) with a scalar.
/// </summary>
public static umat2 operator&(umat2 lhs, uint rhs) => new umat2(lhs.m00 & rhs, lhs.m01 & rhs, lhs.m10 & rhs, lhs.m11 & rhs);
/// <summary>
/// Executes a component-wise & (bitwise-and) with a scalar.
/// </summary>
public static umat2 operator&(uint lhs, umat2 rhs) => new umat2(lhs & rhs.m00, lhs & rhs.m01, lhs & rhs.m10, lhs & rhs.m11);
/// <summary>
/// Executes a component-wise left-shift with a scalar.
/// </summary>
public static umat2 operator<<(umat2 lhs, int rhs) => new umat2(lhs.m00 << rhs, lhs.m01 << rhs, lhs.m10 << rhs, lhs.m11 << rhs);
/// <summary>
/// Executes a component-wise right-shift with a scalar.
/// </summary>
public static umat2 operator>>(umat2 lhs, int rhs) => new umat2(lhs.m00 >> rhs, lhs.m01 >> rhs, lhs.m10 >> rhs, lhs.m11 >> rhs);
/// <summary>
/// Executes a component-wise lesser-than comparison.
/// </summary>
public static bmat2 operator<(umat2 lhs, umat2 rhs) => new bmat2(lhs.m00 < rhs.m00, lhs.m01 < rhs.m01, lhs.m10 < rhs.m10, lhs.m11 < rhs.m11);
/// <summary>
/// Executes a component-wise lesser-than comparison with a scalar.
/// </summary>
public static bmat2 operator<(umat2 lhs, uint rhs) => new bmat2(lhs.m00 < rhs, lhs.m01 < rhs, lhs.m10 < rhs, lhs.m11 < rhs);
/// <summary>
/// Executes a component-wise lesser-than comparison with a scalar.
/// </summary>
public static bmat2 operator<(uint lhs, umat2 rhs) => new bmat2(lhs < rhs.m00, lhs < rhs.m01, lhs < rhs.m10, lhs < rhs.m11);
/// <summary>
/// Executes a component-wise lesser-or-equal comparison.
/// </summary>
public static bmat2 operator<=(umat2 lhs, umat2 rhs) => new bmat2(lhs.m00 <= rhs.m00, lhs.m01 <= rhs.m01, lhs.m10 <= rhs.m10, lhs.m11 <= rhs.m11);
/// <summary>
/// Executes a component-wise lesser-or-equal comparison with a scalar.
/// </summary>
public static bmat2 operator<=(umat2 lhs, uint rhs) => new bmat2(lhs.m00 <= rhs, lhs.m01 <= rhs, lhs.m10 <= rhs, lhs.m11 <= rhs);
/// <summary>
/// Executes a component-wise lesser-or-equal comparison with a scalar.
/// </summary>
public static bmat2 operator<=(uint lhs, umat2 rhs) => new bmat2(lhs <= rhs.m00, lhs <= rhs.m01, lhs <= rhs.m10, lhs <= rhs.m11);
/// <summary>
/// Executes a component-wise greater-than comparison.
/// </summary>
public static bmat2 operator>(umat2 lhs, umat2 rhs) => new bmat2(lhs.m00 > rhs.m00, lhs.m01 > rhs.m01, lhs.m10 > rhs.m10, lhs.m11 > rhs.m11);
/// <summary>
/// Executes a component-wise greater-than comparison with a scalar.
/// </summary>
public static bmat2 operator>(umat2 lhs, uint rhs) => new bmat2(lhs.m00 > rhs, lhs.m01 > rhs, lhs.m10 > rhs, lhs.m11 > rhs);
/// <summary>
/// Executes a component-wise greater-than comparison with a scalar.
/// </summary>
public static bmat2 operator>(uint lhs, umat2 rhs) => new bmat2(lhs > rhs.m00, lhs > rhs.m01, lhs > rhs.m10, lhs > rhs.m11);
/// <summary>
/// Executes a component-wise greater-or-equal comparison.
/// </summary>
public static bmat2 operator>=(umat2 lhs, umat2 rhs) => new bmat2(lhs.m00 >= rhs.m00, lhs.m01 >= rhs.m01, lhs.m10 >= rhs.m10, lhs.m11 >= rhs.m11);
/// <summary>
/// Executes a component-wise greater-or-equal comparison with a scalar.
/// </summary>
public static bmat2 operator>=(umat2 lhs, uint rhs) => new bmat2(lhs.m00 >= rhs, lhs.m01 >= rhs, lhs.m10 >= rhs, lhs.m11 >= rhs);
/// <summary>
/// Executes a component-wise greater-or-equal comparison with a scalar.
/// </summary>
public static bmat2 operator>=(uint lhs, umat2 rhs) => new bmat2(lhs >= rhs.m00, lhs >= rhs.m01, lhs >= rhs.m10, lhs >= rhs.m11);
}
}