📄 pathtiming.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*//* * PathTiming.java * * Created on September 4, 2002, 10:22 PM */package Examples.Libor;import Libor.LiborProcess.*;import Graphics.*;/** Computes 10000 full Libor paths (X-Libor only) in dimensions * <code>n=10,20,...,80</code> and plots the time taken for each run. * * @author Michael J. Meyer */public class PathTiming { public static void main(String[] args) { double[] time=new double[6]; for(int i=0;i<6;i++){ int n=10*(i+1); double before, after; before=System.currentTimeMillis(); // Libor parameter sample LMM_Parameters lmmParams=new LMM_Parameters(n,LMM_Parameters.CS); LiborProcess LP=new LiborProcess(lmmParams); for(int path=0;path<10000;path++)LP.newPath(); after=System.currentTimeMillis(); time[i]=(after-before)/1000; } // end for i JGraph graph=new JGraph(10,60); graph.setTitle("Time for 10000 full Libor paths (sec)"); graph.setXAxisLabel("dimension n"); graph.setBounds(120,30,550,400); graph.addSeries(time,"time (sec)"); graph.setVisible(true); try{ Thread.currentThread().sleep(2000); } catch( InterruptedException e){} graph.saveAsPNG(); } // end main} // end PathTiming
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -