Last change
on this file since 790 was
747,
checked in by dubos, 6 years ago
|
devel/unstructured : more fixes to mixed precision
|
File size:
349 bytes
|
Line | |
---|
1 | "Helper function to manage mixed precision" |
---|
2 | import numpy as np |
---|
3 | from unstructured import np_num |
---|
4 | |
---|
5 | zero=np_num(0.) |
---|
6 | |
---|
7 | # cast array to float/double depending on CPP_MIXED_PREC |
---|
8 | def asnum(data): return [ x.astype(np_num) for x in data] if type(data) is list else data.astype(np_num) |
---|
9 | |
---|
10 | def zeros(dims): return np.zeros([n for n in dims if n>1], dtype=np_num) |
---|
Note: See
TracBrowser
for help on using the repository browser.