1 | #define BZ_GENERATE_GLOBAL_INSTANCES
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * This module contains instances of global variables and objects.
|
---|
5 | * The preprocessor symbol _bz_global normally expands to "extern",
|
---|
6 | * but the declaration of BZ_GENERATE_GLOBAL_INSTANCES causes it
|
---|
7 | * to expand to "" for this source file. This ensures that globals
|
---|
8 | * will have one unique instance, in libblitz.a.
|
---|
9 | */
|
---|
10 |
|
---|
11 | #include <blitz/indexexpr.h> // Tensor index objects
|
---|
12 | #include <blitz/bzdebug.h> // Test suite globals
|
---|
13 | #include <blitz/array.h> // Dummy array object (_dummyArray)
|
---|
14 |
|
---|
15 | // NEEDS_WORK: after switch from RCS to CVS, get a version identifier.
|
---|
16 | char* _blitz_id = "@(#) Blitz++ class library";
|
---|
17 |
|
---|
18 | // Instatiation explicite de vecteurs et matrices
|
---|
19 |
|
---|
20 | using namespace blitz ;
|
---|
21 |
|
---|
22 | void tst_instance_arrays_forlibs()
|
---|
23 | {
|
---|
24 | Array<int,1> iv(3), iv2(3);
|
---|
25 | Array<long,1> lv(3), lv2(3);
|
---|
26 | Array<float,1> fv(3), fv2(3);
|
---|
27 | Array<double,1> dv(3), dv2(3);
|
---|
28 | Array<int,2> im(3,3);
|
---|
29 | Array<long,2> lm(3,3);
|
---|
30 | Array<float,2> fm(3,3);
|
---|
31 | Array<double,2> dm(3,3);
|
---|
32 | dv = 1.5, 22.66, 333.777;
|
---|
33 | dm = 9.1, 88.22, 777.333,
|
---|
34 | 8.2, 77.33, 666.444,
|
---|
35 | 7.3, 66.44, 555.333;
|
---|
36 | firstIndex i;
|
---|
37 | secondIndex j;
|
---|
38 | dv2 = sum(dm(i,j)*dv(j),j);
|
---|
39 | iv = lv = fv = dv;
|
---|
40 | im = lm = fm = dm;
|
---|
41 | fv2 = sum(fm(i,j)*fv(j),j);
|
---|
42 | iv2 = sum(im(i,j)*iv(j),j);
|
---|
43 | lv2 = sum(lm(i,j)*lv(j),j);
|
---|
44 | }
|
---|