Skip to content

Commit f6a4606

Browse files
authored
Merge pull request #2311 from certik/rename
Rename tensor to array
2 parents 3cf81f3 + ae7c48d commit f6a4606

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

integration_tests/test_list_06.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def check_mat_and_vec(mat: list[list[f64]], vec: list[f64]):
1515
assert vec[i] == 2.0 * float(i)
1616

1717
def test_list_of_lists():
18-
tensors: list[list[list[list[f64]]]] = []
19-
tensor: list[list[list[f64]]] = []
18+
arrays: list[list[list[list[f64]]]] = []
19+
array: list[list[list[f64]]] = []
2020
mat: list[list[f64]] = []
2121
vec: list[f64] = []
2222
rows: i32 = 10
@@ -38,27 +38,27 @@ def test_list_of_lists():
3838
check_mat_and_vec(mat, vec)
3939

4040
for k in range(rows):
41-
tensor.append(deepcopy(mat))
41+
array.append(deepcopy(mat))
4242
for i in range(rows):
4343
for j in range(cols):
4444
mat[i][j] += float(1)
4545

4646
for k in range(rows):
4747
for i in range(rows):
4848
for j in range(cols):
49-
assert mat[i][j] - tensor[k][i][j] == f64(rows - k)
49+
assert mat[i][j] - array[k][i][j] == f64(rows - k)
5050

5151
for l in range(2 * rows):
52-
tensors.append(deepcopy(tensor))
52+
arrays.append(deepcopy(array))
5353
for i in range(rows):
5454
for j in range(rows):
5555
for k in range(cols):
56-
tensor[i][j][k] += float(1)
56+
array[i][j][k] += float(1)
5757

5858
for l in range(2 * rows):
5959
for i in range(rows):
6060
for j in range(rows):
6161
for k in range(cols):
62-
assert tensor[i][j][k] - tensors[l][i][j][k] == f64(2 * rows - l)
62+
assert array[i][j][k] - arrays[l][i][j][k] == f64(2 * rows - l)
6363

6464
test_list_of_lists()

integration_tests/test_list_07.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
from lpython import c64, i32
22
from copy import deepcopy
33

4-
def generate_complex_tensors(mat: list[list[c64]], vec: list[c64]) -> list[tuple[list[list[c64]], list[c64]]]:
5-
tensor: tuple[list[list[c64]], list[c64]]
6-
tensors: list[tuple[list[list[c64]], list[c64]]] = []
4+
def generate_complex_arrays(mat: list[list[c64]], vec: list[c64]) -> list[tuple[list[list[c64]], list[c64]]]:
5+
array: tuple[list[list[c64]], list[c64]]
6+
arrays: list[tuple[list[list[c64]], list[c64]]] = []
77
rows: i32 = len(mat)
88
cols: i32 = len(vec)
99
i: i32; j: i32; k: i32
1010

11-
tensor = (deepcopy(mat), deepcopy(vec))
11+
array = (deepcopy(mat), deepcopy(vec))
1212

1313
for k in range(2 * rows):
14-
tensors.append(deepcopy(tensor))
14+
arrays.append(deepcopy(array))
1515
for i in range(rows):
1616
for j in range(cols):
1717
mat[i][j] += complex(1.0, 2.0)
1818

1919
for i in range(cols):
2020
vec[i] += complex(1.0, 2.0)
2121

22-
tensor = (deepcopy(mat), deepcopy(vec))
22+
array = (deepcopy(mat), deepcopy(vec))
2323

24-
return tensors
24+
return arrays
2525

2626
def test_tuple_with_lists():
2727
mat: list[list[c64]] = []
2828
vec: list[c64] = []
29-
tensor: tuple[list[list[c64]], list[c64]]
30-
tensors: list[tuple[list[list[c64]], list[c64]]] = []
29+
array: tuple[list[list[c64]], list[c64]]
30+
arrays: list[tuple[list[list[c64]], list[c64]]] = []
3131
i: i32
3232
j: i32
3333
k: i32
@@ -48,7 +48,7 @@ def test_tuple_with_lists():
4848
for j in range(cols):
4949
assert mat[i][j] - vec[j] == c64(i - j)
5050

51-
tensor = (deepcopy(mat), deepcopy(vec))
51+
array = (deepcopy(mat), deepcopy(vec))
5252

5353
for i in range(rows):
5454
for j in range(cols):
@@ -59,20 +59,20 @@ def test_tuple_with_lists():
5959

6060
for i in range(rows):
6161
for j in range(cols):
62-
assert tensor[0][i][j] - mat[i][j] == -complex(0, 3.0)
62+
assert array[0][i][j] - mat[i][j] == -complex(0, 3.0)
6363

6464
for i in range(cols):
65-
assert tensor[1][i] - vec[i] == -complex(0, 2.0)
65+
assert array[1][i] - vec[i] == -complex(0, 2.0)
6666

67-
tensors = generate_complex_tensors(mat, vec)
67+
arrays = generate_complex_arrays(mat, vec)
6868

6969
for k in range(2 * rows):
7070
for i in range(rows):
7171
for j in range(cols):
72-
assert tensors[k][0][i][j] - mat[i][j] == -c64(2 * rows - k) * complex(1.0, 2.0)
72+
assert arrays[k][0][i][j] - mat[i][j] == -c64(2 * rows - k) * complex(1.0, 2.0)
7373

7474
for k in range(2 * rows):
7575
for i in range(cols):
76-
assert tensors[k][1][i] - vec[i] == -c64(2 * rows - k) * complex(1.0, 2.0)
76+
assert arrays[k][1][i] - vec[i] == -c64(2 * rows - k) * complex(1.0, 2.0)
7777

7878
test_tuple_with_lists()

0 commit comments

Comments
 (0)