@@ -18,13 +18,13 @@ Numpy and Pandas can be used for large datasets and computations. The sequential
1818computation on small data can be any code that
1919`Numba supports <http://numba.pydata.org/numba-doc/latest/index.html >`_.
2020
21- Supported Numpy Functions
22- -------------------------
21+ Supported Numpy Operations
22+ --------------------------
2323
2424Below is the list of the data-parallel Numpy operators that HPAT can optimize
2525and parallelize.
2626
27- 1. Numpy `element-wise ` or ` point-wise ` array operations:
27+ 1. Numpy `element-wise ` array operations:
2828
2929 * Unary operators: ``+ `` ``- `` ``~ ``
3030 * Binary operators: ``+ `` ``- `` ``* `` ``/ `` ``/? `` ``% `` ``| `` ``>> `` ``^ ``
@@ -46,7 +46,8 @@ and parallelize.
4646
47472. Numpy reduction functions ``sum `` and ``prod ``.
4848
49- 3. Numpy array creation functions ``zeros ``, ``ones ``
49+ 3. Numpy array creation functions ``empty ``, ``zeros ``, ``ones ``,
50+ ``empty_like ``, ``zeros_like ``, ``ones_like ``, ``full_like ``, ``copy ``.
5051
51524. Random number generator functions: ``rand ``, ``randn ``,
5253 ``ranf ``, ``random_sample ``, ``sample ``, ``random ``,
@@ -83,25 +84,58 @@ reduction::
8384 s += A[i]
8485 return s
8586
86- Supported Pandas Functions
87- --------------------------
87+ Supported Pandas Operations
88+ ---------------------------
8889
8990Below is the list of the Pandas operators that HPAT supports. Since Numba
9091doesn't support Pandas, only these operations can be used for both large and
9192small datasets.
9293
93- 1. Dataframe creation with the ``DataFrame `` constructor. Only a dictionary is
94- supported as input. For example::
94+ 1. HPAT supports Dataframe creation with the ``DataFrame `` constructor.
95+ Only a dictionary is supported as input. For example::
9596
9697 df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)})
9798
98- 2. Accessing columns using both getitem (e.g. ``df['A'] ``) and attribute (``df.A ``) is supported.
99-
100- 3. Using columns similar to Numpy arrays and performing data-parallel operations listed previously is supported.
99+ 2. Accessing columns using both getitem (e.g. ``df['A'] ``) and attribute
100+ (e.g. ``df.A ``) is supported.
101+
102+ 3. Using columns similar to Numpy arrays and performing data-parallel operations
103+ listed previously is supported.
104+
105+ 4. Filtering data frames using boolean arrays is supported
106+ (e.g. ``df[df.A > .5] ``).
107+
108+ 5. Rolling window operations with `window ` and `center ` options are supported.
109+ Here are a few examples::
110+
111+ df.A.rolling(window=5).mean()
112+ df.A.rolling(3, center=True).apply(lambda a: a[0]+2*a[1]+a[2])
101113
102- 4. s
114+ 6. ``shift `` operation (e.g. ``df.A.shift(1) ``) and ``pct_change `` operation
115+ (e.g. ``df.A.pct_change() ``) are supported.
103116
104117File I/O
105118--------
106119
107120Currently, HPAT only supports I/O for the `HDF5 <http://www.h5py.org/ >`_ format.
121+ The syntax is the same as the `h5py <http://www.h5py.org/ >`_ package.
122+ For example::
123+
124+ @hpat.jit
125+ def example():
126+ f = h5py.File("lr.hdf5", "r")
127+ X = f['points'][:]
128+ Y = f['responses'][:]
129+
130+ HPAT needs to know the types of input arrays. If the file name is a constant
131+ string, HPAT tries to look at the file at compile time and recognize the types.
132+ Otherwise, the user is responsile for providing the types similar to
133+ `Numba's typing syntax
134+ <http://numba.pydata.org/numba-doc/latest/reference/types.html> `_. For
135+ example::
136+
137+ @hpat.jit(locals={'X': hpat.float64[:,:], 'Y': hpat.float64[:]})
138+ def example(file_name):
139+ f = h5py.File(file_name, "r")
140+ X = f['points'][:]
141+ Y = f['responses'][:]
0 commit comments