Python numpy.core.numeric.ceil() Examples
The following are 6
code examples of numpy.core.numeric.ceil().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.core.numeric
, or try the search function
.
Example #1
Source File: ufunclike.py From lambda-packs with MIT License | 5 votes |
def fix(x, y=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ------- out : ndarray of floats The array of rounded numbers See Also -------- trunc, floor, ceil around : Round to given number of decimals Examples -------- >>> np.fix(3.14) 3.0 >>> np.fix(3) 3.0 >>> np.fix([2.1, 2.9, -2.1, -2.9]) array([ 2., 2., -2., -2.]) """ x = nx.asanyarray(x) y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y
Example #2
Source File: ufunclike.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def fix(x, y=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ------- out : ndarray of floats The array of rounded numbers See Also -------- trunc, floor, ceil around : Round to given number of decimals Examples -------- >>> np.fix(3.14) 3.0 >>> np.fix(3) 3.0 >>> np.fix([2.1, 2.9, -2.1, -2.9]) array([ 2., 2., -2., -2.]) """ x = nx.asanyarray(x) y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y
Example #3
Source File: ufunclike.py From Computable with MIT License | 5 votes |
def fix(x, y=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ------- out : ndarray of floats The array of rounded numbers See Also -------- trunc, floor, ceil around : Round to given number of decimals Examples -------- >>> np.fix(3.14) 3.0 >>> np.fix(3) 3.0 >>> np.fix([2.1, 2.9, -2.1, -2.9]) array([ 2., 2., -2., -2.]) """ x = nx.asanyarray(x) y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y
Example #4
Source File: ufunclike.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def fix(x, y=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ------- out : ndarray of floats The array of rounded numbers See Also -------- trunc, floor, ceil around : Round to given number of decimals Examples -------- >>> np.fix(3.14) 3.0 >>> np.fix(3) 3.0 >>> np.fix([2.1, 2.9, -2.1, -2.9]) array([ 2., 2., -2., -2.]) """ x = nx.asanyarray(x) y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y
Example #5
Source File: ufunclike.py From ImageFusion with MIT License | 5 votes |
def fix(x, y=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ------- out : ndarray of floats The array of rounded numbers See Also -------- trunc, floor, ceil around : Round to given number of decimals Examples -------- >>> np.fix(3.14) 3.0 >>> np.fix(3) 3.0 >>> np.fix([2.1, 2.9, -2.1, -2.9]) array([ 2., 2., -2., -2.]) """ x = nx.asanyarray(x) y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y
Example #6
Source File: ufunclike.py From keras-lambda with MIT License | 5 votes |
def fix(x, y=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ------- out : ndarray of floats The array of rounded numbers See Also -------- trunc, floor, ceil around : Round to given number of decimals Examples -------- >>> np.fix(3.14) 3.0 >>> np.fix(3) 3.0 >>> np.fix([2.1, 2.9, -2.1, -2.9]) array([ 2., 2., -2., -2.]) """ x = nx.asanyarray(x) y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y