MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / _setCompMatrFromArr

Function _setCompMatrFromArr

quest/include/matrices.h:943–955  ·  view source on GitHub ↗

static inline to avoid header-symbol duplication @private

Source from the content-addressed store, hash-verified

941 // static inline to avoid header-symbol duplication
942 /// @private
943 static inline void _setCompMatrFromArr(CompMatr matr, qcomp arr[matr.numRows][matr.numRows]) {
944 _validateParamsToSetCompMatrFromArr(matr);
945
946 // new ptrs array safely fits in stack, since it's sqrt-smaller than user's passed stack array
947 qcomp* ptrs[matr.numRows];
948
949 // collect pointers to each row of arr
950 for (qindex r=0; r<matr.numRows; r++)
951 ptrs[r] = arr[r];
952
953 // array decays to qcomp**, and *FromPtr function re-performs validation (eh)
954 setCompMatr(matr, ptrs); // validation gauranteed to pass
955 }
956
957
958 // C then overloads setCompMatr() to call the above VLA when given arrays, using C11 Generics.

Callers 2

_setInlineCompMatrFunction · 0.85
_createInlineCompMatrFunction · 0.85

Calls 2

setCompMatrFunction · 0.85

Tested by

no test coverage detected