10.1: Questions about installation |
I downloaded Blitz++, but when I try to gunzip it, I get
"invalid compressed data--crc error". You forgot to set binary download mode in ftp. Do so with
the "binary" command.
I can't use gcc on my PC because it requires 45-150 Mb
to compile with Blitz++ Unfortunately this is true. If this problem is ever fixed, it
will be by the gcc developers, so my best suggestion is to post
a bug report to the gcc-bugs list.
I am using gcc under Solaris, and I get errors about
"relocation against external symbol". This problem can be fixed by installing the gnu linker and
binutils. Peter Nordlund found that by using gnu-binutils-2.9.1,
this problem disappeared. You can read a detailed
discussion at
http://oonumerics.org/blitz/support/blitz-support/archive/0029.html.
I am using gcc under Solaris, and the assembler gives
me an error that a symbol is too long. This problem can also be fixed by installing the gnu linker and
binutils. See the above question.
10.2: Questions about Blitz++ functionality |
For my problem, I need SVD, FFTs, QMRES, PLU, QR, .... Blitz++ does not currently provide any of these. However, there
are numerous C++ and C packages out there which do, and it is
easy to move data back and forth between Blitz++ and other
libraries. See these terms in the index: creating an array
from pre-existing data,
Can Blitz++ be interfaced with Python? Phil Austin has done so successfully. See a description of
his setup in
http://oonumerics.org/blitz/support/blitz-support/archive/0053.html.
If I try to allocate an array which is too big, my
program just crashes or goes into an infinite loop. Is there
some way I can handle this more elegantly? Blitz++ uses Here is an excerpt from the ISO/ANSI C++ standard
which describes the behaviour of You can use
When I pass arrays by value, the function which receives
them can modify the array data. Why? It's a result of
reference-counting. You have to think of array
objects as being "handles" to underlying arrays. The function
doesn't receive a copy of the array data, but rather
a copy of the handle.
The alternative would be to copy the array data
when passing by value, which would be grossly inefficient.
Why can't I use e.g. The operators data()
, stride()
,
extent()
, fortranArray
. For a list of other
numerical C++ libraries, see the Object Oriented Numerics
Page at
http://oonumerics.org/oon/.
new
to allocate memory for arrays.
In theory, your compiler should be throwing a
bad_alloc
exception when you run out of memory.
If it does, you can use a try/catch block to handle the
out of memory exception. If your compiler does
not throw bad_alloc
, you can install your own
new handler to handle out of memory.
new
:
set_new_handler
to create a new handler which
will issue an error message or throw an exception. For
example:
void my_new_handler()
{
cerr << "Out of memory" << endl;
cerr.flush();
abort();
}
...
// First line in main():
set_new_handler(my_new_handler);
A >> 3
to do bitshifting on arrays?<<
and >>
are used for input/ouput of arrays.
It would cause problems with the expression templates implementation
to also use them for bitshifting. However, it is easy enough to
define your own bitshifting function -- see 3.10.