@@ -96,32 +96,6 @@ need to write a new allocation function.
9696 from ``persis_info `` is used to generate these values, which are then placed
9797 into an output NumPy array that matches the dtype from ``gen_specs["out"] ``.
9898
99- **Exercise **
100-
101- Write a simple generator function that instead produces random integers, using
102- the ``numpy.random.Generator.integers(low, high, size) `` function.
103-
104- .. dropdown :: **Click Here for Solution**
105-
106- .. code-block :: python
107- :linenos:
108- :emphasize- lines: 12
109-
110- import numpy as np
111-
112-
113- def gen_random_ints (InputArray , persis_info , gen_specs , _ ):
114- user_specs = gen_specs[" user" ]
115- lower = user_specs[" lower" ]
116- upper = user_specs[" upper" ]
117- num = len (lower)
118- batch_size = user_specs[" gen_batch_size" ]
119-
120- OutputArray = np.zeros(batch_size, dtype = gen_specs[" out" ])
121- OutputArray[" x" ] = persis_info[" rand_stream" ].integers(lower, upper, (batch_size, num))
122-
123- return OutputArray, persis_info
124-
12599 .. tab-item :: 3. Simulator
126100
127101 Next, we'll write our simulator function or :ref: `sim_f<api_sim_f> `. Simulator
@@ -152,27 +126,6 @@ need to write a new allocation function.
152126 the generator function. This function calculates the sine of the passed value,
153127 and then returns it so the worker can store the result.
154128
155- **Exercise **
156-
157- Write a simple simulator function that instead calculates the *cosine * of a received
158- value, using the ``numpy.cos(x) `` function.
159-
160- .. dropdown :: **Click Here for Solution**
161-
162- .. code-block :: python
163- :linenos:
164- :emphasize- lines: 7
165-
166- import numpy as np
167-
168-
169- def sim_find_cosine (InputArray , _ , sim_specs ):
170- OutputArray = np.zeros(1 , dtype = sim_specs[" out" ])
171-
172- OutputArray[" y" ] = np.cos(InputArray[" x" ])
173-
174- return OutputArray
175-
176129 .. tab-item :: 4. Script
177130
178131 Now lets write the script that configures our generator and simulator
0 commit comments