import gc
import random
import tempfile
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel
from diffusers.pipelines.semantic_stable_diffusion import SemanticStableDiffusionPipeline as StableDiffusionPipeline
from diffusers.utils import floats_tensor, nightly, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu


enable_full_determinism()




class        _UpperCamelCase				(						unittest.TestCase			):


			"""simple docstring"""






			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Any:

							'''simple docstring'''


							super().tearDown()
							gc.collect()
							torch.cuda.empty_cache()





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[str]:

							'''simple docstring'''


							__lowercase			      =							1
							__lowercase			      =							3
							__lowercase			      =							(32, 32)

							__lowercase			      =							floats_tensor((batch_size, num_channels) + sizes				,       rng=random.Random(0						)						).to(lowerCAmelCase__						)
							return image





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[str]:

							'''simple docstring'''


							torch.manual_seed(0						)
							__lowercase			      =							UNetaDConditionModel(
							    block_out_channels=(32, 64)				,       layers_per_block=2				,       sample_size=32				,       in_channels=4				,       out_channels=4				,       down_block_types=('''DownBlock2D''', '''CrossAttnDownBlock2D''')				,       up_block_types=('''CrossAttnUpBlock2D''', '''UpBlock2D''')				,       cross_attention_dim=32				,       )
							return model





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[Any]:

							'''simple docstring'''


							torch.manual_seed(0						)
							__lowercase			      =							AutoencoderKL(
							    block_out_channels=[32, 64]				,       in_channels=3				,       out_channels=3				,       down_block_types=['''DownEncoderBlock2D''', '''DownEncoderBlock2D''']				,       up_block_types=['''UpDecoderBlock2D''', '''UpDecoderBlock2D''']				,       latent_channels=4				,       )
							return model





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[str]:

							'''simple docstring'''


							torch.manual_seed(0						)
							__lowercase			      =							CLIPTextConfig(
							    bos_token_id=0				,       eos_token_id=2				,       hidden_size=32				,       intermediate_size=37				,       layer_norm_eps=1E-05				,       num_attention_heads=4				,       num_hidden_layers=5				,       pad_token_id=1				,       vocab_size=10_00				,       )
							return CLIPTextModel(lowerCAmelCase__						)





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Dict:

							'''simple docstring'''


							def extract(*lowerCAmelCase__				,       **lowerCAmelCase__						):




											class        _UpperCamelCase				:


														"""simple docstring"""






														def __init__(       self						)					-> Optional[int]:

																		'''simple docstring'''


																		__lowercase			      =							torch.ones([0]						)





														def 	_SCREAMING_SNAKE_CASE      (       self				,       lowerCAmelCase__						)					-> int:

																		'''simple docstring'''


																		self.pixel_values.to(lowerCAmelCase__						)
																		return self


											return Out()

							return extract





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Union[str, Any]:

							'''simple docstring'''


							__lowercase			      =							'''cpu'''  # ensure determinism for the device-dependent torch.Generator
							__lowercase			      =							self.dummy_cond_unet
							__lowercase			      =							DDIMScheduler(
							    beta_start=0.0_0085				,       beta_end=0.012				,       beta_schedule='''scaled_linear'''				,       clip_sample=lowerCAmelCase__				,       set_alpha_to_one=lowerCAmelCase__				,       )

							__lowercase			      =							self.dummy_vae
							__lowercase			      =							self.dummy_text_encoder
							__lowercase			      =							CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''						)

							# make sure here that pndm scheduler skips prk
							__lowercase			      =							StableDiffusionPipeline(
							    unet=lowerCAmelCase__				,       scheduler=lowerCAmelCase__				,       vae=lowerCAmelCase__				,       text_encoder=lowerCAmelCase__				,       tokenizer=lowerCAmelCase__				,       safety_checker=lowerCAmelCase__				,       feature_extractor=self.dummy_extractor				,       )
							__lowercase			      =							sd_pipe.to(lowerCAmelCase__						)
							sd_pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''A painting of a squirrel eating a burger'''

							__lowercase			      =							torch.Generator(device=lowerCAmelCase__						).manual_seed(0						)
							__lowercase			      =							sd_pipe([prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=6.0				,       num_inference_steps=2				,       output_type='''np'''						)
							__lowercase			      =							output.images

							__lowercase			      =							torch.Generator(device=lowerCAmelCase__						).manual_seed(0						)
							__lowercase			      =							sd_pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=6.0				,       num_inference_steps=2				,       output_type='''np'''				,       return_dict=lowerCAmelCase__				,       )[0]

							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							image_from_tuple[0, -3:, -3:, -1]

							assert image.shape == (1, 64, 64, 3)
							__lowercase			      =							np.array([0.5753, 0.6114, 0.5001, 0.5034, 0.5470, 0.4729, 0.4971, 0.4867, 0.4867]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2
							assert np.abs(image_from_tuple_slice.flatten() - expected_slice						).max() < 1E-2





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Any:

							'''simple docstring'''


							__lowercase			      =							'''cpu'''  # ensure determinism for the device-dependent torch.Generator
							__lowercase			      =							self.dummy_cond_unet
							__lowercase			      =							PNDMScheduler(skip_prk_steps=lowerCAmelCase__						)
							__lowercase			      =							self.dummy_vae
							__lowercase			      =							self.dummy_text_encoder
							__lowercase			      =							CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''						)

							# make sure here that pndm scheduler skips prk
							__lowercase			      =							StableDiffusionPipeline(
							    unet=lowerCAmelCase__				,       scheduler=lowerCAmelCase__				,       vae=lowerCAmelCase__				,       text_encoder=lowerCAmelCase__				,       tokenizer=lowerCAmelCase__				,       safety_checker=lowerCAmelCase__				,       feature_extractor=self.dummy_extractor				,       )
							__lowercase			      =							sd_pipe.to(lowerCAmelCase__						)
							sd_pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''A painting of a squirrel eating a burger'''
							__lowercase			      =							torch.Generator(device=lowerCAmelCase__						).manual_seed(0						)
							__lowercase			      =							sd_pipe([prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=6.0				,       num_inference_steps=2				,       output_type='''np'''						)

							__lowercase			      =							output.images

							__lowercase			      =							torch.Generator(device=lowerCAmelCase__						).manual_seed(0						)
							__lowercase			      =							sd_pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=6.0				,       num_inference_steps=2				,       output_type='''np'''				,       return_dict=lowerCAmelCase__				,       )[0]

							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							image_from_tuple[0, -3:, -3:, -1]

							assert image.shape == (1, 64, 64, 3)
							__lowercase			      =							np.array([0.5122, 0.5712, 0.4825, 0.5053, 0.5646, 0.4769, 0.5179, 0.4894, 0.4994]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2
							assert np.abs(image_from_tuple_slice.flatten() - expected_slice						).max() < 1E-2





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> str:

							'''simple docstring'''


							__lowercase			      =							StableDiffusionPipeline.from_pretrained(
							    '''hf-internal-testing/tiny-stable-diffusion-lms-pipe'''				,       safety_checker=lowerCAmelCase__						)
							assert isinstance(lowerCAmelCase__				,       lowerCAmelCase__						)
							assert isinstance(pipe.scheduler				,       lowerCAmelCase__						)
							assert pipe.safety_checker is None

							__lowercase			      =							pipe('''example prompt'''				,       num_inference_steps=2						).images[0]
							assert image is not None

							# check that there's no error when saving a pipeline with one of the models being None
							with tempfile.TemporaryDirectory() as tmpdirname:
											pipe.save_pretrained(lowerCAmelCase__						)
											__lowercase			      =							StableDiffusionPipeline.from_pretrained(lowerCAmelCase__						)

							# sanity check that the pipeline still works
							assert pipe.safety_checker is None
							__lowercase			      =							pipe('''example prompt'''				,       num_inference_steps=2						).images[0]
							assert image is not None





			@unittest.skipIf(torch_device != '''cuda'''				,       '''This test requires a GPU'''						)
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Any:

							'''simple docstring'''


							__lowercase			      =							self.dummy_cond_unet
							__lowercase			      =							PNDMScheduler(skip_prk_steps=lowerCAmelCase__						)
							__lowercase			      =							self.dummy_vae
							__lowercase			      =							self.dummy_text_encoder
							__lowercase			      =							CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''						)

							# put models in fp16
							__lowercase			      =							unet.half()
							__lowercase			      =							vae.half()
							__lowercase			      =							bert.half()

							# make sure here that pndm scheduler skips prk
							__lowercase			      =							StableDiffusionPipeline(
							    unet=lowerCAmelCase__				,       scheduler=lowerCAmelCase__				,       vae=lowerCAmelCase__				,       text_encoder=lowerCAmelCase__				,       tokenizer=lowerCAmelCase__				,       safety_checker=lowerCAmelCase__				,       feature_extractor=self.dummy_extractor				,       )
							__lowercase			      =							sd_pipe.to(lowerCAmelCase__						)
							sd_pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''A painting of a squirrel eating a burger'''
							__lowercase			      =							sd_pipe([prompt]				,       num_inference_steps=2				,       output_type='''np'''						).images

							assert image.shape == (1, 64, 64, 3)




@nightly
@require_torch_gpu
class        _UpperCamelCase				(						unittest.TestCase			):


			"""simple docstring"""






			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Optional[Any]:

							'''simple docstring'''


							super().tearDown()
							gc.collect()
							torch.cuda.empty_cache()





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[Any]:

							'''simple docstring'''


							__lowercase			      =							'''cuda'''
							__lowercase			      =							StableDiffusionPipeline.from_pretrained('''runwayml/stable-diffusion-v1-5'''						)
							__lowercase			      =							pipe.to(lowerCAmelCase__						)
							pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''a photo of a cat'''
							__lowercase			      =							{
							    '''editing_prompt''': ['''sunglasses'''],
							    '''reverse_editing_direction''': [False],
							    '''edit_warmup_steps''': 10,
							    '''edit_guidance_scale''': 6,
							    '''edit_threshold''': 0.95,
							    '''edit_momentum_scale''': 0.5,
							    '''edit_mom_beta''': 0.6,
							}

							__lowercase			      =							3
							__lowercase			      =							7

							# no sega enabled
							__lowercase			      =							torch.Generator(lowerCAmelCase__						)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.3467_3113,
							    0.3849_2733,
							    0.3759_7352,
							    0.3408_6335,
							    0.3565_0748,
							    0.3557_9205,
							    0.338_4763,
							    0.3434_0236,
							    0.357_3271,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2

							# with sega enabled
							# generator = torch.manual_seed(seed)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       **lowerCAmelCase__				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.4188_7826,
							    0.3772_8766,
							    0.3013_8272,
							    0.4141_6335,
							    0.4166_4985,
							    0.3628_3392,
							    0.3619_1246,
							    0.4336_4465,
							    0.4300_1732,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Union[str, Any]:

							'''simple docstring'''


							__lowercase			      =							'''cuda'''
							__lowercase			      =							StableDiffusionPipeline.from_pretrained('''runwayml/stable-diffusion-v1-5'''						)
							__lowercase			      =							pipe.to(lowerCAmelCase__						)
							pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''an image of a crowded boulevard, realistic, 4k'''
							__lowercase			      =							{
							    '''editing_prompt''': '''crowd, crowded, people''',
							    '''reverse_editing_direction''': True,
							    '''edit_warmup_steps''': 10,
							    '''edit_guidance_scale''': 8.3,
							    '''edit_threshold''': 0.9,
							    '''edit_momentum_scale''': 0.5,
							    '''edit_mom_beta''': 0.6,
							}

							__lowercase			      =							9
							__lowercase			      =							7

							# no sega enabled
							__lowercase			      =							torch.Generator(lowerCAmelCase__						)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.4349_7998,
							    0.9181_4065,
							    0.754_0739,
							    0.5558_0205,
							    0.846_7265,
							    0.538_9691,
							    0.6257_4506,
							    0.5889_7763,
							    0.5092_6757,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2

							# with sega enabled
							# generator = torch.manual_seed(seed)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       **lowerCAmelCase__				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.308_9719,
							    0.3050_0144,
							    0.2901_6042,
							    0.3063_0964,
							    0.32_5687,
							    0.2941_9225,
							    0.290_8091,
							    0.2872_3598,
							    0.2769_6294,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[str]:

							'''simple docstring'''


							__lowercase			      =							'''cuda'''
							__lowercase			      =							StableDiffusionPipeline.from_pretrained('''runwayml/stable-diffusion-v1-5'''						)
							__lowercase			      =							pipe.to(lowerCAmelCase__						)
							pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''a castle next to a river'''
							__lowercase			      =							{
							    '''editing_prompt''': ['''boat on a river, boat''', '''monet, impression, sunrise'''],
							    '''reverse_editing_direction''': False,
							    '''edit_warmup_steps''': [15, 18],
							    '''edit_guidance_scale''': 6,
							    '''edit_threshold''': [0.9, 0.8],
							    '''edit_momentum_scale''': 0.5,
							    '''edit_mom_beta''': 0.6,
							}

							__lowercase			      =							48
							__lowercase			      =							7

							# no sega enabled
							__lowercase			      =							torch.Generator(lowerCAmelCase__						)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.7516_3555,
							    0.7603_7145,
							    0.6_1785,
							    0.918_9673,
							    0.862_7701,
							    0.8518_9694,
							    0.851_2813,
							    0.8701_2076,
							    0.831_2857,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2

							# with sega enabled
							# generator = torch.manual_seed(seed)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       **lowerCAmelCase__				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.7355_3365,
							    0.753_7271,
							    0.7434_1905,
							    0.6648_0356,
							    0.647_2925,
							    0.6303_9416,
							    0.6481_2905,
							    0.674_9717,
							    0.651_7102,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2





			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Union[str, Any]:

							'''simple docstring'''


							__lowercase			      =							'''cuda'''
							__lowercase			      =							StableDiffusionPipeline.from_pretrained('''runwayml/stable-diffusion-v1-5'''				,       torch_dtype=torch.floataa						)
							__lowercase			      =							pipe.to(lowerCAmelCase__						)
							pipe.set_progress_bar_config(disable=lowerCAmelCase__						)

							__lowercase			      =							'''a photo of a cat'''
							__lowercase			      =							{
							    '''editing_prompt''': ['''sunglasses'''],
							    '''reverse_editing_direction''': [False],
							    '''edit_warmup_steps''': 10,
							    '''edit_guidance_scale''': 6,
							    '''edit_threshold''': 0.95,
							    '''edit_momentum_scale''': 0.5,
							    '''edit_mom_beta''': 0.6,
							}

							__lowercase			      =							3
							__lowercase			      =							7

							# no sega enabled
							__lowercase			      =							torch.Generator(lowerCAmelCase__						)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.3488_7695,
							    0.387_6953,
							    0.375,
							    0.3442_3828,
							    0.358_1543,
							    0.3571_7773,
							    0.338_3789,
							    0.3457_0312,
							    0.35_9375,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2

							# with sega enabled
							# generator = torch.manual_seed(seed)
							generator.manual_seed(lowerCAmelCase__						)
							__lowercase			      =							pipe(
							    [prompt]				,       generator=lowerCAmelCase__				,       guidance_scale=lowerCAmelCase__				,       num_inference_steps=50				,       output_type='''np'''				,       width=5_12				,       height=5_12				,       **lowerCAmelCase__				,       )

							__lowercase			      =							output.images
							__lowercase			      =							image[0, -3:, -3:, -1]
							__lowercase			      =							[
							    0.4228_5156,
							    0.3691_4062,
							    0.2907_7148,
							    0.4204_1016,
							    0.4191_8945,
							    0.3549_8047,
							    0.361_8164,
							    0.442_3828,
							    0.4311_5234,
							]

							assert image.shape == (1, 5_12, 5_12, 3)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-2
