📄 blitz_1.html
字号:
<A NAME="IDX1"></A><A NAME="IDX2"></A><A NAME="IDX3"></A></P><P>Blitz++ uses <FONT SIZE="-1">GNU</FONT> Autoconf, which handles rewriting Makefiles forvarious platforms and compilers. It has greatly simplified installation andporting. Many thanks to John W. Eaton and Brendan Kehoe for their helpwith this.</P><P>To install blitz, unpack the <TT>`blitz-VERSION.tar.gz'</TT> file (it willinstall into a subdirectory <TT>`blitz-VERSION'</TT>). For example:</P><P><TABLE><tr><td> </td><td class=example><pre>[tveldhui@n2001:~] 32: ls -l blitz*.gz-rw-r--r-- 1 tveldhui users 480953 Jun 23 15:20 blitz-0.5.tar.gz[tveldhui@n2001:~] 33: gunzip blitz-0.5.tar.gz [tveldhui@n2001:~] 34: tar xvf blitz-0.5.tarblitz-0.5/CHANGELOGblitz-0.5/COPYINGblitz-0.5/INSTALLblitz-0.5/Makefile.inblitz-0.5/READMEblitz-0.5/THANKS . .</pre></td></tr></table></P><P>Then go into the <TT>`blitz-VERSION'</TT> directory, and type:</P><P><A NAME="IDX4"></A><TABLE><tr><td> </td><td class=example><pre>./configure CXX=[compiler]</pre></td></tr></table></P><P>where [compiler] is one of <CODE>xlc++</CODE>, <CODE>icpc</CODE>, <CODE>pathCC</CODE>, <CODE>xlC</CODE>, <CODE>cxx</CODE>, <CODE>aCC</CODE>, <CODE>CC</CODE>, <CODE>g++</CODE>, <CODE>KCC</CODE>, <CODE>pgCC</CODE> or <CODE>FCC</CODE>. (If you do not choose a C++ compiler, theconfigure script will attempt to find an appropriate compiler for thecurrent platform.)</P><P>By default, the configure script will use a particular set of optionswith each C++ compiler. You can disable these default settings and thensubstitute your own preferred compiler options with the CXXFLAGS variable,using this syntax:</P><P><TABLE><tr><td> </td><td class=example><pre>./configure CXX=g++ --disable-cxx-flags-preset CXXFLAGS="-ftemplate-depth-50"</pre></td></tr></table></P><P>If you are interested in benchmarking, you may want to use the option<CODE>--with-blas=...</CODE> to specify the path where the blas library is found.Run the configure script with the option <CODE>--help</CODE> to see all the available options.</P><P>Once the configure script is done, you can do any of these things:</P><P><DL COMPACT><DT><CODE>make lib</CODE><DD>Check the compiler and create <TT>`libblitz.a'</TT>.<P><DT><CODE>make check-testsuite</CODE><DD>Make the blitz library plus build and run the testsuite.<P><DT><CODE>make check-examples</CODE><DD>Make the blitz library plus build and run the examples.<P><DT><CODE>make check-benchmarks</CODE><DD>Make the blitz library plus build and run the benchmarks.<P><DT><CODE>make all</CODE><DD>Do all of the above. This may take a <STRONG>long</STRONG> time.<P><DT><CODE>make install</CODE><DD>Build the blitz library and documentation and install, along with theblitz header files, in prefix directory.</DL><P>Building the benchmark programs requires both a Fortran 77 and Fortran 90compiler.</P><P><HR SIZE="6"><A NAME="SEC21"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC20"> < </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC22"> > </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC22"> << </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC19"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> >> </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 1.4.2 The Blitz++ directory tree </H3><!--docid::SEC21::--><P>The main Blitz++ directory contains these subdirectories:</P><P><DL COMPACT><DT><CODE>blitz</CODE><DD>Blitz++ headers and source code files<P><DT><CODE>random</CODE><DD>Random number generators<P><DT><CODE>src</CODE><DD>Source code for <TT>`libblitz.a'</TT><P><DT><CODE>lib</CODE><DD>Location of <TT>`libblitz.a'</TT><P><DT><CODE>doc</CODE><DD>Documentation in HTML and PostScript<P><DT><CODE>testsuite</CODE><DD>Testsuite programs<P><DT><CODE>examples</CODE><DD>Example programs<P><DT><CODE>benchmarks</CODE><DD>Benchmark programs</DL><P><HR SIZE="6"><A NAME="SEC22"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> < </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> > </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> << </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC19"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> >> </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 1.4.3 Porting Blitz++ </H3><!--docid::SEC22::--><P>If you want to try porting Blitz++ to a new compiler or platform, I suggestthe following approach:</P><P><UL><LI>First check the Blitz++ web page to make sure you have the latestsnapshot, and that someone hasn't already ported blitz to your platform.<P><LI>Install autoconf (from e.g. <A HREF="ftp://prep.ai.mit.edu/pub/gnu">ftp://prep.ai.mit.edu/pub/gnu</A>) ifyou don't have it already.<P><LI>Run the configure script with CXX=[compiler]. Thiswill exercise your compiler to see what language features it supports. Ifit doesn't have member templates and enum computations, just give up. Youmay need to set CXXFLAGS to use compiler options that enable some languagefeatures.<P><LI>Once you know what compiler options are needed, you can make thesethe default settings for your C++ compiler. Make a backup of <TT>`m4/ac_cxx_flags_preset.m4'</TT>, and then edit the file to add anappropriate case for your compiler. Invoke autoconf to regenerate theconfigure script. Then try configure with your new preset flags.<P></UL><P><A NAME="compiling"></A><HR SIZE="6"><A NAME="SEC23"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC22"> < </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC24"> > </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC28"> << </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC1"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC28"> >> </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H2> 1.5 Compiling with Blitz++ </H2><!--docid::SEC23::--><P><HR SIZE="6"><A NAME="SEC24"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> < </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC25"> > </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC28"> << </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC28"> >> </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 1.5.1 Header files </H3><!--docid::SEC24::--><P>Blitz++ follows an X-windows style convention for header files. All headersare referred to with a prefix of <TT>`blitz'</TT>. For example, to use the<CODE>Array<T,N></CODE> class, one needs to include <CODE><blitz/array.h></CODE> insteadof just <CODE><array.h></CODE>. To make this work, the main Blitz++ directorymust be in your include path. For example, if Blitz++ was installed in<TT>`/software/Blitz++'</TT>, you will need to compile with <CODE>-I/software/Blitz++</CODE>.</P><P>If you have root privileges, you may want to put in a symbolic link from thestandard include path (e.g. <TT>`/usr/include/blitz/'</TT>) to the <CODE>blitz</CODE>directory of the distribution. This will allow you to omit the <CODE>-I...</CODE> option when compiling.</P><P><HR SIZE="6"><A NAME="SEC25"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC24"> < </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC26"> > </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC26"> << </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC28"> >> </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 1.5.2 Linking to the Blitz++ library </H3><!--docid::SEC25::--><P>The Blitz++ library file <TT>`libblitz.a'</TT> contains a few pieces of globaldata. You should ensure that the <TT>`lib'</TT> subdirectory of the Blitz++distribution is in your library path (e.g.<CODE>-L/usr/local/blitz-0.5/lib</CODE>) and include <CODE>-lblitz</CODE> on yourcommand line. If you use math functions, you should also compile with<CODE>-lm</CODE>.</P><P><HR SIZE="6"><A NAME="SEC26"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC25"> < </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC27"> > </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC27"> << </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC23"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC28"> >> </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -