📄 matrices.java
字号:
/* WARANTY NOTICE AND COPYRIGHTThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.Copyright (C) Michael J. Meyermatmjm@mindspring.comspyqqqdia@yahoo.com*//* * Matrices.java * * Created on May 26, 2002, 11:37 PM */package Examples.QuasiMonteCarlo;/** Test of the row encoding for the NX sequence generator matrices in * dimension 12. * The test reveals that each row is encoded right to left ie. the most * significant bit is the leftmost bit. * * @author Michael J. Meyer */public class Matrices { public static void main(String[] args) { boolean fails=false; int M=30; // loop through the dimensions for(int j=0;j<12;j++){ int[][] Cj=C[j]; // generator matrix in dimension j // loop through the rows and encode them for(int i=0;i<M;i++){ // process ith row, bits increase in significance // right to left int row_i=0; for(int k=0;k<M;k++) if(Cj[i][M-k-1]==1)row_i+=(1<<k); // test the encoding against the download if(row_i!=rm[j][i]){ System.out.println("Failure: j="+j+", row="+i); fails=true; } } } if(!fails)System.out.println("Encodings match."); } // row encoded 12 dimensional gnerator matrices public static final int[][] rm={ {455734274,770944497,251274392,943939844,634593383,142647816,518405655,1035112060,686290424,65615251,693694295,260630152,43423443,881037832,267195896,910495556,605034094,965336736,151131045,582450365,288640393,124889081,201348992,232395086,964441802,612863572,1058289724,400689983,769068112,870006638},{442034405,43938580,530724371,1060644604,1057605153,312158786,847892251,1022077706,18501972,383515470,371298986,47901519,323627800,867544471,192786854,203960857,720589590,545513545,464140138,547595136,376987492,501322404,192506954,737887979,949009184,729312279,192921452,991695031,102006938,776205479},{388727334,696774466,350675311,1063266075,378755246,1019011080,540197062,820200324,366443609,41446382,903249144,329275036,1052721345,498980004,58772674,999024019,969764777,1051794123,99786007,727840180,172373356,204871234,384889035,806403840,53695037,13616293,66161898,186684471,98164394,355219262},{217386272,693439660,965615244,154762973,436447974,799925933, 668492905,842607298,791036533,626067281,22239456,678586727, 806410990,935957395,13378684,139417906,542947431,866282064, 955470920,476415717,29319813,738723019,310863222,837714036, 747917136,328347967,851029220,767666096,964745988,401734446}, {124426506,534017541,504807159,389066462,356357537,725316735,659277475,756136726,958461663,655058111,114257772,133795835,1023812401,378615015,543820138,371991839,810602804,101893785,247079695,198575477,217168727,930751227,875740551,1021343329,521456293,239470050,84958534,620743129,123271774,544238382},{669572624,333843660,444346220,356140799,190081678,512353278, 796921871,600415539,453475202,848657261,603109415,745283747, 151883079,1060772111,714582242,271029343,735760924,35818366, 208189017,742934659,723194823,754382856,220628662,157700063, 118306598,536381889,565112788,101605440,100486671,530359790}, {719846920,52922347,936119517,608310191,510418084,1033430645,567827140,661160957,258328750,718946670,236310941,133803377,168935681,1043464914,987196881,459837085,823469307,851754223,184441250,596703707,290780171,59741935,815598374,416271082,334275066,488096772,482629079,1019633822,257691498,612146801},{915787995,171742109,134941161,748302528,401228388,175745030, 524781059,599865139,22024809,736041817,37791189,53443125, 1022208028,618558541,973936607,680773347,231100310,188099243, 387492997,997909507,712762618,864453370,971076324,422303104, 887951713,70908379,321106277,37257531,377525304,993066805}, {541243164,109743129,792736603,187956981,26958383,853015617,329470240,172383273,874347828,235666399,427079847,514437634,633169581,837815932,208607260,888137353,588084793,689649957,913247571,957569656,82894851,272748879,517167675,597600805,14301272,421502435,535550497,489600072,588119866,486064591},{229677813,200942584,1056966489,703305147,118583330,634757241, 367117372,850863584,691542163,625261051,975595510,687522116, 186898165,247234909,363416034,1035231735,75052476,868760869, 950694368,433949613,253713205,898716701,270518328,164766745, 50123223,106155344,691291959,83686480,349811315,867635353}, {762318664,1073642543,564967196,486146330,994152282,480436438,40635107,901402239,767712015,403085167,913686502,676736454,283632149,207423788,1032456183,556764953,573432388,539147584,1053096806,246348695,866546419,318131241,409479478,19314747,142040277,669577250,670828194,766440062,1037065698,815986243},{1068147734,982381558,190909672,227921657,374739209,345354308, 301243259,490874673,152439690,424307886,256544451,446409440, 88939318,927493863,540479486,605696652,105999616,700777601, 839609487,642661344,269620503,649934339,297064636,632059693, 671701847,257012421,270575278,928304922,853023247,878153656}, }; // end rm public static final int[][][] C={ /*C(0)*/{{0,1,1,0,1,1,0,0,1,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0},{1,0,1,1,0,1,1,1,1,1,0,0,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1},{0,0,1,1,1,0,1,1,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,0},{1,1,1,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0},{1,0,0,1,0,1,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,1,1},{0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0},{0,1,1,1,1,0,1,1,1,0,0,1,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,1,1,1},{1,1,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,1,1,0,0,1,1,1,1,1,0,0},{1,0,1,0,0,0,1,1,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,0,0},{0,0,0,0,1,1,1,1,1,0,1,0,0,1,0,0,1,1,0,1,0,1,1,0,0,1,0,0,1,1},{1,0,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,0,1,1,1},{0,0,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,1,0,0,0,1,0,0,0},{0,0,0,0,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,1,0,1,0,0,1,1},{1,1,0,1,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,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