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

Function delinearize_matrix

numpy/linalg/umath_linalg.cpp:891–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

889
890template<typename typ>
891static inline void *
892delinearize_matrix(typ *dst,
893 typ *src,
894 const LINEARIZE_DATA_t* data)
895{
896using ftyp = fortran_type_t<typ>;
897
898 if (src) {
899 int i;
900 typ *rv = src;
901 fortran_int columns = (fortran_int)data->columns;
902 fortran_int column_strides =
903 (fortran_int)(data->column_strides/sizeof(typ));
904 fortran_int one = 1;
905 for (i = 0; i < data->rows; i++) {
906 if (column_strides > 0) {
907 copy(&columns,
908 (ftyp*)src, &one,
909 (ftyp*)dst, &column_strides);
910 }
911 else if (column_strides < 0) {
912 copy(&columns,
913 (ftyp*)src, &one,
914 ((ftyp*)dst + (columns-1)*column_strides),
915 &column_strides);
916 }
917 else {
918 /*
919 * Zero stride has undefined behavior in some BLAS
920 * implementations (e.g. OSX Accelerate), so do it
921 * manually
922 */
923 if (columns > 0) {
924 memcpy(dst,
925 src + (columns-1),
926 sizeof(typ));
927 }
928 }
929 src += data->output_lead_dim;
930 dst += data->row_strides/sizeof(typ);
931 }
932
933 return rv;
934 } else {
935 return src;
936 }
937}
938
939template<typename typ>
940static inline void

Callers 11

eigh_wrapperFunction · 0.85
solveFunction · 0.85
solve1Function · 0.85
invFunction · 0.85
choleskyFunction · 0.85
eig_wrapperFunction · 0.85
svd_wrapperFunction · 0.85
qr_r_rawFunction · 0.85
qr_reducedFunction · 0.85
qr_completeFunction · 0.85
lstsqFunction · 0.85

Calls 1

copyFunction · 0.70

Tested by

no test coverage detected