code: def compute_position(swarm, bounds, bh):
      """Update the position matrix
  
      This method updates the position matrix given the current position and the
      velocity. If bounded, the positions are handled by a
      :code:`BoundaryHandler` instance
  
      .. code-block :: python
  
          import pyswarms.backend as P
          from pyswarms.swarms.backend import Swarm, VelocityHandler
  
          my_swarm = P.create_swarm(n_particles, dimensions)
          my_bh = BoundaryHandler(strategy="intermediate")
  
          for i in range(iters):
              # Inside the for-loop
              my_swarm.position = compute_position(my_swarm, bounds, my_bh)
  
      Parameters
      ----------
      swarm : pyswarms.backend.swarms.Swarm
          a Swarm instance
      bounds : tuple of numpy.ndarray or list, optional
          a tuple of size 2 where the first entry is the minimum bound while
          the second entry is the maximum bound. Each array must be of shape
          :code:`(dimensions,)`.
      bh : pyswarms.backend.handlers.BoundaryHandler
          a BoundaryHandler object with a specified handling strategy
          For further information see :mod:`pyswarms.backend.handlers`.
  
      Returns
      -------
      numpy.ndarray
          New position-matrix
      """
      try:
          temp_position = swarm.position.copy()
          temp_position += swarm.velocity
  
          if bounds is not None:
              temp_position = bh(temp_position, bounds)
  
          position = temp_position
      except AttributeError:
          rep.logger.exception(
              "Please pass a Swarm class. You passed {}".format(
                  type(swarm)
              )
          )
          raise
      else:
          return position
  
file_path: pyswarms/pyswarms/backend/operators.py
imports: import logging
  import numpy
  from ..utils.reporter import Reporter
  from .handlers import BoundaryHandler, VelocityHandler
  from functools import partial
label_desc: Use image node_id 3 for calling a global function with example usage: compute_position(swarm, bounds, bh) and returns: position