@@ -630,12 +630,20 @@ void zdscal( int n, double alpha, doublecomplex *x, int incx)
630
630
631
631
float sdot ( int n , float * x , int incx , float * y , int incy )
632
632
{
633
+ #ifdef __APPLE__
634
+ return cblas_sdot (n , x , incx , y , incy );
635
+ #else
633
636
return sdot_ (& n , x , & incx , y , & incy );
637
+ #endif
634
638
}
635
639
636
640
double ddot ( int n , double * x , int incx , double * y , int incy )
637
641
{
642
+ #ifdef __APPLE__
643
+ return cblas_ddot (n , x , incx , y , incy );
644
+ #else
638
645
return ddot_ (& n , x , & incx , y , & incy );
646
+ #endif
639
647
}
640
648
641
649
complex cdotu ( int n , complex * x , int incx , complex * y , int incy )
@@ -840,42 +848,94 @@ int izamax( int n, doublecomplex *x, int incx)
840
848
841
849
float snrm2 ( int n , float * x , int incx )
842
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
843
859
return snrm2_ (& n , x , & incx );
860
+ #endif
844
861
}
845
862
846
863
double dnrm2 ( int n , double * x , int incx )
847
864
{
865
+ #ifdef __APPLE__
866
+ //On OSX passing negative values for incx can lead to a
867
+ //a crash, so we catch it here (cf. Github issue #37).
868
+ if (n < 1 || incx < 1 ) {
869
+ return 0 ;
870
+ }
871
+ return cblas_dnrm2 (n , x , incx );
872
+ #else
848
873
return dnrm2_ (& n , x , & incx );
874
+ #endif
849
875
}
850
876
851
877
float scnrm2 ( int n , complex * x , int incx )
852
878
{
879
+ #ifdef __APPLE__
880
+ //On OSX passing negative values for incx can lead to a
881
+ //a crash, so we catch it here (cf. Github issue #37).
882
+ if (n < 1 || incx < 1 ) {
883
+ return 0 ;
884
+ }
885
+ return cblas_scnrm2 (n , x , incx );
886
+ #else
853
887
return scnrm2_ (& n , x , & incx );
888
+ #endif
854
889
}
855
890
856
891
double dznrm2 ( int n , doublecomplex * x , int incx )
857
892
{
893
+ #ifdef __APPLE__
894
+ //On OSX passing negative values for incx can lead to a
895
+ //a crash, so we catch it here (cf. Github issue #37).
896
+ if (n < 1 || incx < 1 ) {
897
+ return 0 ;
898
+ }
899
+ return cblas_dznrm2 (n , x , incx );
900
+ #else
858
901
return dznrm2_ (& n , x , & incx );
902
+ #endif
859
903
}
860
904
861
905
float sasum ( int n , float * x , int incx )
862
906
{
907
+ #ifdef __APPLE__
908
+ return cblas_sasum (n , x , incx );
909
+ #else
863
910
return sasum_ (& n , x , & incx );
911
+ #endif
864
912
}
865
913
866
914
double dasum ( int n , double * x , int incx )
867
915
{
916
+ #ifdef __APPLE__
917
+ return cblas_dasum (n , x , incx );
918
+ #else
868
919
return dasum_ (& n , x , & incx );
920
+ #endif
869
921
}
870
922
871
923
float scasum ( int n , complex * x , int incx )
872
924
{
925
+ #ifdef __APPLE__
926
+ return cblas_scasum (n , x , incx );
927
+ #else
873
928
return scasum_ (& n , x , & incx );
929
+ #endif
874
930
}
875
931
876
932
double dzasum ( int n , doublecomplex * x , int incx )
877
933
{
934
+ #ifdef __APPLE__
935
+ return cblas_dzasum (n , x , incx );
936
+ #else
878
937
return dzasum_ (& n , x , & incx );
938
+ #endif
879
939
}
880
940
881
941
#endif
0 commit comments