-
Notifications
You must be signed in to change notification settings - Fork 0
/
u3.h
700 lines (554 loc) · 19.3 KB
/
u3.h
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
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
/****************************************************************
u3.h
U(3) and SU(3) labeling, branching, and Kronecker product.
Anna E. McCoy and Mark A. Caprio
University of Notre Dame
SPDX-License-Identifier: MIT
3/7/16 (aem,mac): Created based on prototype u3states.py, u3.py, and so3.py.
3/8/16 (aem,mac): Add U3ST structure and rename U3S structure.
3/9/16 (aem,mac): Add KeyType typedefs. Extract MultiplicityTagged.
3/16/16 (aem): Add validity check to U(3) Kronecker product.
9/6/16 (mac): Upgrade U3S and U3ST from struct to class with hash function, etc.
****************************************************************/
#ifndef U3_H_
#define U3_H_
#include <cassert>
#include <string>
#include <vector>
#include "boost/functional/hash.hpp"
#include "am/halfint.h"
#include "am/am.h"
#include "sp3rlib/multiplicity_tagged.h"
#include "mcutils/arithmetic.h"
// #include "utilities/utilities.h"
namespace u3
{
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// SU(3) irrep
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
class SU3
{
////////////////////////////////////////////////////////////////
// constructors
////////////////////////////////////////////////////////////////
public:
// copy constructor: synthesized copy constructor since only data
// member needs copying
// default constructor
inline SU3()
: lambda_(0), mu_(0) {}
// construction from (lambda,mu)
//
// underscore on arguments avoids name clash with accessors
inline SU3(int lambda, int mu)
: lambda_(lambda), mu_(mu) {}
////////////////////////////////////////////////////////////////
// accessors
////////////////////////////////////////////////////////////////
inline int lambda() const
{
return lambda_;
}
inline int mu() const
{
return mu_;
}
////////////////////////////////////////////////////////////////
// key tuple, comparisons, and hashing
////////////////////////////////////////////////////////////////
typedef std::pair<int,int> KeyType;
inline KeyType Key() const
{
return KeyType(lambda(),mu());
}
inline friend bool operator == (const SU3& x1, const SU3& x2)
{
return x1.Key() == x2.Key();
}
inline friend bool operator < (const SU3& x1, const SU3& x2)
{
return x1.Key() < x2.Key();
}
// alternative: if find need to avoid hash combination functions...
//
// static const int label_width = 8;
// int packed_labels = (x.lambda_ << label_width) | (x.mu_ << 0);
// boost::hash<int> hasher;
// return hasher(packed_labels);
inline friend std::size_t hash_value(const SU3& v)
{
boost::hash<SU3::KeyType> hasher;
return hasher(v.Key());
}
////////////////////////////////////////////////////////////////
// string conversion
////////////////////////////////////////////////////////////////
std::string Str() const;
////////////////////////////////////////////////////////////////
// labels
////////////////////////////////////////////////////////////////
private:
// Elliott labels
int lambda_, mu_;
// Could save memory by packing labels into a uint16_t:
// uint16_t packed_labels_;
// packed_labels_ = (lambda << label_width) | (mu << 0);
};
////////////////////////////////////////////////////////////////
// group theory functions
////////////////////////////////////////////////////////////////
inline int dim(const u3::SU3& x)
// Calculate dimension of irrep.
//
// Note: Use lowercase abbreviated form "dim" to match mathematical notation.
{
return (x.lambda()+1)*(x.mu()+1)*(x.lambda()+x.mu()+2)/2;
}
inline u3::SU3 Conjugate(const u3::SU3& x)
// Conjugate irrep.
{
return u3::SU3(x.mu(),x.lambda());
}
inline int ConjugationGrade(const u3::SU3& x)
// Integer contribution to phase on conjugation.
{
return x.mu() + x.lambda();
}
inline double Casimir2( const u3::SU3& x)
//Second order Casimir
{
return 2./3*(mcutils::sqr(x.lambda())+x.lambda()*x.mu()+mcutils::sqr(x.mu())+3*x.lambda()+3*x.mu());
}
inline double Casimir3(const u3::SU3& x)
//Third order Casimir
{
return 1./9*(x.lambda()-x.mu())*(x.lambda()+2*x.mu()+3)*(2*x.lambda()+x.mu()+3);
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// U(3) irrep
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
class U3
{
////////////////////////////////////////////////////////////////
// constructors
////////////////////////////////////////////////////////////////
public:
// copy constructor: synthesized copy constructor since only data
// member needs copying
inline U3()
: f1_(0), f2_(0), f3_(0)
// default constructor
{}
inline U3(const HalfInt& f1, const HalfInt& f2, const HalfInt& f3)
: f1_(f1), f2_(f2), f3_(f3)
// Construct from Cartesian labels [f1,f2,f3].
{
// assert(ValidLabels(f1_,f2_,f3_));
}
inline U3(const HalfInt& N_, const u3::SU3& x_);
// Construct from N(lambda,mu) labels.
//
// Precondition: The N(lambda,mu) are assumed to be a valid U(3)
// combination.
////////////////////////////////////////////////////////////////
// validation
////////////////////////////////////////////////////////////////
inline bool Valid() const
// Checks validity of U3 labels.
//
// Normally there is requirement all labels nonnegative (f3>=0),
// but we also allow conjugate representations with all labels
// nonpositive (f1<=0).
{
// return (f1_ >= f2_) && (f2_ >= f3_) && ((f3_ >=0 ) || (f1_ <= 0));
return ValidLabels(f1_,f2_,f3_);
}
inline static
bool ValidLabels(const HalfInt& f1, const HalfInt& f2, const HalfInt& f3)
// Check validity of U3 labels in Cartesian form.
//
// Normally there is requirement all labels nonnegative (f3>=0),
// but we also allow conjugate representations with all labels
// nonpositive (f1<=0).
{
return (f1 >= f2) && (f2 >= f3) && ((f3 >=0 ) || (f1 <= 0));
}
inline static
bool ValidLabels(const HalfInt& N, const u3::SU3& x)
// Check validity of U3 labels in N(lambda,mu) form.
{
int thrice_twice_f3 = TwiceValue(N-2*x.mu()-x.lambda());
bool valid = (thrice_twice_f3%3==0);
return valid;
}
////////////////////////////////////////////////////////////////
// accessors
////////////////////////////////////////////////////////////////
// access Cartesian labels
inline HalfInt f1() const
{
return f1_;
}
inline HalfInt f2() const
{
return f2_;
}
inline HalfInt f3() const
{
return f3_;
}
// access N and SU(3) parts
// Note: Meed to use explicit reference to u3::SU3 since name is
// masked here by u3::U3::SU3.
inline HalfInt N() const
{
return f1_+f2_+f3_;
}
inline u3::SU3 SU3() const
{
int lambda = int(f1_-f2_);
int mu = int(f2_-f3_);
return u3::SU3(lambda,mu);
}
////////////////////////////////////////////////////////////////
// key tuple, comparisons, and hashing
////////////////////////////////////////////////////////////////
typedef std::pair<HalfInt,u3::SU3> KeyType;
inline KeyType Key() const
{
return KeyType(N(),SU3());
}
inline friend bool operator == (const U3& omega1, const U3& omega2)
{
return omega1.Key() == omega2.Key();
}
inline friend bool operator < (const U3& omega1, const U3& omega2)
{
return omega1.Key() < omega2.Key();
}
// Alternative old "manual" combination...
//
// static const int label_width = 12;
// inline friend std::size_t hash_value(const U3& omega)
// {
// int packed_labels =
// (TwiceValue(omega.f1_) << 2*label_width)
// | (TwiceValue(omega.f2_) << label_width)
// | (TwiceValue(omega.f3_) << 0);
//
// boost::hash<int> hasher;
// return hasher(packed_labels);
// }
inline friend std::size_t hash_value(const U3& v)
{
boost::hash<U3::KeyType> hasher;
return hasher(v.Key());
}
////////////////////////////////////////////////////////////////
// string conversion
////////////////////////////////////////////////////////////////
std::string Str() const;
////////////////////////////////////////////////////////////////
// labels
////////////////////////////////////////////////////////////////
private:
// Cartesian labels
HalfInt f1_, f2_, f3_;
};
////////////////////////////////////////////////////////////////
// constructors
////////////////////////////////////////////////////////////////
inline U3::U3(const HalfInt& N_, const u3::SU3& x_)
{
assert(ValidLabels(N_,x_));
// recover f3 first
// N - 2mu - lambda = (f1+f2+f3)-2*(f2-f3)-(f1-f2) = 3*f3
// but since division is not defined for HalfInt, work with twice value for division purposes
int twice_f3 = TwiceValue(N_-2*x_.mu()-x_.lambda()) / 3;
f3_ = HalfInt(twice_f3,2);
// recover f2 and f1
f2_ = f3_ + x_.mu();
f1_ = f2_ + x_.lambda();
}
////////////////////////////////////////////////////////////////
// group theory functions
////////////////////////////////////////////////////////////////
inline int dim(const u3::U3& omega)
// Calculate dimension of irrep.
//
// Note: Use lowercase abbreviated form "dim" to match mathematical notation.
{
return dim(omega.SU3());
}
inline u3::U3 Conjugate(const u3::U3& omega)
// Conjugate irrep.
{
return u3::U3(-omega.N(),Conjugate(omega.SU3()));
}
inline int ConjugationGrade(const u3::U3& omega)
// Integer contribution to phase on conjugation.
{
return ConjugationGrade(omega.SU3());
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// U(3) x SU(2) irrep
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
class U3S
{
////////////////////////////////////////////////////////////////
// constructors
////////////////////////////////////////////////////////////////
public:
// copy constructor: synthesized copy constructor since only data
// member needs copying
// default constructor
inline U3S()
: S_(0) {}
// construction from (omega,S)
inline U3S(const u3::U3& omega, const HalfInt& S)
: omega_(omega), S_(S) {}
////////////////////////////////////////////////////////////////
// accessors
////////////////////////////////////////////////////////////////
inline u3::U3 U3() const
{
return omega_;
}
inline u3::SU3 SU3() const
{
return omega_.SU3();
}
inline HalfInt S() const
{
return S_;
}
////////////////////////////////////////////////////////////////
// key tuple, comparisons, and hashing
////////////////////////////////////////////////////////////////
typedef std::tuple<u3::U3,HalfInt> KeyType;
inline KeyType Key() const
{
return KeyType(omega_,S_);
}
inline friend bool operator == (const U3S& omegaS1, const U3S& omegaS2)
{
return omegaS1.Key() == omegaS2.Key();
}
inline friend bool operator < (const U3S& omegaS1, const U3S& omegaS2)
{
return omegaS1.Key() < omegaS2.Key();
}
inline friend std::size_t hash_value(const U3S& v)
{
boost::hash<U3S::KeyType> hasher;
return hasher(v.Key());
}
////////////////////////////////////////////////////////////////
// string conversion
////////////////////////////////////////////////////////////////
std::string Str() const;
////////////////////////////////////////////////////////////////
// labels
////////////////////////////////////////////////////////////////
private:
u3::U3 omega_;
HalfInt S_;
};
////////////////////////////////////////////////////////////////
// group theory functions
////////////////////////////////////////////////////////////////
inline int dim(const u3::U3S& omegaS)
// Calculate dimension of irrep.
//
// Note: Use lowercase abbreviated form "dim" to match mathematical notation.
{
return dim(omegaS.U3())*am::dim(omegaS.S());
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// U(3) x SU(2) x SU(2) irrep
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
class U3ST
{
////////////////////////////////////////////////////////////////
// constructors
////////////////////////////////////////////////////////////////
public:
// copy constructor: synthesized copy constructor since only data
// member needs copying
// default constructor
inline U3ST()
: S_(0), T_(0) {}
// construction from (omega,S,T)
inline U3ST(const u3::U3& omega, const HalfInt& S, const HalfInt& T)
: omega_(omega), S_(S), T_(T) {}
////////////////////////////////////////////////////////////////
// accessors
////////////////////////////////////////////////////////////////
inline u3::U3 U3() const
{
return omega_;
}
inline u3::SU3 SU3() const
{
return omega_.SU3();
}
inline HalfInt S() const
{
return S_;
}
inline HalfInt T() const
{
return T_;
}
////////////////////////////////////////////////////////////////
// key tuple, comparisons, and hashing
////////////////////////////////////////////////////////////////
typedef std::tuple<u3::U3,HalfInt,HalfInt> KeyType;
inline KeyType Key() const
{
return KeyType(omega_,S_,T_);
}
inline friend bool operator == (const U3ST& omegaST1, const U3ST& omegaST2)
{
return omegaST1.Key() == omegaST2.Key();
}
inline friend bool operator < (const U3ST& omegaST1, const U3ST& omegaST2)
{
return omegaST1.Key() < omegaST2.Key();
}
inline friend std::size_t hash_value(const U3ST& v)
{
boost::hash<U3ST::KeyType> hasher;
return hasher(v.Key());
}
////////////////////////////////////////////////////////////////
// string conversion
////////////////////////////////////////////////////////////////
std::string Str() const;
////////////////////////////////////////////////////////////////
// labels
////////////////////////////////////////////////////////////////
private:
u3::U3 omega_;
HalfInt S_,T_;
};
////////////////////////////////////////////////////////////////
// group theory functions
////////////////////////////////////////////////////////////////
inline int dim(const u3::U3ST& omegaST)
// Calculate dimension of irrep.
//
// Note: Use lowercase abbreviated form "dim" to match mathematical notation.
{
return dim(omegaST.U3())*am::dim(omegaST.S())*am::dim(omegaST.T());
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// coupling
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// outer multiplicity
int OuterMultiplicity(const u3::SU3& x1, const u3::SU3& x2, const u3::SU3& x3);
// Calculate outer multiplicity of SU(3) irrep of SU(3) Kronecker product.
//
// Calculates multiplicity of x3 in product x1 x x2.
//
// Reference: C. K. Chew and R. T. Sharp, Can. J. Phys. 44, 2789 (1966). To be verified.
// As in SU3LIB MULTU3 or UNU3SU3Basics SU3::mult.
//
// Arguments:
// x1, x2, x3 (u3::SU3): irreps
//
// Returns:
// (int) : multiplicity
MultiplicityTagged<u3::SU3>::vector KroneckerProduct(const u3::SU3& x1, const u3::SU3& x2);
// Generate multiplicity-tagged vector of SU(3) irreps in SU(3) Kronecker product.
//
// Generates Kronecker product by iterating over possible
// (lambda,mu) in product and checking multiplicity.
//
// As in UNU3SU3Basics SU3::Couple but adopting more restrictive
// bounds on product (lambda3,mu3).
//
// Arguments:
// x1, x2 (u3::SU3) : irreps
//
// Returns:
// (MultiplicityTagged<u3::SU3>::vector) : vector with each irrep
// (of nonzero multiplicity) tagged by its multiplicity rho_max
MultiplicityTagged<u3::U3>::vector KroneckerProduct(const u3::U3& omega1, const u3::U3& omega2);
// Overloaded for U3.
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// branching
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// branching multiplicity
int BranchingMultiplicitySO3(const u3::SU3& x, int L);
// Calculate branching multiplicity of angular momentum in SU(3) irrep.
//
// Ref: e.g., Harvey, ANP 1, 67 (1968).
//
// Arguments:
// x (u3::SU3): SU(3) irrep
// L (int) : angular momentum
//
// Returns:
// (int) : multiplicity
//
// EX:
// BranchingMultiplicity(u3::SU3(4,3),3)
// returns 2
MultiplicityTagged<int>::vector BranchingSO3(const u3::SU3& x);
// Generate multiplicity-tagged vector of SO(3) irreps in SU(3) irrep.
//
// The general branching rule is:
//
// mubar=min(lambda,mu)
// lambdabar=max(lambda,mu)
// K=mubar,mubar-2,...,1 or 0
// L =
// K, K+1,...,lambdabar if K!=0
// lambdabar, lambdabar-2,...,1 or 0 if K=0
//
// The list of L values with multiplicities is, however, generated
// by iterating over the allowed L values in this range and
// calculating their multiplicities by BranchingMultiplicity.
//
// Args:
// x (u3::SU3) : SU(3) irrep
//
// Returns:
// (MultiplicityTagged<int>::vector) : vector with each L
// (of nonzero multiplicity) tagged by its multiplicity
// kappa_max
MultiplicityTagged<int>::vector BranchingSO3Constrained(const u3::SU3& x, const HalfInt::pair& r);
// Generate multiplicity-tagged vector of SO(3) irreps in SU(3)
// irrep, constrained to lie within a constrained angular momentum
// range.
//
// The intended purpose is to allow branching only to those L values
// which will couple with a given S to yield a given J.
//
// Args:
// x (u3::SU3) : SU(3) irrep
// r (HalfInt::pair) : allowed angular momentum range
//
// Although range is taken as HalfInt::pair, since it could come from
// result of coupling J and S using am::ProductAngularMomentumRange, the actual values should be
// integral.
//
// Returns:
// (MultiplicityTagged<int>::vector) : vector with each L
// (of nonzero multiplicity) tagged by its multiplicity
// kappa_max
} // namespace
#endif