



"""simple docstring"""
from dataclasses import dataclass
from typing import Tuple

import numpy as np
import torch
@dataclass
class 				lowerCamelCase  :






					'''simple docstring'''





					_A		:			torch.Tensor  # [batch_size x 3]
					_A		:			torch.Tensor  # [batch_size x 3]
					_A		:			torch.Tensor  # [batch_size x 3]
					_A		:			torch.Tensor  # [batch_size x 3]
					_A		:			int
					_A		:			int
					_A		:			float
					_A		:			float
					_A		:			Tuple[int]






					def    lowerCAmelCase_				(       self:							Optional[int]						)   ->	str:
											assert self.x.shape[0] == self.y.shape[0] == self.z.shape[0] == self.origin.shape[0]
											assert self.x.shape[1] == self.y.shape[1] == self.z.shape[1] == self.origin.shape[1] == 3
											assert len(self.x.shape						) == len(self.y.shape						) == len(self.z.shape						) == len(self.origin.shape						) == 2






					def    lowerCAmelCase_				(       self:							Union[str, Any]						)   ->	Any:
											return torch.from_numpy(np.array([self.width, self.height]						,     dtype=np.floataa						)						)






					def    lowerCAmelCase_				(       self:							str						)   ->	List[Any]:
											return torch.from_numpy(np.array([self.x_fov, self.y_fov]						,     dtype=np.floataa						)						)






					def    lowerCAmelCase_				(       self:							Tuple						)   ->	torch.Tensor:
											snake_case_ :List[Any]						=			torch.arange(self.height * self.width						)
											snake_case_ :Union[str, Any]						=			torch.stack(
											    [
											        pixel_indices % self.width,
											        torch.div(snake_case						,     self.width						,     rounding_mode="""trunc"""						),
											    ]						,     axis=1						,     )
											return coords






					@property
					def    lowerCAmelCase_				(       self:							List[Any]						)   ->	str:
											snake_case_,       *snake_case_ :Dict						=			self.shape
											snake_case_ :Optional[int]						=			int(np.prod(snake_case						)						)

											snake_case_ :Union[str, Any]						=			self.get_image_coords()
											snake_case_ :Optional[Any]						=			torch.broadcast_to(coords.unsqueeze(0						)						,     [batch_size * inner_batch_size, *coords.shape]						)
											snake_case_ :Optional[int]						=			self.get_camera_rays(snake_case						)

											snake_case_ :Optional[int]						=			rays.view(snake_case						,     inner_batch_size * self.height * self.width						,     2						,     3						)

											return rays






					def    lowerCAmelCase_				(       self:							Tuple						,     snake_case:							torch.Tensor						)   ->	torch.Tensor:
											snake_case_,       *snake_case_,       snake_case_ :Tuple						=			coords.shape
											assert n_coords == 2
											assert batch_size == self.origin.shape[0]

											snake_case_ :Dict						=			coords.view(snake_case						,     -1						,     2						)

											snake_case_ :str						=			self.resolution()
											snake_case_ :List[str]						=			self.fov()

											snake_case_ :Tuple						=			(flat.float() / (res - 1)) * 2 - 1
											snake_case_ :Any						=			fracs * torch.tan(fov / 2						)

											snake_case_ :Optional[int]						=			fracs.view(snake_case						,     -1						,     2						)
											snake_case_ :Dict						=			(
											    self.z.view(snake_case						,     1						,     3						)
											    + self.x.view(snake_case						,     1						,     3						) * fracs[:, :, :1]
											    + self.y.view(snake_case						,     1						,     3						) * fracs[:, :, 1:]
											)
											snake_case_ :Tuple						=			directions / directions.norm(dim=-1						,     keepdim=snake_case						)
											snake_case_ :Optional[Any]						=			torch.stack(
											    [
											        torch.broadcast_to(self.origin.view(snake_case						,     1						,     3						)						,     [batch_size, directions.shape[1], 3]						),
											        directions,
											    ]						,     dim=2						,     )
											return rays.view(snake_case						,     *snake_case						,     2						,     3						)






					def    lowerCAmelCase_				(       self:							List[str]						,     snake_case:							int						,     snake_case:							int						)   ->	"DifferentiableProjectiveCamera":
											assert width * self.height == height * self.width, "The aspect ratio should not change."
											return DifferentiableProjectiveCamera(
											    origin=self.origin						,     x=self.x						,     y=self.y						,     z=self.z						,     width=snake_case						,     height=snake_case						,     x_fov=self.x_fov						,     y_fov=self.y_fov						,     )

def    A_  (			_lowercase	):







						'''simple docstring'''


						snake_case_ :Any						=			[]
						snake_case_ :Optional[Any]						=			[]
						snake_case_ :Optional[Any]						=			[]
						snake_case_ :Any						=			[]
						for theta in np.linspace(0,					2 * np.pi,					num=20	):
												snake_case_ :Optional[int]						=			np.array([np.sin(_lowercase	), np.cos(_lowercase	), -0.5]	)
												z /= np.sqrt(np.sum(z**2	)	)
												snake_case_ :List[Any]						=			-z * 4
												snake_case_ :str						=			np.array([np.cos(_lowercase	), -np.sin(_lowercase	), 0.0]	)
												snake_case_ :Tuple						=			np.cross(_lowercase,					_lowercase	)
												origins.append(_lowercase	)
												xs.append(_lowercase	)
												ys.append(_lowercase	)
												zs.append(_lowercase	)
						return DifferentiableProjectiveCamera(
						    origin=torch.from_numpy(np.stack(_lowercase,					axis=0	)	).float(),					x=torch.from_numpy(np.stack(_lowercase,					axis=0	)	).float(),					y=torch.from_numpy(np.stack(_lowercase,					axis=0	)	).float(),					z=torch.from_numpy(np.stack(_lowercase,					axis=0	)	).float(),					width=_lowercase,					height=_lowercase,					x_fov=0.7,					y_fov=0.7,					shape=(1, len(_lowercase	)),					)





"""simple docstring"""
import re
def    A_  (			_lowercase	):







						'''simple docstring'''


						snake_case_ :Optional[int]						=			re.compile(
						    r"""^(?:0|94|\+94|0{2}94)""" r"""7(0|1|2|4|5|6|7|8)""" r"""(-| |)""" r"""\d{7}$"""	)

						return bool(re.search(_lowercase,					_lowercase	)	)


if __name__ == "__main__":
						__a      =				"0094702343221"

						print(is_sri_lankan_phone_number(phone))
