source: git/ntl/doc/tour-win.html @ 199b5c

fieker-DuValspielwiese
Last change on this file since 199b5c was 2cfffe, checked in by Hans Schönemann <hannes@…>, 22 years ago
This commit was generated by cvs2svn to compensate for changes in r6316, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6317 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.8 KB
Line 
1<html>
2<head>
3<title>
4A Tour of NTL: Obtaining and Installing NTL for Windows
5and other Platforms </title>
6</head>
7
8<body bgcolor="#fff9e6">
9<center>
10<a href="tour-unix.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a>
11 <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> 
12<a href="tour-impl.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a>
13</center>
14
15<h1> 
16<p align=center>
17A Tour of NTL: Obtaining and Installing NTL for Windows
18and other Platforms
19</p>
20</h1>
21
22<p> <hr> <p>
23
24The WinNTL distribution of
25NTL can be used on any Windows 95 or NT platform
26(but not on Windows 3.11 or earlier).
27Actually, there is nothing Windows-specific about WinNTL.
28The source code is identical to the UNIX NTL distribution;
29only the packaging is slightly different, and no assumptions
30are made about the program development environment.
31Thus, it should be possible to install WinNTL on
32other operating systems (e.g., Macintosh, OS/2)
33with little difficulty.
34
35<p>
36<b>
37Obtaining and unpacking NTL.
38</b>
39<p>
40
41To obtain the source code and documentation for NTL,
42<a href="http://www.shoup.net/ntl/download.html">
43download <tt>WinNTL-xxx.zip</tt></a>.
44Here, "<tt>xxx</tt>" is the current version number.
45Then <tt>unzip</tt> this file into a directory (folder).
46This will unpack everything into a directory called "<tt>WinNTL-xxx</tt>".
47Inside this directory, you will find several directories.
48
49<p>
50
51<ul>
52<li>
53
54The directory "<tt>doc</tt>" contains all of NTL's documentation,
55including this "tour" ("<tt>tour.html</tt>")
56and the "<tt>.txt</tt>" files explaining each module,
57which can be accessed directly, or through the "tour".
58
59<p>
60<li>
61
62The directory "<tt>src</tt>"
63contains all of the source files for the library,
64all with "<tt>.cpp</tt>" extensions.
65The file "<tt>lip.cpp</tt>" can be compiled as a C source file
66(this can sometimes yield a marginal performance gain).
67
68<p>
69<li>
70
71The directory "<tt>include</tt>" contains a single directory called
72"<tt>NTL</tt>",
73and the latter contains all of the "<tt>.h</tt>" files.
74
75</ul>
76
77<p>
78
79<b>
80Platform dependent macros.
81</b>
82<p>
83
84In directory "<tt>include/NTL</tt>" there is a file called
85"<tt>mach_desc.h</tt>",
86which contains all of the platform-dependent macro definitions.
87The default settings should be correct for any x86- or Pentium-based
88system running Windows; however, the correct definitions
89can depend on the compiler and run-time environment.
90Therefore, to be on the safe side,
91you might consider compiling and running the program <tt>MakeDesc</tt>,
92whose source files are in directory "<tt>MakeDesc</tt>".
93This program will
94dynamically build
95a correct "<tt>mach_desc.h</tt>" for your platform (processor, compiler,
96run-time environment).
97To get accurate results,
98you must compile this program using the level of optimization
99(or higher) that you will use for NTL.
100The program will print some diagnostics to the screen,
101and create the file "<tt>mach_desc.h</tt>" (in the current
102directory, and not in the "<tt>include/NTL</tt>" directory,
103where it needs to go).
104
105<p>
106<b>
107Configuration flags.
108</b>
109<p>
110
111Also in directory "<tt>include/NTL</tt>" is a file called "<tt>config.h</tt>".
112You can edit this file to override some of NTL's default options
113for <i>basic configuration</i> and <i>performance</i>.
114
115<p>
116
117<dl>
118<dt>
119<i>Basic configuration options.</i>
120<dd>
121Most of the these flags are rather esoteric and can be safely
122ignored.
123<p>
124
125One exception to this is the <tt>NTL_STD_CXX</tt>  flag
126(or perhaps just the <tt>NTL_PSTD_NNS</tt> flag) which
127you will want to set if you want to take advantage of
128the new <i>namespace</i> feature of <tt>C++</tt>.
129<a href="tour-stdcxx.html">Go here</a> for details.
130
131<p>
132
133Another exception are the flags to use GMP for potentially
134faster long integer arithmetic.
135See the <a href="tour-gmp.html">GMP</a> section for more details.
136Note that getting GMP to run on Windows is a pain in the neck.
137If you really want to use GMP, use Unix or Linux!
138
139<p>
140
141<dt>
142<i>Performance options.</i>
143<dd>
144These flags let you fine tune for best performance.
145can let the <i>configuration wizard</i>
146set them for you.
147
148<p>
149<i>TIP for Pentium platforms:</i> 
150<ul>
151<li>
152Users running
153on a Pentium, or other x86-like processor,
154will almost surely want to set the <tt>NTL_LONG_LONG</tt> flag,
155or possibly the <tt>NTL_AVOID_FLOAT</tt> flag, in file <tt>config.h</tt>
156to get the best performance for long integer arithmetic.
157If you set either of these flags, you should also set the
158<tt>NTL_TBL_REM</tt> flag as well, to get the best
159performance for <tt>ZZ_pX</tt> arithmetic.
160
161<li>
162These flags can be useful on other platforms as well,
163especially on processors with slow int/float conversion.
164
165<li>
166The best thing is to experiment, and compile and run program <tt>Test</tt>
167to see the impact on the running time of various basic operations.
168</ul>
169</dl>
170
171<p>
172Note that the file "<tt>def_config.h</tt>"
173contains a backup copy of the original <tt>config.h</tt> file.
174
175
176<p>
177<b>
178Test programs.
179</b>
180<p>
181
182The directory "<tt>tests</tt>" contains several test programs.
183For each program <tt>FooTest</tt>, there is a source file
184"<tt>FooTest.cpp</tt>", and optionally two files
185"<tt>FooTestIn</tt>" and "<tt>FooTestOut</tt>".
186If the latter  exist, then the program should be run with
187the "<tt>FooTestIn</tt>" as standard input;
188correct output (printed to standard output) should match
189the contents of "<tt>FooTestOut</tt>" exactly;
190note that these programs also print diagnostic output on the screen
191(through standard error output).
192
193<p>
194<b>
195Timing functions.
196</b>
197<p>
198
199The directory "<tt>GetTime</tt>" contains several alternative
200definitions of the <tt>GetTime()</tt> function.
201The file "<tt>GetTime.cpp</tt>" in the "<tt>src</tt>" directory should be OK,
202but your compiler might like one of the definitions in
203the directory "<tt>GetTime</tt>" better.
204
205<p>
206<b>
207Other tools.
208</b>
209<p>
210
211The directory "<tt>misc</tt>" contains a program <tt>newnames.cpp</tt>
212to help make the
213transition to NTL version 3.5 from earlier versions of NTL.
214See the <a href="tour-changes.html">changes</a> section for more details.
215It also contains the programs <tt>gen_lip_gmp_aux.cpp</tt>
216and <tt>gen_gmp_aux.cpp</tt> that automatically generate
217the auxilliary files needed when using NTL with GMP.
218You will have to look at the makefile in the Unix distribution
219to see how to use these.
220
221
222
223<p>
224<b>
225Compiling NTL.
226</b>
227<p>
228
229Since there are a number of incompatible compilers and program development
230environments available for Windows, no attempt has been made to
231provide automatic tools for building and testing,
232as is done for the Unix distribution.
233Nevertheless,
234it should be straightforward to install NTL (even if it involves a bit of
235pointing and clicking).
236First, compile all of the files in "<tt>src</tt>", and create a static library.
237Make sure the compiler knows where to find NTL's include files
238(directory "<tt>include</tt>" and <i>not</i> "<tt>include/NTL</tt>")
239Then, to compile a program using the library,
240make sure the compiler knows about the library and the directory
241of NTL's include files.
242In any case, if you want to do any serious computations,
243you will certainly  want to compile everything with your
244compiler's code optimizer on.
245
246<p>
247For the benefit of those who must use Microsoft Visual C++ on Windows,
248here are some steps for compiling and using NTL.
249These steps work with MSVC++ v6.
250While these steps seem to do the job,
251there may be other steps that work better.
252
253The following steps may be used to build the library,
254and to build and run program <tt>Test</tt>, as a simple
255<i>console application</i>, using the library.
256The instructions assume you have already
257unzipped NTL into a directory <tt>c:\mystuff</tt>,
258and are running the MSVC++ Development Studio.
259
260<p>
261I hope these instructions make some sense:
262I don't know a good language for accuratly describing the
263particular pointing an clicking steps.
264
265<p>
266
267<pre>
268
269File -&gt; New -&gt; Projects
270   project name: ntl
271   location[default]: c:\Program Files\Microsoft Visual Studio\MyProjects\ntl
272   Click on Win32 static library
273   Click on OK
274   pre-compiled headers[default]: no
275   MFC support[default]: no
276   Click on Finish
277   Click on OK
278
279Project -&gt; Add to Project -&gt; Files
280   select all files in c:\mystuff\WinNTL-5_1a\src and click on OK.
281
282Project -&gt; Settings -&gt; C/C++
283   Category: Preprocessor.
284   Additional include directories: c:\mystuff\WinNTL-5_1a\include.
285   Click on OK.
286
287Build -&gt; build ntl.lib
288
289File -&gt; New -&gt; Projects -&gt; Win32 Console Application
290   project name: test
291   location[default]: c:\Program Files\Microsoft Visual Studio\MyProjects\ntl
292   Click on Win32 Console Application
293   Click on OK
294   What kind of windows application...? [default]: An empty project
295   Click on Finish
296   Click on OK
297
298Project -&gt; Add to Project -&gt; Files
299   select the file c:\mystuff\WinNTL-5_1a\tests\Test.cpp
300   Click on OK
301
302Project -&gt; Add to Project -&gt; Files
303   select the file
304      c:\Program Files\Microsoft Visual Studio\MyProjects\ntl\Debug\ntl.lib
305   Note: one must select Files of type: Library Files (.lib) to make this
306      file visible in the pop-up window.
307   Click on OK
308
309Project -&gt; Settings -&gt; C/C++
310   Category: Preprocessor.
311   Additional include directories: c:\mystuff\WinNTL-5_1a\include.
312   Click on OK.
313
314Build -&gt; build test.exe
315
316Build -&gt; execute test.exe
317
318</pre>
319
320<p>
321<b>
322Further remarks.
323</b>
324<p>
325
326<p>
327<i>TIP:</i>  When writing programs using NTL,
328you should include files using the syntax
329<pre>
330   #include &lt;NTL/ZZ.h&gt;
331</pre>
332and <i>not</i> using a backslash ("<tt>\</tt>") as a delimiter.
333
334<p>
335<i>TIP:</i> When writing <i>windows applications</i> using NTL
336(as opposed to <i>console applications</i>) you might want to compile
337your program with the <tt>NTL_NO_MIN_MAX</tt> macro defined.
338This suppresses  the declaration of several <tt>min</tt>
339and <tt>max</tt> functions in file <tt>tools.h</tt> that conflict
340with macro names in the MFC header files.
341Do not attempt to build the library with this macro defined -- only
342programs that use the library.
343
344<p>
345NTL has been successfully installed and tested
346on Windows 95 platforms with both the
347Microsoft and Borland compilers.
348
349<p>
350If you have installed the Unix tools from
351<a href="http://www.cygnus.com">Cygnus</a>, then you can use the
352<a href="tour-unix.html">Unix</a> distribution of NTL.
353This distribution has been specially tailored to work smoothly
354with Cygnus tools.
355For many programmers,
356this is a much more comfortable and reliable program development environment
357than commercial systems like those from Microsoft and Borland.
358And moreover, these Unix tools are <i>free</i>.
359Of course, an even better approach is to install
360<a href="http://www.linux.org">Linux</a> on your PC.
361
362
363<p>
364
365<center>
366<a href="tour-unix.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a>
367 <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> 
368<a href="tour-impl.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a>
369</center>
370
371
372</body>
373</html>
Note: See TracBrowser for help on using the repository browser.