-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mcg1969/master
Updated dortwp
- Loading branch information
Showing
3 changed files
with
109 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,30 @@ | ||
# dotwrp.f90 | ||
# dotwrp.c | ||
|
||
This is a wrapper for four Level 1 BLAS functions | ||
CDOTC CDOTU ZDOTC ZDOTU and SDOT in Accelerate.framework | ||
of Mac OS X. | ||
This is a wrapper for all of the BLAS functions in Apple's vecLib Framework | ||
that have compatibility issues between F2C and GNU Fortran. | ||
|
||
# Reference | ||
http://developer.apple.com/hardwaredrivers/ve/errata.html#fortran_conventions | ||
The functions fixed are: | ||
cdotc | ||
cdotu | ||
zdotc | ||
zdotu | ||
sdot | ||
snrm2 | ||
sasum | ||
scnrm2 | ||
scasum | ||
All other BLAS routines work correctly with or without the -ff2c flag. | ||
|
||
Instead of using this package, you could instead compile your FORTRAN with | ||
-ff2c. However, if your code exports any functions returning single-precision | ||
or (single- or double-precision) complex results, then any code that calls | ||
those functions will be forced to follow F2C conventions as well. | ||
|
||
To use, just add dotwrp.c to your existing project, or link to it statically. | ||
|
||
This is an expansion of the "dotwrp" project by tenomoto: | ||
https://github.com/tenomoto/dotwrp | ||
We've chosen to convert the f90 code to c so we can take advantage of the | ||
__attribute__((visibility ("hidden"))) settings. This ensures that the symbols | ||
generated by this code are not visible outside of your project---which is | ||
important if you're mixing multiple FORTRAN-based projects together. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// compile with: clang -c dotwrp.c | ||
#include <vecLib/cblas.h> | ||
|
||
#ifdef DOTWRP_GLOBAL | ||
#define DYLIB_LOCAL | ||
#else | ||
#define DYLIB_LOCAL __attribute__ ((visibility ("hidden"))) | ||
#endif | ||
|
||
typedef struct cplx_ { float r, i; } fcplx; | ||
typedef struct dcplx_ { double r, i; } dcplx; | ||
|
||
DYLIB_LOCAL | ||
dcplx zdotc_( const int* n, const dcplx* x, const int* ix, const dcplx *y, const int* iy ) | ||
{ | ||
dcplx z; | ||
cblas_zdotc_sub( *n, x, *ix, y, *iy, &z ); | ||
return z; | ||
} | ||
|
||
DYLIB_LOCAL | ||
dcplx zdotu_( const int* n, const dcplx* x, const int* ix, const dcplx *y, const int* iy ) | ||
{ | ||
dcplx z; | ||
cblas_zdotu_sub( *n, x, *ix, y, *iy, &z ); | ||
return z; | ||
} | ||
|
||
DYLIB_LOCAL | ||
fcplx cdotc_( const int* n, const fcplx* x, const int* ix, const fcplx *y, const int* iy ) | ||
{ | ||
fcplx z; | ||
cblas_cdotc_sub( *n, x, *ix, y, *iy, &z ); | ||
return z; | ||
} | ||
|
||
DYLIB_LOCAL | ||
fcplx cdotu_( const int* n, const fcplx* x, const int* ix, const fcplx *y, const int* iy ) | ||
{ | ||
fcplx z; | ||
cblas_cdotu_sub( *n, x, *ix, y, *iy, &z ); | ||
return z; | ||
} | ||
|
||
DYLIB_LOCAL | ||
float sdot_( const int* n, const float* x, const int* ix, const float *y, const int* iy ) | ||
{ | ||
return cblas_sdot( *n, x, *ix, y, *iy ); | ||
} | ||
|
||
DYLIB_LOCAL | ||
float sdsdot_( const int* n, const float* a, const float* x, const int* ix, const float *y, const int* iy ) | ||
{ | ||
return cblas_sdsdot( *n, *a, x, *ix, y, *iy ); | ||
} | ||
|
||
DYLIB_LOCAL | ||
float snrm2_( const int* n, const float* x, const int* ix ) | ||
{ | ||
return cblas_snrm2( *n, x, *ix ); | ||
} | ||
|
||
DYLIB_LOCAL | ||
float sasum_( const int* n, const float* x, const int* ix ) | ||
{ | ||
return cblas_snrm2( *n, x, *ix ); | ||
} | ||
|
||
DYLIB_LOCAL | ||
float scnrm2_( const int* n, const fcplx* x, const int* ix ) | ||
{ | ||
return cblas_scnrm2( *n, x, *ix ); | ||
} | ||
|
||
DYLIB_LOCAL | ||
float scasum_( const int* n, const fcplx* x, const int* ix ) | ||
{ | ||
return cblas_scasum( *n, x, *ix ); | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.