





"""simple docstring"""
from typing import Dict, Optional, Tuple

import torch






def  A__    (      UpperCamelCase	):
							A		=  boundaries[1] - boundaries[0]
							A		=  boundaries + step / 2
							A		=  torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1	)] ,  dim=0	)
							return bin_centers






def  A__    (      UpperCamelCase ,  UpperCamelCase ,  ):
							A		=  _calculate_bin_centers(UpperCamelCase	)
							return (
							    torch.sum(aligned_distance_error_probs * bin_centers ,  dim=-1	),
							    bin_centers[-1],
							)






def  A__    (      UpperCamelCase ,  UpperCamelCase = 31 ,  UpperCamelCase = 64 ,  **UpperCamelCase ,  ):
							A		=  torch.linspace(0 ,  UpperCamelCase ,  steps=(no_bins - 1) ,  device=logits.device	)

							A		=  torch.nn.functional.softmax(UpperCamelCase ,  dim=-1	)
							A,     A		=  _calculate_expected_aligned_error(
							    alignment_confidence_breaks=UpperCamelCase ,  aligned_distance_error_probs=UpperCamelCase ,  )

							return {
							    "aligned_confidence_probs": aligned_confidence_probs,
							    "predicted_aligned_error": predicted_aligned_error,
							    "max_predicted_aligned_error": max_predicted_aligned_error,
							}






def  A__    (      UpperCamelCase ,  UpperCamelCase = None ,  UpperCamelCase = 31 ,  UpperCamelCase = 64 ,  UpperCamelCase = 1E-8 ,  **UpperCamelCase ,  ):
							if residue_weights is None:
														A		=  logits.new_ones(logits.shape[-2]	)

							A		=  torch.linspace(0 ,  UpperCamelCase ,  steps=(no_bins - 1) ,  device=logits.device	)

							A		=  _calculate_bin_centers(UpperCamelCase	)
							torch.sum(UpperCamelCase	)
							A		=  logits.shape[-2]
							A		=  max(UpperCamelCase ,  19	)

							A		=  1.24 * (clipped_n - 15) ** (1.0 / 3) - 1.8

							A		=  torch.nn.functional.softmax(UpperCamelCase ,  dim=-1	)

							A		=  1.0 / (1 + (bin_centers**2) / (da**2))
							A		=  torch.sum(probs * tm_per_bin ,  dim=-1	)

							A		=  residue_weights / (eps + residue_weights.sum())
							A		=  torch.sum(predicted_tm_term * normed_residue_mask ,  dim=-1	)

							A		=  per_alignment * residue_weights

							A		=  (weighted == torch.max(UpperCamelCase	)).nonzero()[0]
							return per_alignment[tuple(UpperCamelCase	)]









"""simple docstring"""
def  A__    (      UpperCamelCase ,  UpperCamelCase	):
							for index, item in enumerate(UpperCamelCase	):
														if item == target:
																					return index
							return -1






def  A__    (      UpperCamelCase ,  UpperCamelCase ,  UpperCamelCase ,  UpperCamelCase	):
							if not (0 <= high < len(UpperCamelCase	) and 0 <= low < len(UpperCamelCase	)):
														raise Exception("Invalid upper or lower bound!"	)
							if high < low:
														return -1
							if sequence[low] == target:
														return low
							if sequence[high] == target:
														return high
							return rec_linear_search(UpperCamelCase ,  low + 1 ,  high - 1 ,  UpperCamelCase	)


if __name__ == "__main__":
		_snake_case					:		int							=			input('Enter numbers separated by comma:\n').strip()
		_snake_case					:		int							=			[int(item.strip()) for item in user_input.split(',')]

		_snake_case					:		Union[str, Any]							=			int(input('Enter a single number to be found in the list:\n').strip())
		_snake_case					:		List[Any]							=			linear_search(sequence, target)
		if result != -1:
				print(F"""linear_search({sequence}, {target}) = {result}""")
		else:
				print(F"""{target} was not found in {sequence}""")


