⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blitz_1.html

📁 c++经典教材 Blitz++ v0.8
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<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::SEC14::--><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="SEC15"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC14"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC12"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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::SEC15::--><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="SEC16"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC15"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC17"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &lt;&lt; </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#SEC21"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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::SEC16::--><P><HR SIZE="6"><A NAME="SEC17"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC18"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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::SEC17::--><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&#60;T,N&#62;</CODE> class, one needs to include <CODE>&#60;blitz/array.h&#62;</CODE> insteadof just <CODE>&#60;array.h&#62;</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="SEC18"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC17"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC19"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC19"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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::SEC18::--><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="SEC19"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC18"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC20"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC20"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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.3 An example Makefile </H3><!--docid::SEC19::--><P>Here is a typical skeletal Makefile for compiling with Blitz++ under gcc:</P><P><TABLE><tr><td>&nbsp;</td><td class=smallexample><FONT SIZE=-1><pre># Path where Blitz++ is installedBZDIR = /usr/local/blitzCXX = g++# Flags for optimized executables# CXXFLAGS = -O2 -I$(BZDIR) -ftemplate-depth-30# Flags for debuggingCXXFLAGS = -ftemplate-depth-30 -g -DBZ_DEBUG -I$(BZDIR)LDFLAGS =LIBS = -L$(BZDIR)/lib -lblitz -lmTARGETS = myprogram1 myprogram2.SUFFIXES: .o .cpp.cpp.o:    $(CXX) $(CXXFLAGS) -c $*.cpp$(TARGETS):    $(CXX) $(LDFLAGS) $@.o -o $@ $(LIBS)all:    $(TARGETS)myprogram1:      myprogram1.omyprogram2:      myprogram2.oclean:    -rm -f *.o $(TARGETS)</FONT></pre></td></tr></table></P><P>There are more example makefiles in the examples, testsuite, and benchmarksdirectories of the distribution.</P><P><HR SIZE="6"><A NAME="SEC20"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC19"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC16"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_1.html#SEC21"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -