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

Function linearize_matrix

numpy/linalg/umath_linalg.cpp:846–888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844
845template<typename typ>
846static inline void *
847linearize_matrix(typ *dst,
848 typ *src,
849 const LINEARIZE_DATA_t* data)
850{
851 using ftyp = fortran_type_t<typ>;
852 if (dst) {
853 int i, j;
854 typ* rv = dst;
855 fortran_int columns = (fortran_int)data->columns;
856 fortran_int column_strides =
857 (fortran_int)(data->column_strides/sizeof(typ));
858 fortran_int one = 1;
859 for (i = 0; i < data->rows; i++) {
860 if (column_strides > 0) {
861 copy(&columns,
862 (ftyp*)src, &column_strides,
863 (ftyp*)dst, &one);
864 }
865 else if (column_strides < 0) {
866 copy(&columns,
867 ((ftyp*)src + (columns-1)*column_strides),
868 &column_strides,
869 (ftyp*)dst, &one);
870 }
871 else {
872 /*
873 * Zero stride has undefined behavior in some BLAS
874 * implementations (e.g. OSX Accelerate), so do it
875 * manually
876 */
877 for (j = 0; j < columns; ++j) {
878 memcpy(dst + j, src, sizeof(typ));
879 }
880 }
881 src += data->row_strides/sizeof(typ);
882 dst += data->output_lead_dim;
883 }
884 return rv;
885 } else {
886 return src;
887 }
888}
889
890template<typename typ>
891static 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