/usr/share/gnudatalanguage/astrolib/randomwish.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;+
; NAME:
; RANDOMWISH
; PURUPOSE:
; ROUTINE TO DRAW RANDOM MATRICES FROM A WISHART DISTRIBUTION WITH DOF
; DEGREES OF FREEDOM AND SCALE MATRIX S.
;
; AUTHOR : BRANDON C. KELLY, STEWARD OBS., JULY 2006
;
; INPUTS :
;
; SEED - THE SEED FOR THE RANDOM NUMBER GENERATOR, CAN BE UNDEFINED.
; DOF - THE DEGREES OF FREEDOM FOR THE WISHART DISTRIBUTION.
; S - THE SCALE MATRIX. THE DIMENSION OF S CANNOT BE GREATER THAN
; DOF.
;
; OPTIONAL INPUTS :
;
; NRAND - THE NUMBER OF RANDOM MATRICES TO DRAW
;
; CALLED ROUTINES :
;
; MRANDOMN
;-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function randomwish, seed, dof, S, nrand
if n_params() lt 3 then begin
print, 'Syntax- W = randomwish( seed, dof, S[, nrand] )'
return, 0
endif
dim = (size(S, /dim))[0]
if dim gt dof then begin
print, 'Dimension of S cannot be larger than DOF.'
return, 0
endif
if n_elements(nrand) eq 0 then nrand = 1
wish = dblarr(dim, dim, nrand)
for i = 0, nrand - 1 do begin
x = mrandomn(seed, S, dof)
wish[*,*,i] = x ## transpose(x)
endfor
return, reform(wish)
end
|