MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / eye

Function eye

utils/array_utils.hpp:250–256  ·  view source on GitHub ↗

* @brief Populate a square matrix with the identity matrix. * @param a The array to populate. * @param N The number of rows and columns in the square matrix. */

Source from the content-addressed store, hash-verified

248 * @param N The number of rows and columns in the square matrix.
249 */
250inline void eye(float *a, size_t N) {
251 for (size_t i = 0; i < N; i++) {
252 for (size_t j = 0; j < N; j++) {
253 a[i * N + j] = (i == j) ? 1.0 : 0.0;
254 }
255 }
256}
257
258// Note transformation operations here are purely for testing - they are not
259// optimized to be used in hot paths.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected