📄 lowdiscrepancypoints.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*//* * HaltonPoints.java * * Created on April 17, 2002, 9:38 PM */package Examples.QuasiMonteCarlo;import QuasiRandom.*;import com.skylit.io.EasyReader;import java.awt.event.*;import javax.swing.WindowConstants;/** <p> Plots Halton or Sobol points projected on dimensions (i,j). * User determines the sequence (Halton/Sobol) i,j and the number * of points.</p> * * @author Michael J. Meyer */public class LowDiscrepancyPoints{ static int i,j,nPoints; static LowDiscrepancySequence S; /* Retrieve sequence, i,j,nPoints from user dialogue. */ static void user_dialogue() { EasyReader io=new EasyReader(); System.out.print ("POINT PROJECTIONS: which low discrepancy sequence?\n\n"+ "Halton (0)\n"+ "Sobol (1)\n"+ "NX (2), note: dimensions i,j must be less than 10.\n"+ "Uniform (3)\n\n"+ "Enter choice: "); int sequence=io.readInt(); System.out.println ("Enter dimensions (i,j) and number N of points:"); System.out.print("i= "); i=io.readInt(); System.out.print("j= "); j=io.readInt(); System.out.print("N= "); nPoints=io.readInt(); int dim=1+Math.max(i,j); switch(sequence) { case 0: S=new Halton(dim); break; case 1: S=new Sobol(dim); break; case 2: S=new NX(dim); break; case 3: S=new Uniform(dim); } } // end user dialogue public static void main(String[] args) { while(true){ user_dialogue(); final ProjectionPlot2D plot=S.projectionPlot(i,j,nPoints); // another run on mouseclick // window disposal restarts the infinite loop plot.addMouseListener(new MouseAdapter(){ public void mouseClicked(java.awt.event.MouseEvent event) { plot.dispose(); } }); // end mouseListener plot.show(); } // end while } // end main } // end HaltonPointProjections
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -