(define i 0+1i) (define (conj a) (make-rectangular (real-part a) (- (imag-part a)))) (define (U a b c d) (list (list (+ a (* i d)) (+ c (* i b))) (list (+ (- c) (* i b)) (- a (* i d))))) (define rnd ((fileVal "RND") "enott")) (define ml ((fileVal "Matrix") (lambda () (make-rectangular (rnd) (rnd))) 0 zero? 1 + - * /)) (define mm (cadr ml)) (define ct (lambda (x) (let tr ((x x)) (if (null? (car x)) '() (cons (map (lambda (x) (conj (car x))) x) (tr (map cdr x))))))) (define (usu u) (mm (ct u) u)) (usu (U (rnd) (rnd) (rnd) (rnd))) (define (norm a) (let ((ss (/ (sqrt (let su ((s 0) (a a)) (if (null? a) s (su (+ s (* (car a)(car a))) (cdr a)))))))) (map (lambda (x) (* x ss)) a))) ; Generate Haar uniform random element from SU(2) (apply U (norm (((fileVal "Do") 'DoL) 4 (lambda (j) (rnd)))))