20 March 2018 9:53:22.767 AM WISHART_TEST FORTRAN90 version Test the WISHART library. INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_UNIT_SAMPLE_TEST: WISHART_UNIT_SAMPLE samples unit Wishart matrices by: W = wishart_unit_sample ( n, df ) wishart_unit_sample ( 5, 8 ): Col 1 2 3 4 5 Row 1: 4.69684 -2.05975 -3.83480 -0.622254 2.51726 2: -2.05975 5.83929 3.25985 -1.16652 -1.17852 3: -3.83480 3.25985 9.88119 3.41009 -3.72320 4: -0.622254 -1.16652 3.41009 5.15060 -2.12361 5: 2.51726 -1.17852 -3.72320 -2.12361 17.3902 wishart_unit_sample ( 5, 8 ): Col 1 2 3 4 5 Row 1: 5.02082 1.47158 3.73925 -0.296867 -0.229552 2: 1.47158 5.77222 0.307906 -0.823420 -4.33607 3: 3.73925 0.307906 7.10709 -1.64255 1.50232 4: -0.296867 -0.823420 -1.64255 1.93799 1.24162 5: -0.229552 -4.33607 1.50232 1.24162 5.85456 wishart_unit_sample ( 5, 5 ): Col 1 2 3 4 5 Row 1: 2.82306 -0.837351 1.23309 1.78100 0.113968 2: -0.837351 4.10155 -0.300706 -1.74382 -2.38223 3: 1.23309 -0.300706 7.49638 -3.42390 -0.786605 4: 1.78100 -1.74382 -3.42390 4.30805 1.15726 5: 0.113968 -2.38223 -0.786605 1.15726 1.73857 wishart_unit_sample ( 3, 5 ): Col 1 2 3 Row 1: 0.519611 0.869653 -1.45908 2: 0.869653 3.46367 -3.36600 3: -1.45908 -3.36600 5.18437 Eigenvectors of previous matrix: Col 1 2 3 Row 1: -0.215348 -0.252157 0.943421 2: -0.594100 0.800565 0.783637E-01 3: 0.775030 0.543611 0.322206 Eigenvalues of previous matrix: 1: 8.1700008 2: 0.90412863 3: 0.93527650E-01 INITIALIZE - Note: The RNGLIB package has been initialized. BARTLETT_UNIT_SAMPLE_TEST: BARTLETT_UNIT_SAMPLE samples unit Bartlett matrices by: call bartlett_unit_sample ( n, df, t ) bartlett_unit_sample ( 5, 8, t ): Col 1 2 3 4 5 Row 1: 2.16722 -0.950413 -1.76946 -0.287121 1.16152 2: 0. 2.22171 0.710322 -0.647881 -0.335794E-01 3: 0. 0. 2.49913 1.34537 -0.657865 4: 0. 0. 0. 1.68475 -0.550110 5: 0. 0. 0. 0. 3.91210 bartlett_unit_sample ( 5, 8, t ): Col 1 2 3 4 5 Row 1: 2.24072 0.656744 1.66877 -0.132487 -0.102446 2: 0. 2.31104 -0.340994 -0.318649 -1.84713 3: 0. 0. 2.05086 -0.746084 0.508771 4: 0. 0. 0. 1.12350 0.907029 5: 0. 0. 0. 0. 1.16217 bartlett_unit_sample ( 5, 5, t ): Col 1 2 3 4 5 Row 1: 1.68020 -0.498365 0.733896 1.05999 0.678305E-01 2: 0. 1.96295 0.331346E-01 -0.619251 -1.19637 3: 0. 0. 2.63755 -1.58530 -0.302077 4: 0. 0. 0. 0.536491 -0.250480 5: 0. 0. 0. 0. 0.385571 bartlett_unit_sample ( 3, 5, t ): Col 1 2 3 Row 1: 0.720841 1.20644 -2.02414 2: 0. 1.41710 -0.652030 3: 0. 0. 0.813686 Eigenvectors of previous matrix: Col 1 2 3 Row 1: -0.215348 -0.252157 0.943421 2: -0.594100 0.800565 0.783637E-01 3: 0.775030 0.543611 0.322206 Eigenvalues of previous matrix: 1: 8.1700008 2: 0.90412863 3: 0.93527650E-01 INITIALIZE - Note: The RNGLIB package has been initialized. TEST03: Verify that, if using the same set of random numbers, W = T' * T, where W = wishart_unit_sample ( n, df ) T = bartlett_unit_sample ( n, df ) INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 0.00000 INITIALIZE - Note: The RNGLIB package has been initialized. TEST04: We can compute sample Wishart matrices by: W = wishart_sample ( n, df, sigma ) wishart_sample ( 5, 8, Identity ): Col 1 2 3 4 5 Row 1: 4.69684 -2.05975 -3.83480 -0.622254 2.51726 2: -2.05975 5.83929 3.25985 -1.16652 -1.17852 3: -3.83480 3.25985 9.88119 3.41009 -3.72320 4: -0.622254 -1.16652 3.41009 5.15060 -2.12361 5: 2.51726 -1.17852 -3.72320 -2.12361 17.3902 wishart_sample ( 5, 8, Identity ): Col 1 2 3 4 5 Row 1: 5.02082 1.47158 3.73925 -0.296867 -0.229552 2: 1.47158 5.77222 0.307906 -0.823420 -4.33607 3: 3.73925 0.307906 7.10709 -1.64255 1.50232 4: -0.296867 -0.823420 -1.64255 1.93799 1.24162 5: -0.229552 -4.33607 1.50232 1.24162 5.85456 wishart_sample ( 5, 8, diag(1,2,3,4,5) ): Col 1 2 3 4 5 Row 1: 5.41003 -1.63932 2.95662 4.93098 0.352785 2: -1.63932 14.8657 -0.678348 -6.18888 -10.2475 3: 2.95662 -0.678348 11.9972 0.677447 -4.68264 4: 4.93098 -6.18888 0.677447 17.4974 6.53359 5: 0.352785 -10.2475 -4.68264 6.53359 16.6955 Set covariance SIGMA: Col 1 2 3 Row 1: 25. 5. 15. 2: 5. 17. 11. 3: 15. 11. 49. wishart_sample ( 3, 3, sigma ): Col 1 2 3 Row 1: 64.1067 51.4597 -39.4565 2: 51.4597 48.8164 -38.6383 3: -39.4565 -38.6383 34.7382 Eigenvectors of previous matrix: Col 1 2 3 Row 1: 0.659767 0.702857 -0.265894 2: 0.585267 -0.258670 0.768474 3: -0.471348 0.662633 0.582021 Eigenvalues of previous matrix: 1: 137.94402 2: 7.9697350 3: 1.7475691 INITIALIZE - Note: The RNGLIB package has been initialized. TEST05: We can compute sample Bartlett matrices by: T = bartlett_sample ( n, df, sigma ) bartlett_sample ( 5, 8, Identity ): Col 1 2 3 4 5 Row 1: 2.16722 -0.950413 -1.76946 -0.287121 1.16152 2: 0. 2.22171 0.710322 -0.647881 -0.335794E-01 3: 0. 0. 2.49913 1.34537 -0.657865 4: 0. 0. 0. 1.68475 -0.550110 5: 0. 0. 0. 0. 3.91210 bartlett_sample ( 5, 8, Identity ): Col 1 2 3 4 5 Row 1: 2.24072 0.656744 1.66877 -0.132487 -0.102446 2: 0. 2.31104 -0.340994 -0.318649 -1.84713 3: 0. 0. 2.05086 -0.746084 0.508771 4: 0. 0. 0. 1.12350 0.907029 5: 0. 0. 0. 0. 1.16217 bartlett_sample ( 5, 8, diag(1,2,3,4,5) ): Col 1 2 3 4 5 Row 1: 2.32595 -0.704795 1.27114 2.11999 0.151674 2: 0. 3.79065 0.573909E-01 -1.23850 -2.67517 3: 0. 0. 3.22151 -0.604154 -1.46575 4: 0. 0. 0. 3.33229 0.604181 5: 0. 0. 0. 0. 2.64622 Set covariance SIGMA: Col 1 2 3 Row 1: 25. 5. 15. 2: 5. 17. 11. 3: 15. 11. 49. bartlett_sample ( 3, 3, sigma ): Col 1 2 3 Row 1: 8.00667 6.42711 -4.92795 2: 0. 2.74019 -2.54208 3: 0. 0. 1.99783 Eigenvectors of previous matrix: Col 1 2 3 Row 1: 0.659767 0.702857 -0.265894 2: 0.585267 -0.258670 0.768474 3: -0.471348 0.662633 0.582021 Eigenvalues of previous matrix: 1: 137.94402 2: 7.9697350 3: 1.7475691 INITIALIZE - Note: The RNGLIB package has been initialized. TEST06: Verify that, if using the same set of random numbers, W = T' * T, where W = wishart_sample ( n, df, sigma ) T = bartlett_sample ( n, df, sigma ) Covariance SIGMA: Col 1 2 3 Row 1: 25. 5. 15. 2: 5. 17. 11. 3: 15. 11. 49. INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 0.238323E-13 INITIALIZE - Note: The RNGLIB package has been initialized. TEST07: For given values of N, DF, SIGMA, the random\ matrices from the Wishart distribution: W = wishart_sample ( n, df, sigma ) should have mean DF * SIGMA. Fix N = 3 Fix DF = 5 Fix covariance SIGMA: Col 1 2 3 Row 1: 25. 5. 15. 2: 5. 17. 11. 3: 15. 11. 49. W_Average / DF: Col 1 2 3 Row 1: 24.7161 4.61329 14.5405 2: 4.61329 16.9612 10.6731 3: 14.5405 10.6731 47.8921 Frobenius norm of SIGMA-W_average/DF = 1.49815 INITIALIZE - Note: The RNGLIB package has been initialized. TEST08: Verify that, if using the same set of random numbers, inverse(W) = M, where W = wishart_unit_sample ( n, df ) M = wishart_unit_sample_inverse ( n, df ) INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 0.907904E-15 INITIALIZE - Note: The RNGLIB package has been initialized. TEST09: Verify that, if using the same set of random numbers, inverse(W) = M, where W = wishart_sample ( n, df, sigma ) M = wishart_sample_inverse ( n, df, sigma ) INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 0.183084E-14 WISHART_TEST Normal end of execution. 20 March 2018 9:53:22.770 AM