import timeit




class        _UpperCamelCase				:


			"""simple docstring"""






			def __init__(       self				,       lowerCAmelCase__						)					-> List[str]:

							'''simple docstring'''


							if isinstance(lowerCAmelCase__				,       lowerCAmelCase__						):  # Initializes a matrix identical to the one provided.
											__lowercase			      =							arg
											__lowercase			      =							len(lowerCAmelCase__						)
							else:  # Initializes a square matrix of the given size and set values to zero.
											__lowercase			      =							arg
											__lowercase			      =							[[0 for _ in range(self.n						)] for _ in range(self.n						)]





			def __mul__(       self				,       lowerCAmelCase__						)					-> str:

							'''simple docstring'''


							__lowercase			      =							Matrix(self.n						)
							for i in range(self.n						):
											for j in range(self.n						):
															for k in range(self.n						):
																			matrix.t[i][j] += self.t[i][k] * b.t[k][j]
							return matrix





def     UpperCAmelCase						(   lowercase							,      lowercase							):







				"""simple docstring"""



				__lowercase			      =							Matrix([[1, 0], [0, 1]]							)
				while b > 0:
								if b & 1:
												matrix *= a
								a *= a
								b >>= 1
				return matrix





def     UpperCAmelCase						(   lowercase							,      lowercase							,      lowercase							):







				"""simple docstring"""



				if n == 1:
								return fa
				elif n == 2:
								return fa
				__lowercase			      =							Matrix([[1, 1], [1, 0]]							)
				__lowercase			      =							modular_exponentiation(lowercase							,      n - 2							)
				return fa * matrix.t[0][0] + fa * matrix.t[0][1]





def     UpperCAmelCase						(   lowercase							,      lowercase							,      lowercase							):







				"""simple docstring"""



				if n == 1:
								return fa
				elif n == 2:
								return fa

				__lowercase			      =							fa
				__lowercase			      =							fa
				n -= 2

				while n > 0:
								__lowercase      ,					__lowercase			      =							fn_a + fn_a, fn_a
								n -= 1

				return fn_a





def     UpperCAmelCase						(   ):







				"""simple docstring"""



				__lowercase			      =							'''
from random import randint
from __main__ import fibonacci_with_matrix_exponentiation
'''
				__lowercase			      =							'''fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)'''
				__lowercase			      =							timeit.timeit(setup=lowercase							,      stmt=lowercase							,      number=100							)
				print('''With matrix exponentiation the average execution time is '''							,      exec_time / 100							)
				return exec_time





def     UpperCAmelCase						(   ):







				"""simple docstring"""



				__lowercase			      =							'''
from random import randint
from __main__ import simple_fibonacci
'''
				__lowercase			      =							'''simple_fibonacci(randint(1,70000), 1, 1)'''
				__lowercase			      =							timeit.timeit(setup=lowercase							,      stmt=lowercase							,      number=100							)
				print(
				    '''Without matrix exponentiation the average execution time is '''							,      exec_time / 100							)
				return exec_time





def     UpperCAmelCase						(   ):







				"""simple docstring"""



				matrix_exponentiation_time()
				simple_fibonacci_time()


if __name__ == "__main__":
		main()