MCPcopy Create free account
hub / github.com/dmlc/xgboost / Matrix_Random

Function Matrix_Random

demo/c-api/inference/inference.c:68–74  ·  view source on GitHub ↗

Generate random matrix. */

Source from the content-addressed store, hash-verified

66
67/* Generate random matrix. */
68void Matrix_Random(Matrix *self, size_t n_samples, size_t n_features) {
69 Matrix_Create(self, NULL, n_samples, n_features);
70 for (size_t i = 0; i < n_samples * n_features; ++i) {
71 float x = (float)rand() / (float)(RAND_MAX);
72 (*self)->data[i] = x;
73 }
74}
75
76/* Array interface specified by numpy. */
77char const *Matrix_ArrayInterface(Matrix self) {

Callers 1

mainFunction · 0.85

Calls 1

Matrix_CreateFunction · 0.85

Tested by

no test coverage detected