Skip to content

Commit c6fca93

Browse files
committed
release version 0.3.0
1 parent fa8ee5d commit c6fca93

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

README.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OrthNet
2-
TensorFlow and PyTorch layers for generating multi-dimensional Orthogonal Polynomials
2+
TensorFlow, PyTorch and Numpy layers for generating multi-dimensional Orthogonal Polynomials
33

44
## Installation:
55
1. the stable version:
@@ -13,7 +13,7 @@ python3 setup.py build_ext --inplace && python3 setup.py install
1313

1414
---
1515
## Orthogonal polynomials supported:
16-
- [Legendre polynomial](https://en.wikipedia.org/wiki/Legendre_polynomials)
16+
- [Legendre polynomial](https://en.wikipedia.org/wiki/Legendre_polynomials) with Normalized Legendre polynomial
1717
- [Laguerre polynomial](https://en.wikipedia.org/wiki/Laguerre_polynomials)
1818
- [Hermite polynomial](https://en.wikipedia.org/wiki/Hermite_polynomials)
1919
- hermite: He(x) in Wiki, the poly in probability theory
@@ -24,14 +24,32 @@ python3 setup.py build_ext --inplace && python3 setup.py install
2424
- [Jacobi polynomial](https://en.wikipedia.org/wiki/Jacobi_polynomials)
2525

2626
---
27-
## Usage: check `demo/` folder.
2827

29-
## Attributes:
30-
Class `Poly`:
28+
## Classes:
29+
- orthnet.Legendre(Poly)
30+
- orthnet.Legendre_Normalized(Poly)
31+
- orthnet.Laguerre(Poly)
32+
- orthnet.Hermite(Poly)
33+
- orthnet.Hermite2(Poly)
34+
- orthnet.Chebyshev(Poly)
35+
- orthnet.Chebyshev2(Poly)
36+
- orthnet.Jacobi(Poly)
37+
38+
## Base class:
39+
Class `Poly(module, degree, x, dtype = 'float32', loglevel = 0)`:
40+
41+
- Inputs:
42+
+ module: one of {'tensorflow', 'pytorch', 'numpy'}
43+
+ degree: the highest degree of target polynomial
44+
+ x: input tensor of type {tf.placaholder, tf.Variable, torch.Variable, torch.Tensor, numpy.ndarray, numpy.matrix}
45+
+ dtype: 'float32' or 'float64'
46+
+ loglevel: 1 to print time cost and 0 to mute
47+
3148
- `Poly.tensor`: return a tensor of function values
3249
- `Poly.combination`: return the combination of dimensions, in lexicographical order
3350
- `Poly.index`: return the index of the first combination of each degree in `self.combination`
3451
- `Poly.update(degree)`: update the degree of polynomial
3552
- `Poly.get_combination(start, end):`: return the combination of degrees from `start`(included) till `end`(included)
3653
- `Poly.get_poly(start, end)`: return the polynomials of degrees from `start`(included) till `end`(included)
3754
- `Poly.eval(coefficients)`: evaluate the value of polynomial with coefficients
55+
- `Poly.quadrature(func, weight)`: evaluate Gauss quadrature with target function and weights

orthnet/utils/timeit.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import time
2+
from functools import wraps
3+
4+
def timeit(loglevel):
5+
def _timeit(func):
6+
@wraps(func)
7+
def timed(*args, **kw):
8+
t1 = time.time()
9+
res = func(*args, **kw)
10+
print(func.__name__, (time.time() - t1))
11+
return res
12+
def untimed(*args, **kw):
13+
return func(*args, **kw)
14+
if loglevel == 0:
15+
return untimed
16+
elif loglevel == 1:
17+
return timed
18+
return _timeit

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
setup(
1515
name = 'orthnet',
16-
version = '0.2.2',
17-
keywords = ['orthogonal polynomial', 'tensorflow', 'pytorch'],
18-
description = 'TensorFlow and PyTorch layers for generating orthogonal polynomials',
16+
version = '0.3.0',
17+
keywords = ['orthogonal polynomial', 'tensorflow', 'pytorch', 'numpy'],
18+
description = 'TensorFlow, PyTorch and Numpy layers for generating orthogonal polynomials',
1919
license = 'MIT',
2020
author = 'Chuan Lu',
2121
author_email = '[email protected]',

0 commit comments

Comments
 (0)