




"""simple docstring"""

from __future__ import annotations

# Define the Gravitational Constant G and the function
UpperCamelCase__ :    Union[str, Any] 					=							6.67_43e-11  # unit of G : m^3 * kg^-1 * s^-2




def       snake_case__	(       lowerCAmelCase   :		float				,					lowerCAmelCase   :		float				,					lowerCAmelCase   :		float				,					lowerCAmelCase   :		float		):
					__snake_case          =	mass_a * mass_a

					if (force, mass_a, mass_a, distance).count(0		) != 1:
										raise ValueError("""One and only one argument must be 0"""		)
					if force < 0:
										raise ValueError("""Gravitational force can not be negative"""		)
					if distance < 0:
										raise ValueError("""Distance can not be negative"""		)
					if mass_a < 0 or mass_a < 0:
										raise ValueError("""Mass can not be negative"""		)
					if force == 0:
										__snake_case          =	GRAVITATIONAL_CONSTANT * product_of_mass / (distance**2)
										return {"force": force}
					elif mass_a == 0:
										__snake_case          =	(force) * (distance**2) / (GRAVITATIONAL_CONSTANT * mass_a)
										return {"mass_1": mass_a}
					elif mass_a == 0:
										__snake_case          =	(force) * (distance**2) / (GRAVITATIONAL_CONSTANT * mass_a)
										return {"mass_2": mass_a}
					elif distance == 0:
										__snake_case          =	(GRAVITATIONAL_CONSTANT * product_of_mass / (force)) ** 0.5
										return {"distance": distance}
					raise ValueError("""One and only one argument must be 0"""		)


# Run doctest
if __name__ == "__main__":
		import doctest

		doctest.testmod()








"""simple docstring"""

import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


UpperCamelCase__ :    Optional[int] 					=							10_00_00_00_00_00
UpperCamelCase__ :    int 					=							1_00_00

UpperCamelCase__					,					UpperCamelCase__ :    List[str] 					=							os.path.split(__file__)
UpperCamelCase__ :    Any 					=							os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))




def       snake_case__	(       lowerCAmelCase   :		int				,					lowerCAmelCase   :		int		):
					__snake_case          =	pa.Table.from_pydict({"""col""": [0] * chunk_size}		)
					__snake_case          =	pa.concat_tables([table] * (num_examples // chunk_size)		)
					return datasets.Dataset(lowerCAmelCase				,					fingerprint="""table_100B"""		)
@dataclass
class     A__      :
	A_							:				int
	A_							:				int
	A_							:				int
	A_							:				int




	def 							a_		(   self  :	Optional[Any]	)					-> Any:
						__snake_case          =	np.random.default_rng(self.seed	)
						__snake_case          =	rng.integers(low=self.low      ,    high=self.high      ,    size=self.size	).tolist()




	def __iter__(   self  :	str	)					-> int:
						return iter(self._sampled_values	)




	def __len__(   self  :	Union[str, Any]	)					-> Any:
						return self.size




@get_duration
def       snake_case__	(       lowerCAmelCase   :		datasets.Dataset		):
					__snake_case          =	dataset[0]




@get_duration
def       snake_case__	(       lowerCAmelCase   :		datasets.Dataset		):
					__snake_case          =	dataset[-1]




@get_duration
def       snake_case__	(       lowerCAmelCase   :		datasets.Dataset		):
					__snake_case          =	dataset[range(len(lowerCAmelCase		) // 2				,					len(lowerCAmelCase		) // 2 + 1_024		)]




@get_duration
def       snake_case__	(       lowerCAmelCase   :		datasets.Dataset		):
					__snake_case          =	dataset[RandIter(0				,					len(lowerCAmelCase		)				,					1_024				,					seed=42		)]




def       snake_case__	(       ):
					__snake_case          =	{"""num examples""": SPEED_TEST_N_EXAMPLES}
					__snake_case          =	(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
					print("""generating dataset"""		)
					__snake_case          =	generate_100B_dataset(num_examples=lowerCAmelCase				,					chunk_size=lowerCAmelCase		)
					print("""Functions"""		)
					for func in functions:
										print(func.__name__		)
										__snake_case          =	func(lowerCAmelCase		)

					with open(lowerCAmelCase				,					"""wb"""		) as f:
										f.write(json.dumps(lowerCAmelCase		).encode("""utf-8"""		)		)


if __name__ == "__main__":  # useful to run the profiler
		benchmark_table_100B()


