MCPcopy Create free account
hub / github.com/numpy/numpy / init_gesv

Function init_gesv

numpy/linalg/umath_linalg.cpp:1689–1721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1687 */
1688template<typename ftyp>
1689static inline int
1690init_gesv(GESV_PARAMS_t<ftyp> *params, fortran_int N, fortran_int NRHS)
1691{
1692 npy_uint8 *mem_buff = NULL;
1693 npy_uint8 *a, *b, *ipiv;
1694 size_t safe_N = N;
1695 size_t safe_NRHS = NRHS;
1696 fortran_int ld = fortran_int_max(N, 1);
1697 mem_buff = (npy_uint8 *)malloc(safe_N * safe_N * sizeof(ftyp) +
1698 safe_N * safe_NRHS*sizeof(ftyp) +
1699 safe_N * sizeof(fortran_int));
1700 if (!mem_buff) {
1701 goto error;
1702 }
1703 a = mem_buff;
1704 b = a + safe_N * safe_N * sizeof(ftyp);
1705 ipiv = b + safe_N * safe_NRHS * sizeof(ftyp);
1706
1707 params->A = (ftyp*)a;
1708 params->B = (ftyp*)b;
1709 params->IPIV = (fortran_int*)ipiv;
1710 params->N = N;
1711 params->NRHS = NRHS;
1712 params->LDA = ld;
1713 params->LDB = ld;
1714
1715 return 1;
1716 error:
1717 free(mem_buff);
1718 memset(params, 0, sizeof(*params));
1719
1720 return 0;
1721}
1722
1723template<typename ftyp>
1724static inline void

Callers 3

solveFunction · 0.85
solve1Function · 0.85
invFunction · 0.85

Calls 1

fortran_int_maxFunction · 0.85

Tested by

no test coverage detected