()
return indices, signs
Precomputes index and sign arrays for constructing `qmat` in `quat_mul`.
Precomputes index and sign arrays for constructing `qmat` in `quat_mul`.
Precomputes index and sign arrays for constructing qmat in quat_mul .
def _get_qmat_indices_and_signs():
  """Precomputes index and sign arrays for constructing `qmat` in `quat_mul`."""
  w, x, y, z = range(4)
  qmat_idx_and_sign = np.array([
      [w, -x, -y, -z],
      [x, w, -z, y],
      [y, z, w, -x],
      [z, -y, x, w],
  ])
  indices = np.abs(qmat_idx_and_sign)
  signs = 2 * (qmat_idx_and_sign >= 0) - 1
  # Prevent array constants from being modified in place.
  indices.flags.writeable = False
  signs.flags.writeable = False
  return indices, signs
def _get_qmat_indices_and_signs ( ) : w , x , y , z = range ( 4 ) qmat_idx_and_sign = np . array ( [ [ w , - x , - y , - z ] , [ x , w , - z , y ] , [ y , z , w , - x ] , [ z , - y , x , w ] , ] ) indices = np . abs ( qmat_idx_and_sign ) signs = 2 * ( qmat_idx_and_sign >= 0 ) - 1 # Prevent array constants from being modified in place. indices . flags . writeable = False signs . flags . writeable = False return indices , signs