| 847 | } |
| 848 | |
| 849 | float snrm2( int n, float *x, int incx) |
| 850 | { |
| 851 | #ifdef __APPLE__ |
| 852 | //On OSX passing negative values for incx can lead to a |
| 853 | //a crash, so we catch it here (cf. Github issue #37). |
| 854 | if (n < 1 || incx < 1) { |
| 855 | return 0; |
| 856 | } |
| 857 | return cblas_snrm2(n, x, incx); |
| 858 | #else |
| 859 | return snrm2_(&n, x, &incx); |
| 860 | #endif |
| 861 | } |
| 862 | |
| 863 | double dnrm2( int n, double *x, int incx) |
| 864 | { |