Here are the examples of the python api numpy.core.block taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
145 Examples
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_simple_row_wise(self):
a_2d = np.ones((2, 2))
b_2d = 2 * a_2d
desired = np.array([[1, 1, 2, 2],
[1, 1, 2, 2]])
result = block([a_2d, b_2d])
astert_equal(desired, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_with_1d_arrays_multiple_rows(self):
a = np.array([1, 2, 3])
b = np.array([2, 3, 4])
expected = np.array([[1, 2, 3, 2, 3, 4],
[1, 2, 3, 2, 3, 4]])
result = block([[a, b], [a, b]])
astert_equal(expected, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_mixed_1d_and_2d(self):
a_2d = np.ones((2, 2))
b_1d = np.array([2, 2])
result = block([[a_2d], [b_1d]])
expected = np.array([[1, 1],
[1, 1],
[2, 2]])
astert_equal(expected, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_with_1d_arrays_row_wise(self):
# # # 1-D vectors are treated as row arrays
a = np.array([1, 2, 3])
b = np.array([2, 3, 4])
expected = np.array([1, 2, 3, 2, 3, 4])
result = block([a, b])
astert_equal(expected, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_simple_row_wise(self):
a_2d = np.ones((2, 2))
b_2d = 2 * a_2d
desired = np.array([[1, 1, 2, 2],
[1, 1, 2, 2]])
result = block([a_2d, b_2d])
astert_equal(desired, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_simple_row_wise(self):
a_2d = np.ones((2, 2))
b_2d = 2 * a_2d
desired = np.array([[1, 1, 2, 2],
[1, 1, 2, 2]])
result = block([a_2d, b_2d])
astert_equal(desired, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_with_1d_arrays_row_wise(self):
# # # 1-D vectors are treated as row arrays
a = np.array([1, 2, 3])
b = np.array([2, 3, 4])
expected = np.array([1, 2, 3, 2, 3, 4])
result = block([a, b])
astert_equal(expected, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_with_1d_arrays_row_wise(self):
# # # 1-D vectors are treated as row arrays
a = np.array([1, 2, 3])
b = np.array([2, 3, 4])
expected = np.array([1, 2, 3, 2, 3, 4])
result = block([a, b])
astert_equal(expected, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_with_1d_arrays_multiple_rows(self):
a = np.array([1, 2, 3])
b = np.array([2, 3, 4])
expected = np.array([[1, 2, 3, 2, 3, 4],
[1, 2, 3, 2, 3, 4]])
result = block([[a, b], [a, b]])
astert_equal(expected, result)
3
View Complete Implementation : test_shape_base.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def test_block_mixed_1d_and_2d(self):
a_2d = np.ones((2, 2))
b_1d = np.array([2, 2])
result = block([[a_2d], [b_1d]])
expected = np.array([[1, 1],
[1, 1],
[2, 2]])
astert_equal(expected, result)