Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/numarray_tests.py @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.4 KB
Line 
1# Copyright David Abrahams 2006. Distributed under the Boost
2# Software License, Version 1.0. (See accompanying
3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4import printer
5
6# So we can coerce portably across Python versions
7bool = type(1 == 1)
8
9'''
10>>> from numpy_ext import *
11>>> x = new_array()
12>>> y = x.copy()
13>>> p = _printer()
14>>> check = p.check
15>>> exercise_numarray(x, p)
16
17>>> check(str(y))
18
19>>> check(y.argmax());
20>>> check(y.argmax(0));
21
22>>> check(y.argmin());
23>>> check(y.argmin(0));
24
25>>> check(y.argsort());
26>>> check(y.argsort(1));
27
28>>> y.byteswap();
29>>> check(y);
30
31>>> check(y.diagonal());
32>>> check(y.diagonal(1));
33>>> check(y.diagonal(0, 0));
34>>> check(y.diagonal(0, 1, 0));
35
36>>> check(y.is_c_array());
37
38# coerce because numarray still returns an int and the C++ interface forces
39# the return type to bool
40>>> check( bool(y.isbyteswapped()) );
41
42>>> check(y.trace());
43>>> check(y.trace(1));
44>>> check(y.trace(0, 0));
45>>> check(y.trace(0, 1, 0));
46
47>>> check(y.new('D').getshape());
48>>> check(y.new('D').type());
49>>> y.sort();
50>>> check(y);
51>>> check(y.type());
52
53>>> check(y.factory((1.2, 3.4)));
54>>> check(y.factory((1.2, 3.4), "f8"))
55>>> check(y.factory((1.2, 3.4), "f8", true))
56>>> check(y.factory((1.2, 3.4), "f8", true, false))
57>>> check(y.factory((1.2, 3.4), "f8", true, false, None))
58>>> check(y.factory((1.2, 3.4), "f8", true, false, None, (1,2,1)))
59
60>>> p.results
61[]
62>>> del p
63'''
Note: See TracBrowser for help on using the repository browser.