@@ -251,14 +251,14 @@ def array_copy_but_one(a, r, c, v):
251
251
def test_eigen_return_references ():
252
252
"""Tests various ways of returning references and non-referencing copies"""
253
253
254
- master = np .ones ((10 , 10 ))
254
+ primary = np .ones ((10 , 10 ))
255
255
a = m .ReturnTester ()
256
256
a_get1 = a .get ()
257
257
assert not a_get1 .flags .owndata and a_get1 .flags .writeable
258
- assign_both (a_get1 , master , 3 , 3 , 5 )
258
+ assign_both (a_get1 , primary , 3 , 3 , 5 )
259
259
a_get2 = a .get_ptr ()
260
260
assert not a_get2 .flags .owndata and a_get2 .flags .writeable
261
- assign_both (a_get1 , master , 2 , 3 , 6 )
261
+ assign_both (a_get1 , primary , 2 , 3 , 6 )
262
262
263
263
a_view1 = a .view ()
264
264
assert not a_view1 .flags .owndata and not a_view1 .flags .writeable
@@ -271,91 +271,91 @@ def test_eigen_return_references():
271
271
272
272
a_copy1 = a .copy_get ()
273
273
assert a_copy1 .flags .owndata and a_copy1 .flags .writeable
274
- np .testing .assert_array_equal (a_copy1 , master )
274
+ np .testing .assert_array_equal (a_copy1 , primary )
275
275
a_copy1 [7 , 7 ] = - 44 # Shouldn't affect anything else
276
- c1want = array_copy_but_one (master , 7 , 7 , - 44 )
276
+ c1want = array_copy_but_one (primary , 7 , 7 , - 44 )
277
277
a_copy2 = a .copy_view ()
278
278
assert a_copy2 .flags .owndata and a_copy2 .flags .writeable
279
- np .testing .assert_array_equal (a_copy2 , master )
279
+ np .testing .assert_array_equal (a_copy2 , primary )
280
280
a_copy2 [4 , 4 ] = - 22 # Shouldn't affect anything else
281
- c2want = array_copy_but_one (master , 4 , 4 , - 22 )
281
+ c2want = array_copy_but_one (primary , 4 , 4 , - 22 )
282
282
283
283
a_ref1 = a .ref ()
284
284
assert not a_ref1 .flags .owndata and a_ref1 .flags .writeable
285
- assign_both (a_ref1 , master , 1 , 1 , 15 )
285
+ assign_both (a_ref1 , primary , 1 , 1 , 15 )
286
286
a_ref2 = a .ref_const ()
287
287
assert not a_ref2 .flags .owndata and not a_ref2 .flags .writeable
288
288
with pytest .raises (ValueError ):
289
289
a_ref2 [5 , 5 ] = 33
290
290
a_ref3 = a .ref_safe ()
291
291
assert not a_ref3 .flags .owndata and a_ref3 .flags .writeable
292
- assign_both (a_ref3 , master , 0 , 7 , 99 )
292
+ assign_both (a_ref3 , primary , 0 , 7 , 99 )
293
293
a_ref4 = a .ref_const_safe ()
294
294
assert not a_ref4 .flags .owndata and not a_ref4 .flags .writeable
295
295
with pytest .raises (ValueError ):
296
296
a_ref4 [7 , 0 ] = 987654321
297
297
298
298
a_copy3 = a .copy_ref ()
299
299
assert a_copy3 .flags .owndata and a_copy3 .flags .writeable
300
- np .testing .assert_array_equal (a_copy3 , master )
300
+ np .testing .assert_array_equal (a_copy3 , primary )
301
301
a_copy3 [8 , 1 ] = 11
302
- c3want = array_copy_but_one (master , 8 , 1 , 11 )
302
+ c3want = array_copy_but_one (primary , 8 , 1 , 11 )
303
303
a_copy4 = a .copy_ref_const ()
304
304
assert a_copy4 .flags .owndata and a_copy4 .flags .writeable
305
- np .testing .assert_array_equal (a_copy4 , master )
305
+ np .testing .assert_array_equal (a_copy4 , primary )
306
306
a_copy4 [8 , 4 ] = 88
307
- c4want = array_copy_but_one (master , 8 , 4 , 88 )
307
+ c4want = array_copy_but_one (primary , 8 , 4 , 88 )
308
308
309
309
a_block1 = a .block (3 , 3 , 2 , 2 )
310
310
assert not a_block1 .flags .owndata and a_block1 .flags .writeable
311
311
a_block1 [0 , 0 ] = 55
312
- master [3 , 3 ] = 55
312
+ primary [3 , 3 ] = 55
313
313
a_block2 = a .block_safe (2 , 2 , 3 , 2 )
314
314
assert not a_block2 .flags .owndata and a_block2 .flags .writeable
315
315
a_block2 [2 , 1 ] = - 123
316
- master [4 , 3 ] = - 123
316
+ primary [4 , 3 ] = - 123
317
317
a_block3 = a .block_const (6 , 7 , 4 , 3 )
318
318
assert not a_block3 .flags .owndata and not a_block3 .flags .writeable
319
319
with pytest .raises (ValueError ):
320
320
a_block3 [2 , 2 ] = - 44444
321
321
322
322
a_copy5 = a .copy_block (2 , 2 , 2 , 3 )
323
323
assert a_copy5 .flags .owndata and a_copy5 .flags .writeable
324
- np .testing .assert_array_equal (a_copy5 , master [2 :4 , 2 :5 ])
324
+ np .testing .assert_array_equal (a_copy5 , primary [2 :4 , 2 :5 ])
325
325
a_copy5 [1 , 1 ] = 777
326
- c5want = array_copy_but_one (master [2 :4 , 2 :5 ], 1 , 1 , 777 )
326
+ c5want = array_copy_but_one (primary [2 :4 , 2 :5 ], 1 , 1 , 777 )
327
327
328
328
a_corn1 = a .corners ()
329
329
assert not a_corn1 .flags .owndata and a_corn1 .flags .writeable
330
330
a_corn1 *= 50
331
331
a_corn1 [1 , 1 ] = 999
332
- master [0 , 0 ] = 50
333
- master [0 , 9 ] = 50
334
- master [9 , 0 ] = 50
335
- master [9 , 9 ] = 999
332
+ primary [0 , 0 ] = 50
333
+ primary [0 , 9 ] = 50
334
+ primary [9 , 0 ] = 50
335
+ primary [9 , 9 ] = 999
336
336
a_corn2 = a .corners_const ()
337
337
assert not a_corn2 .flags .owndata and not a_corn2 .flags .writeable
338
338
with pytest .raises (ValueError ):
339
339
a_corn2 [1 , 0 ] = 51
340
340
341
341
# All of the changes made all the way along should be visible everywhere
342
342
# now (except for the copies, of course)
343
- np .testing .assert_array_equal (a_get1 , master )
344
- np .testing .assert_array_equal (a_get2 , master )
345
- np .testing .assert_array_equal (a_view1 , master )
346
- np .testing .assert_array_equal (a_view2 , master )
347
- np .testing .assert_array_equal (a_ref1 , master )
348
- np .testing .assert_array_equal (a_ref2 , master )
349
- np .testing .assert_array_equal (a_ref3 , master )
350
- np .testing .assert_array_equal (a_ref4 , master )
351
- np .testing .assert_array_equal (a_block1 , master [3 :5 , 3 :5 ])
352
- np .testing .assert_array_equal (a_block2 , master [2 :5 , 2 :4 ])
353
- np .testing .assert_array_equal (a_block3 , master [6 :10 , 7 :10 ])
343
+ np .testing .assert_array_equal (a_get1 , primary )
344
+ np .testing .assert_array_equal (a_get2 , primary )
345
+ np .testing .assert_array_equal (a_view1 , primary )
346
+ np .testing .assert_array_equal (a_view2 , primary )
347
+ np .testing .assert_array_equal (a_ref1 , primary )
348
+ np .testing .assert_array_equal (a_ref2 , primary )
349
+ np .testing .assert_array_equal (a_ref3 , primary )
350
+ np .testing .assert_array_equal (a_ref4 , primary )
351
+ np .testing .assert_array_equal (a_block1 , primary [3 :5 , 3 :5 ])
352
+ np .testing .assert_array_equal (a_block2 , primary [2 :5 , 2 :4 ])
353
+ np .testing .assert_array_equal (a_block3 , primary [6 :10 , 7 :10 ])
354
354
np .testing .assert_array_equal (
355
- a_corn1 , master [0 :: master .shape [0 ] - 1 , 0 :: master .shape [1 ] - 1 ]
355
+ a_corn1 , primary [0 :: primary .shape [0 ] - 1 , 0 :: primary .shape [1 ] - 1 ]
356
356
)
357
357
np .testing .assert_array_equal (
358
- a_corn2 , master [0 :: master .shape [0 ] - 1 , 0 :: master .shape [1 ] - 1 ]
358
+ a_corn2 , primary [0 :: primary .shape [0 ] - 1 , 0 :: primary .shape [1 ] - 1 ]
359
359
)
360
360
361
361
np .testing .assert_array_equal (a_copy1 , c1want )
0 commit comments