MCPcopy Create free account
hub / github.com/Kitware/VTK / max

Function max

Wrapping/Python/vtkmodules/numpy_interface/numpy_algorithms.py:191–229  ·  view source on GitHub ↗

Returns the max of all values along a particular axis (dimension). Given an array of m tuples and n components: * Default is to return the max of all values in an array. * axis=0: Return the max values of all tuples and return a one tuple, n-component array. * axis=1: Return th

(array, axis=None, controller=None)

Source from the content-addressed store, hash-verified

189
190@dsa._override_numpy(numpy.max)
191def max(array, axis=None, controller=None):
192 """Returns the max of all values along a particular axis (dimension).
193 Given an array of m tuples and n components:
194 * Default is to return the max of all values in an array.
195 * axis=0: Return the max values of all tuples and return a
196 one tuple, n-component array.
197 * axis=1: Return the max values of all components of each tuple
198 and return an m-tuple, 1-component array.
199
200 When called in parallel, this function will compute the max across
201 processes when a controller argument is passed or the global controller
202 is defined. To disable parallel summing when running in parallel, pass a
203 dummy controller as follows:
204
205 max(array, controller=vtkmodules.vtkParallelCore.vtkDummyController()).
206 """
207 from .algorithms import global_func
208 class MaxImpl:
209 def op(self):
210 return algs.max
211
212 def mpi_op(self):
213 from mpi4py import MPI
214 return MPI.MAX
215
216 def serial_composite(self, array, axis):
217 res = _apply_func2(algs.max, array, (axis,))
218 clean_list = []
219 for a in res:
220 if a is not dsa.NoneArray:
221 clean_list.append(a)
222 if clean_list is []:
223 return None
224 return algs.max(clean_list, axis=0).astype(numpy.float64)
225
226 def default(self):
227 return numpy.finfo(numpy.float64).min
228
229 return global_func(MaxImpl(), array, axis, controller)
230
231@dsa._override_numpy(numpy.min)
232def min(array, axis=None, controller=None):

Callers

nothing calls this directly

Calls 2

global_funcFunction · 0.85
MaxImplClass · 0.85

Tested by

no test coverage detected