ext/nmatrix/math/math.h in nmatrix-0.0.9 vs ext/nmatrix/math/math.h in nmatrix-0.1.0.rc1

- old
+ new

@@ -7,12 +7,12 @@ // NMatrix was originally inspired by and derived from NArray, by // Masahiro Tanaka: http://narray.rubyforge.org // // == Copyright Information // -// SciRuby is Copyright (c) 2010 - 2013, Ruby Science Foundation -// NMatrix is Copyright (c) 2013, Ruby Science Foundation +// SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation +// NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation // // Please see LICENSE.txt for additional copyright notices. // // == Contributing // @@ -67,15 +67,21 @@ /* * Standard Includes */ extern "C" { // These need to be in an extern "C" block or you'll get all kinds of undefined symbol errors. +#if defined HAVE_CBLAS_H #include <cblas.h> +#elif defined HAVE_ATLAS_CBLAS_H + #include <atlas/cblas.h> +#endif - #ifdef HAVE_CLAPACK_H - #include <clapack.h> - #endif +#if defined HAVE_CLAPACK_H + #include <clapack.h> +#elif defined HAVE_ATLAS_CLAPACK_H + #include <atlas/clapack.h> +#endif } #include <algorithm> // std::min, std::max #include <limits> // std::numeric_limits @@ -529,19 +535,19 @@ * but the factor L is exactly singular, and division by zero will * occur if it is used to solve a system of equations. */ template <typename DType> inline int potrf(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, DType* A, const int lda) { -#ifdef HAVE_CLAPACK_H +#if defined HAVE_CLAPACK_H || defined HAVE_ATLAS_CLAPACK_H rb_raise(rb_eNotImpError, "not yet implemented for non-BLAS dtypes"); #else - rb_raise(rb_eNotImpError, "only LAPACK version implemented thus far"); + rb_raise(rb_eNotImpError, "only CLAPACK version implemented thus far"); #endif return 0; } -#ifdef HAVE_CLAPACK_H +#if defined HAVE_CLAPACK_H || defined HAVE_ATLAS_CLAPACK_H template <> inline int potrf(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, float* A, const int lda) { return clapack_spotrf(order, uplo, N, A, lda); } @@ -926,11 +932,11 @@ *A = *A * *A; } } -#ifdef HAVE_CLAPACK_H +#if defined HAVE_CLAPACK_H || defined HAVE_ATLAS_CLAPACK_H template <bool is_complex> inline void lauum(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, float* A, const int lda) { clapack_slauum(order, uplo, N, A, lda); } @@ -1017,10 +1023,10 @@ rb_raise(rb_eNotImpError, "potri not yet implemented for non-BLAS dtypes"); return 0; } -#ifdef HAVE_CLAPACK_H +#if defined HAVE_CLAPACK_H || defined HAVE_ATLAS_CLAPACK_H template <> inline int potri(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, float* a, const int lda) { return clapack_spotri(order, uplo, n, a, lda); }