Lines Matching +full:test +full:-

1 # Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors
2 # All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
4 # SPDX-License-Identifier: BSD-2-Clause
9 # Test Ceed Vector functionality
18 # -------------------------------------------------------------------------------
20 # -------------------------------------------------------------------------------
28 # -------------------------------------------------------------------------------
29 # Test creation, setting, reading, restoring, and destroying of a vector
30 # -------------------------------------------------------------------------------
46 # -------------------------------------------------------------------------------
47 # Test setValue
48 # -------------------------------------------------------------------------------
72 # -------------------------------------------------------------------------------
73 # Test getArrayRead state counter
74 # -------------------------------------------------------------------------------
91 # -------------------------------------------------------------------------------
92 # Test setting one vector from array of another vector
93 # -------------------------------------------------------------------------------
114 # -------------------------------------------------------------------------------
115 # Test getArray to modify array
116 # -------------------------------------------------------------------------------
129 b[3] = -3.14
132 assert a[3] == np.float32(-3.14)
134 assert a[3] == -3.14
136 # -------------------------------------------------------------------------------
137 # Test creation, setting, reading, restoring, and destroying of a vector using
139 # -------------------------------------------------------------------------------
143 # Skip test for non-GPU backend
162 # -------------------------------------------------------------------------------
163 # Test view
164 # -------------------------------------------------------------------------------
182 # -------------------------------------------------------------------------------
183 # Test norms
184 # -------------------------------------------------------------------------------
196 a[i] *= -1
201 assert abs(norm - 45.) < TOL
205 assert abs(norm - np.sqrt(285.)) < TOL
209 assert abs(norm - 9.) < TOL
211 # -------------------------------------------------------------------------------
212 # Test taking the reciprocal of a vector
213 # -------------------------------------------------------------------------------
228 assert abs(b[i] - 1. / (10 + i)) < TOL
230 # -------------------------------------------------------------------------------
231 # Test AXPY
232 # -------------------------------------------------------------------------------
246 y.axpy(-0.5, x)
250 # -------------------------------------------------------------------------------
251 # Test pointwise multiplication
252 # -------------------------------------------------------------------------------
271 assert abs(b[i] - i * i) < 1e-14
276 assert abs(b[i] - i * i * i) < 1e-14
281 assert abs(b[i] - i * i * i * i) < 1e-14
286 assert abs(b[i] - i * i) < 1e-14
288 # -------------------------------------------------------------------------------
289 # Test Scale
290 # -------------------------------------------------------------------------------
302 x.scale(-0.5)
304 assert np.allclose(-.5 * a, b)
306 # -------------------------------------------------------------------------------
307 # Test getArrayWrite to modify array
308 # -------------------------------------------------------------------------------
326 # -------------------------------------------------------------------------------
327 # Test AXPBY
328 # -------------------------------------------------------------------------------
342 y.axpby(-0.5, 1.0, x)
346 # -------------------------------------------------------------------------------
347 # Test vector copy
348 # -------------------------------------------------------------------------------
372 # -------------------------------------------------------------------------------
373 # Test modification of reshaped array
374 # -------------------------------------------------------------------------------
389 # -------------------------------------------------------------------------------