forked from nrussell1aauto/armadillo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
541 lines (384 loc) · 18.2 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
Armadillo C++ Linear Algebra Library
http://arma.sourceforge.net
=== Contents ===
1: Introduction
2: Citation Details
3: Installation
3.0: Preliminaries
3.1: Installation on Linux and Mac OS X
3.2: Manual Installation / Installation on Windows
4: Compiling Programs and Linking
4.0: Examples
4.1: Compiling & Linking on Linux and Mac OS X
4.2: Compiling & Linking on Windows
5: Support for high-speed BLAS & LAPACK replacements
5.0: Support for OpenBLAS, Intel MKL and AMD ACML
5.1: Support for ATLAS
6: Documentation / API Reference Manual
7: MEX Interface to Octave & Matlab
8: Bug Reports and Frequently Asked Questions
9: Developers and Contributors
10: License
11: Related Software
=== 1: Introduction ===
Armadillo is a C++ linear algebra library (matrix maths)
aiming towards a good balance between speed and ease of use.
The syntax is deliberately similar to Matlab.
Integer, floating point and complex numbers are supported,
as well as a subset of trigonometric and statistics functions.
Various matrix decompositions are provided through optional
integration with LAPACK or high-performance LAPACK-compatible
libraries (such as Intel MKL or AMD ACML).
A delayed evaluation approach is employed (during compile time)
to combine several operations into one and reduce (or eliminate)
the need for temporaries. This is accomplished through recursive
templates and template meta-programming.
This library is useful for conversion of research code into
production environments, or if C++ has been decided as the
language of choice, due to speed and/or integration capabilities.
The library is open-source software, and is distributed under a license
that is useful in both open-source and commercial/proprietary contexts.
Armadillo is primarily developed at NICTA (Australia),
with contributions from around the world. More information
about NICTA can be obtained from http://nicta.com.au
=== 2: Citation Details ===
Please cite the following tech report if you use Armadillo in your
research and/or software. Citations are useful for the continued
development and maintenance of the library.
Conrad Sanderson.
Armadillo: An Open Source C++ Linear Algebra Library for
Fast Prototyping and Computationally Intensive Experiments.
Technical Report, NICTA, 2010.
=== 3.0: Installation: Preliminaries ===
Armadillo makes extensive use of template meta-programming,
recursive templates and template based function overloading.
As such, C++ compilers which do not fully implement the C++
standard may not work correctly.
The functionality of Armadillo is partly dependent on other libraries:
LAPACK, BLAS and ARPACK. The LAPACK and BLAS libraries are used for
dense matrices, while the ARPACK library is used for sparse matrices.
Armadillo can work without these libraries, but its functionality
will be reduced. In particular, basic functionality will be available
(eg. matrix addition and multiplication), but things like eigen
decomposition or matrix inversion will not be. Matrix multiplication
(mainly for big matrices) may not be as fast.
* For automatic installation on Linux and Mac OS X systems,
see section 3.1. This installation is also likely to work on
other Unix-like systems, such as FreeBSD, NetBSD, OpenBSD,
Solaris, CygWin, etc.
* For manual installation and/or installation on Windows,
see section 3.2.
* If you have a previous version of Armadillo already installed,
we recommend removing it before installing a newer version.
=== 3.1: Installation on Linux and Mac OS X ===
You can use the manual installation process as described in
section 3.2, or the following CMake based automatic installation.
* Step 1:
If CMake is not already be present on your system, download
it from http://www.cmake.org
On major Linux systems (such as Fedora, Ubuntu, Debian, etc),
cmake is available as a pre-built package, though it may need
to be explicitly installed (using a tool such as PackageKit,
yum, rpm, apt, aptitude).
* Step 2:
If you have LAPACK or BLAS, install them before installing Armadillo.
Under Mac OS X this is not necessary.
If you have ARPACK, install it before installing Armadillo.
On Linux systems it is recommended that the following libraries
are present: LAPACK, BLAS, ARPACK and ATLAS.
LAPACK and BLAS are the most important. It is also necessary to
install the corresponding development files for each library.
For example, when installing the "lapack" package, also install
the "lapack-devel" or "lapack-dev" package.
For best performance, we recommend using the multi-threaded
OpenBLAS library instead of standard BLAS.
See http://xianyi.github.com/OpenBLAS/
* Step 3:
Open a shell (command line), change into the directory that was
created by unpacking the armadillo archive, and type the following
commands:
cmake .
make
The full stop separated from "cmake" by a space is important.
CMake will figure out what other libraries are currently installed
and will modify Armadillo's configuration correspondingly.
CMake will also generate a run-time armadillo library, which is a
combined alias for all the relevant libraries present on your system
(eg. LAPACK, BLAS, ARPACK, ATLAS).
If you need to re-run cmake, it's a good idea to first delete the
"CMakeCache.txt" file (not "CMakeLists.txt").
Caveat: out-of-tree builds are currently not supported; for example,
creating a sub-directory called "build" and running cmake .. from
within "build" is currently not supported.
* Step 4:
If you have access to root/administrator/superuser privileges,
first enable the privileges (eg. through "su" or "sudo")
and then type the following command:
make install
If you don't have root/administrator/superuser privileges,
type the following command:
make install DESTDIR=my_usr_dir
where "my_usr_dir" is for storing C++ headers and library files.
Make sure your C++ compiler is configured to use the sub-directories
present within this directory.
=== 3.2: Manual Installation / Installation on Windows ===
The manual installation is comprised of 3 steps:
* Step 1:
Copy the entire "include" folder to a convenient location
and tell your compiler to use that location for header files
(in addition to the locations it uses already).
Alternatively, you can use the "include" folder directly.
* Step 2:
Modify "include/armadillo_bits/config.hpp" to indicate which
libraries are currently available on your system. For example,
if you have LAPACK, BLAS (or OpenBLAS) and ARPACK present,
uncomment the following lines:
#define ARMA_USE_LAPACK
#define ARMA_USE_BLAS
#define ARMA_USE_ARPACK
If you're not going to use sparse matrices, don't worry about ARPACK.
* Step 3:
If you have LAPACK and BLAS present, configure your
compiler to link with these libraries.
If using Linux, link using -llapack -lblas
If using Mac OS X, link using -framework Accelerate
If using Windows, see section 4.2.
You can also link with high-speed replacements for LAPACK and BLAS,
such as OpenBLAS, or Intel MKL, or AMD ACML. See section 5 for more info.
If you have ARPACK present, also link with it. For example,
under Linux link using -llapack -lblas -larpack
=== 4.0: Compiling Programs and Linking: Examples ===
The "examples" directory contains several quick example programs
that use the Armadillo library. If Armadillo was installed manually
(ie. according to section 3.2), you will also need to explicitly
link your programs with the libraries that were specified in
"include/armadillo_bits/config.hpp".
"example1.cpp" may require the BLAS library or its equivalent.
"example2.cpp" requires the LAPACK library or its equivalent
(eg. the Accelerate framework on Mac OS X).
You may get errors at compile or run time if BLAS and/or LAPACK
functions are not available.
NOTE: As Armadillo is a template library, we recommended that
optimisation is enabled during compilation. For example,
for the GCC compiler use -O1 or -O2
=== 4.1: Compiling & Linking on Linux and Mac OS X ===
Please see "examples/Makefile", which may may need to be configured
for your system. If Armadillo header files were installed in a
non-standard location, you will need to modify "examples/Makefile"
to tell the compiler where they are.
In general, programs which use Armadillo are compiled along these lines:
g++ example1.cpp -o example1 -O2 -larmadillo
(you may also need to specify the include directory via the -I switch)
If you get linking errors, or if Armadillo was installed manually
and you specified that LAPACK and BLAS are available, you will
need to explicitly link with LAPACK and BLAS (or their equivalents),
for example:
g++ example1.cpp -o example1 -O2 -llapack -lblas
(you may also need to specify the library directory via the -L switch)
If you have specified that ARPACK (or its equivalent) is available,
add -larpack to the compiler command line. For example:
g++ example1.cpp -o example1 -O2 -llapack -lblas -larpack
Notes:
* under most Linux systems, using "-llapack -lblas" should be enough;
however, on Ubuntu and Debian you may need to add "-lgfortran"
* under Mac OS X, try "-framework Accelerate" or "-llapack -lblas"
(the Accelerate option is usually the fastest)
* under the Sun Studio compiler, try "-library=sunperf"
=== 4.2: Compiling & Linking on Windows ===
Within the "examples" folder, we have included an MSVC project named "example1_win64"
which can be used to compile "example1.cpp". The project needs to be compiled as a
64 bit program: the active solution platform must be set to x64, instead of win32.
If you're getting messages such as "use of LAPACK needs to be enabled",
you will need to manually modify "include/armadillo_bits/config.hpp"
to enable the use of LAPACK. See section 3.2 for more information.
The MSCV project was tested on 64 bit Windows 7 with Visual C++ 2012.
You may need to make adaptations for 32 bit systems, later versions of Windows
and/or the compiler. For example, you may have to enable or disable
ARMA_BLAS_LONG and ARMA_BLAS_UNDERSCORE macros in "armadillo_bits/config.hpp".
The folder "examples/lib_win64" contains standard LAPACK and BLAS libraries compiled
for 64 bit Windows. The compilation was done by a third party. USE AT YOUR OWN RISK.
The compiled versions of LAPACK and BLAS were obtained from:
http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.html
You can find the original sources for standard BLAS and LAPACK at:
http://www.netlib.org/blas/
http://www.netlib.org/lapack/
Faster and/or alternative implementations of BLAS and LAPACK are available:
http://software.intel.com/en-us/intel-mkl/
http://developer.amd.com/tools-and-sdks/cpu-development/amd-core-math-library-acml/
http://xianyi.github.com/OpenBLAS/
http://www.stanford.edu/~vkl/code/libs.html
http://icl.cs.utk.edu/lapack-for-windows/lapack/
The MKL, ACML and OpenBLAS libraries are generally the fastest.
See section 5 for more info on making Armadillo use these libraries.
For better performance, we recommend the following high-quality C++ compilers:
GCC from MinGW: http://www.mingw.org/
GCC from CygWin: http://www.cygwin.com/
Intel C++ compiler: http://software.intel.com/en-us/intel-compilers/
For the GCC compiler, use version 4.2 or later.
For the Intel compiler, use version 11.0 or later.
For best results we also recommend using an operating system
that's more reliable and more suitable for heavy duty work,
such as Mac OS X, or various Linux-based systems:
Ubuntu http://www.ubuntu.com/
Debian http://www.debian.org/
OpenSUSE http://www.opensuse.org/
Fedora http://fedoraproject.org/
Scientific Linux http://www.scientificlinux.org/
Red Hat Enterprise Linux http://www.redhat.com/
=== 5.0: Support for OpenBLAS, Intel MKL and AMD ACML ===
Armadillo can use OpenBLAS, or Intel Math Kernel Library (MKL),
or the AMD Core Math Library (ACML) as high-speed replacements
for BLAS and LAPACK. Generally this just involves linking with
the replacement libraries instead of BLAS and LAPACK.
You may need to make minor modifications to "include/armadillo_bits/config.hpp"
in order to make sure Armadillo uses the same style of function names
as used by MKL or ACML. For example, the function names might be in capitals.
On Linux systems, MKL and ACML might be installed in a non-standard
location, such as /opt, which can cause problems during linking.
Before installing Armadillo, the system should know where the MKL or ACML
libraries are located. For example, "/opt/intel/mkl/lib/intel64/".
This can be achieved by setting the LD_LIBRARY_PATH environment variable,
or for a more permanent solution, adding the directory locations
to "/etc/ld.so.conf". It may also be possible to store a text file
with the locations in the "/etc/ld.so.conf.d" directory.
For example, "/etc/ld.so.conf.d/mkl.conf".
If you modify "/etc/ld.so.conf" or create "/etc/ld.so.conf.d/mkl.conf",
you will need to run "/sbin/ldconfig" afterwards.
Example of the contents of "/etc/ld.so.conf.d/mkl.conf" on a RHEL 6 system,
where Intel MKL version 11.0.3 is installed in "/opt/intel":
/opt/intel/lib/intel64
/opt/intel/mkl/lib/intel64
The default installations of ACML 4.4.0 and MKL 10.2.2.025 are known
to have issues with SELinux, which is turned on by default in Fedora
(and possibly RHEL). The problem may manifest itself during run-time,
where the run-time linker reports permission problems.
It is possible to work around the problem by applying an appropriate
SELinux type to all ACML and MKL libraries.
If you have ACML or MKL installed and they are persistently giving
you problems during linking, you can disable the support for them
by editing the "CMakeLists.txt" file, deleting "CMakeCache.txt" and
re-running the CMake based installation. Specifically, comment out
the lines containing:
INCLUDE(ARMA_FindMKL)
INCLUDE(ARMA_FindACMLMP)
INCLUDE(ARMA_FindACML)
=== 5.1: Support for ATLAS ===
Armadillo can use the ATLAS library for faster versions of
certain LAPACK and BLAS functions. Not all ATLAS functions are
currently used, and as such LAPACK should still be installed.
The minimum recommended version of ATLAS is 3.8.
Old versions (eg. 3.6) can produce incorrect results
as well as corrupting memory, leading to random crashes.
Users of older Ubuntu and Debian based systems should explicitly
check that ATLAS 3.6 is not installed. It's better to
remove the old version and use the standard LAPACK library.
=== 6: Documentation / API Reference Manual ===
A reference manual (documentation of APIs) is available at
http://arma.sourceforge.net/docs.html
and in the "docs.html" file in this archive,
which can be viewed with a web browser.
The documentation explains how to use Armadillo's
classes and functions, with snippets of example code.
=== 7: MEX Interface to Octave & Matlab ===
The "mex_interface" folder contains examples of how to interface
Octave and Matlab with C++ code that uses Armadillo matrices.
=== 8: Bug Reports and Frequently Asked Questions ===
Answers to frequently asked questions can be found at:
http://arma.sourceforge.net/faq.html
This library has gone through extensive testing and
has been successfully used in production environments.
However, as with almost all software, it's impossible
to guarantee 100% correct functionality.
If you find a bug in the library (or the documentation),
we are interested in hearing about it. Please make a
_small_ and _self-contained_ program which exposes the bug,
and then send the program source (as well as the bug description)
to the developers. The developers' contact details are at:
http://arma.sourceforge.net/contact.html
=== 9: Developers and Contributors ===
Main sponsoring organisation:
- NICTA
http://nicta.com.au
Main developers:
- Conrad Sanderson - http://conradsanderson.id.au
- Ryan Curtin - http://www.ratml.org
- Ian Cullinan
- Dimitrios Bouzas
- Stanislav Funiak
Contributors:
- Matthew Amidon
- Eric R. Anderson
- Benoît Bayol
- Salim Bcoin
- Justin Bedo
- Evan Bollig
- Darius Braziunas
- Filip Bruman
- Ted Campbell
- James Cline
- Chris Cooper
- Clement Creusot
- Chris Davey
- Alexandre Drouin
- Dirk Eddelbuettel
- Carles Fernandez
- Romain Francois
- Michael McNeil Forbes
- Piotr Gawron
- Charles Gretton
- Benjamin Herzog
- Edmund Highcock
- Szabolcs Horvat
- Friedrich Hust
- Yaron Keren
- Kshitij Kulshreshtha
- Oka Kurniawan
- Simen Kvaal
- David Lawrence
- Jussi Lehtola
- Jeremy Mason
- Nikolay Mayorov
- Carlos Mendes
- Sergey Nenakhov
- Artem Novikov
- Martin Orlob
- Ken Panici
- Adam Piątyszek
- Jayden Platell
- Vikas Reddy
- Ola Rinta-Koski
- Boris Sabanin
- James Sanders
- Alexander Scherbatey
- Gerhard Schreiber
- Ruslan Shestopalyuk
- Shane Stainsby
- Petter Strandmark
- Eric Jon Sundstrom
- Paul Torfs
- Martin Uhrin
- Simon Urbanek
- Unai Uribarri
- Juergen Wiest
- Arnold Wiliem
- Yong Kang Wong
- Buote Xu
- George Yammine
- Sean Young
=== 10: License ===
Unless specified otherwise, the Mozilla Public License v2.0 is used.
See the "LICENSE.txt" file for license details.
The file "include/armadillo_bits/fft_engine.hpp" is licensed under
both the Mozilla Public License v2.0 and a 3-clause BSD license.
See "include/armadillo_bits/fft_engine.hpp" for license details.
=== 11: Related Software ===
* MLPACK: C++ library for machine learning
and pattern recognition, built on top of Armadillo.
http://mlpack.org
* libpca: C++ library for principal component analysis
http://sourceforge.net/projects/libpca/
* KL1p: C++ library for sparse recovery of underdetermined linear systems,
such as compressed sensing.
http://kl1p.sourceforge.net
* ArmaNpy: interfaces Armadillo matrices with Python
http://sourceforge.net/projects/armanpy/