Compiling blitz++ programs
Hello, how come I can compile and run a blitz++-program without linking
with -lblitz ?
The following program works both when compiled with g++ with or without
the -lblitz option. Running "ldd a.out" afterwards shows that it is linked
woth libblitz in the first case, and not in the other. But the program still
runs fine.
Best regards,
Torquil Sørensen
#include <iostream>
#include <blitz/array.h>
using namespace std; using namespace blitz;
int main() {
Array<int,2> a(3,3), b(3,3), c(3,2);
Array<int,2> d(3,3), e(3,2);
// Needed to do matrix multiplication by means of tensor notation
firstIndex i; secondIndex j; thirdIndex k;
// Can initialize all elements in one command
a = 1; b = 1; c = 1; d = 0; e = 0;
// Matrix Addition
d = a + b;
// Matrix multiplication, using tensor notation
e = sum(a(i,k)*c(k,j),k);
cout << "a:" << endl << a << endl;
cout << "b:" << endl << b << endl;
cout << "c:" << endl << c << endl;
cout << "a + b:" << endl << d << endl;
cout << "a*c:" << endl << e << endl;
return(0);
}
Reply to: