code
stringlengths
3
6.57k
np.eye(3, dtype=np.float64)
np.allclose(rot_mat, rot_mat1, rtol=1e-05, atol=1e-10)
test_rolling_mean_no_buffer()
pytest.raises(ValueError)
reg.RollingMean(vector_size=3, buffer_size=0)
test_rolling_mean_returns_nan()
reg.RollingMean(vector_size=3, buffer_size=5)
np.isnan(mean_buffer.getmean()
test_rolling_mean_single_value()
reg.RollingMean(vector_size=3, buffer_size=5)
mean_buffer.pop(vector)
np.allclose(vector, mean_buffer.getmean()
test_rolling_mean_four_values()
reg.RollingMean(vector_size=3, buffer_size=3)
mean_buffer.pop(vector0)
mean_buffer.pop(vector1)
mean_buffer.pop(vector2)
np.allclose(expected_answer0, mean_buffer.getmean()
mean_buffer.pop(vector3)
np.allclose(expected_answer1, mean_buffer.getmean()
test_rolling_rotation_no_buffer()
pytest.raises(ValueError)
reg.RollingMeanRotation(buffer_size=0)
test_rolling_rot_returns_nan()
reg.RollingMeanRotation(buffer_size=5)
np.isnan(mean_buffer.getmean()
test_rolling_rot_single_value()
np.array([0.0, -math.pi/2.0, 0.0])
np.array([math.cos(math.pi/4.0)
math.sin(math.pi/4.0)
reg.RollingMeanRotation(buffer_size=5)
mean_buffer.pop(rvec)
np.allclose(expected_quaternion, mean_buffer.getmean()
test_r_rot_sgl_value_sgl_buff()
np.array([0.0, 0.0, -math.pi/2.0])
np.array([math.cos(math.pi/4.0)
math.sin(math.pi/4.0)
reg.RollingMeanRotation(buffer_size=1)
mean_buffer.pop(rvec)
np.allclose(expected_quaternion, mean_buffer.getmean()
test_rolling_rot_four_values()
reg._rvec_to_quaternion([0.0, 0.0, -math.pi/4.0])
reg.RollingMeanRotation(buffer_size=3)
mean_buffer.pop(rvec0)
mean_buffer.pop(rvec1)
mean_buffer.pop(rvec2)
np.allclose(expected_answer0, mean_buffer.getmean()
mean_buffer.pop(rvec3)
np.allclose(expected_answer1, mean_buffer.getmean()
Migration(migrations.Migration)
models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')
models.CharField(default=None, max_length=100, unique=True)
models.CharField(default=None, max_length=200)
models.SlugField(default=None, max_length=200, unique=True)
models.TextField(blank=True)
models.DateTimeField(default=django.utils.timezone.now, verbose_name='date created')
models.DateTimeField(default=django.utils.timezone.now, verbose_name='date updated')
problem()
sorted (increasing order)
__init__(self)
build_from_sorted_array(arr)
BST.__build_from_sorted_array(arr)
BST()
__build_from_sorted_array(arr)
len(arr)
BST.BSTNode(arr[0])
BST.BSTNode(root_val)
BST.__build_from_sorted_array(left)
BST.__build_from_sorted_array(right)
is_BST(self)
Exception("You have got yourself an empty tree")
self.__is_BST(self.root)
__is_BST(self, current)
self.__is_BST(current.left)
self.__is_BST(current.right)
__update_height(self, current)
abs(left - right)
Exception("The tree is unbalanced")
self.__update_height(current.left)
self.__update_height(current.right)
is_balanced(self)
Exception("An empty tree can never be balanced")
self.__update_height(self.root)
self.__is_balanced(self.root)
__is_balanced(self, current)
abs(self.root.left.height - self.root.right.height)
dump(self)
Exception("Cannot dump an empty tree")
self.__dump(self.root)
__dump(self, current, indent = 0)
print("{0}{1}".format(" " * indent, current.value)
self.__dump(current.left, indent + 2)
self.__dump(current.right, indent + 2)
__repr__(self)
self.root.__repr__()
__init__(self, value)
BST.build_from_sorted_array(arr)
tree.dump()
print("The tree {0} BST".format("is" if tree.is_BST()
print("The tree {0} balanced".format("is" if tree.is_balanced()