/* Define if the compiler provides __builtin_expect */
#undef HAVE_BUILTIN_EXPECT
+/* Define to 1 if you have the `daxpy_' function. */
+#undef HAVE_DAXPY_
+
/* Define to 1 if you have the `dgeevx_' function. */
#undef HAVE_DGEEVX_
/* Define to 1 if you have the <Sacado.hpp> header file. */
#undef HAVE_SACADO_HPP
+/* Define to 1 if you have the `saxpy_' function. */
+#undef HAVE_SAXPY_
+
/* Define to 1 if you have the `sgeevx_' function. */
#undef HAVE_SGEEVX_
-for ac_func in dgemv_ sgemv_ dgeev_ sgeev_ dgeevx_ sgeevx_ dgesvd_ sgesvd_
+for ac_func in daxpy_ saxpy_ dgemv_ sgemv_ dgeev_ sgeev_ dgeevx_ sgeevx_
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+for ac_func in dgesvd_ sgesvd_ dgetrf_ sgetrf_ dgetri_ sgetri_
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
-for ac_func in dgetrf_ sgetrf_ dgetri_ sgetri_ dgetrs_ sgetrs_ dstev_ sstev_
+for ac_func in dgetrs_ sgetrs_ dstev_ sstev_
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
dnl
dnl
dnl Copyright: The deal.II authors
-dnl 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+dnl 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
dnl
AC_CHECK_FUNC(daxpy_,,[AC_MSG_ERROR([BLAS library not installed correctly($with_blas)])])
fi
-AC_CHECK_FUNCS([dgemv_ sgemv_ dgeev_ sgeev_ dgeevx_ sgeevx_ dgesvd_ sgesvd_])
-AC_CHECK_FUNCS([dgetrf_ sgetrf_ dgetri_ sgetri_ dgetrs_ sgetrs_ dstev_ sstev_])
+AC_CHECK_FUNCS([daxpy_ saxpy_ dgemv_ sgemv_ dgeev_ sgeev_ dgeevx_ sgeevx_])
+AC_CHECK_FUNCS([dgesvd_ sgesvd_ dgetrf_ sgetrf_ dgetri_ sgetri_])
+AC_CHECK_FUNCS([dgetrs_ sgetrs_ dstev_ sstev_])
dnl -------------------------------------------------------------
dnl set include paths of several libraries
+// vector update of the form y += alpha*x with a scalar, x,y vectors
+void daxpy_ (const int* n, const double* alpha, const double* x,
+ const int* incx, double* y, const int* incy);
+
// General Matrix
// Matrix vector product
void dgemv_ (const char* trans, const int* m, const int* n,
// Matrix matrix product
void dgemm_ (const char* transa, const char* transb,
- const int* m, const int* n, const int* k,
- const double* alpha, const double* A, const int* lda,
- const double* B, const int* ldb,
- const double* beta, double* C, const int* ldc);
+ const int* m, const int* n, const int* k,
+ const double* alpha, const double* A, const int* lda,
+ const double* B, const int* ldb,
+ const double* beta, double* C, const int* ldc);
// Compute LU factorization
void dgetrf_ (const int* m, const int* n, double* A,
extern "C"
{
+// vector update of the form y += alpha*x with a scalar, x,y vectors
+void daxpy_ (const int* n, const double* alpha, const double* x,
+ const int* incx, double* y, const int* incy);
+void saxpy_ (const int* n, const float* alpha, const float* x,
+ const int* incx, float* y, const int* incy);
// General Matrix
// Matrix vector product
void dgemv_ (const char* trans, const int* m, const int* n,
const float* b, float* y, const int* incy);
// Matrix matrix product
void dgemm_ (const char* transa, const char* transb,
- const int* m, const int* n, const int* k,
- const double* alpha, const double* A, const int* lda,
- const double* B, const int* ldb,
- const double* beta, double* C, const int* ldc);
+ const int* m, const int* n, const int* k,
+ const double* alpha, const double* A, const int* lda,
+ const double* B, const int* ldb,
+ const double* beta, double* C, const int* ldc);
void sgemm_ (const char* transa, const char* transb,
- const int* m, const int* n, const int* k,
- const float* alpha, const float* A, const int* lda,
- const float* B, const int* ldb,
- const float* beta, float* C, const int* ldc);
+ const int* m, const int* n, const int* k,
+ const float* alpha, const float* A, const int* lda,
+ const float* B, const int* ldb,
+ const float* beta, float* C, const int* ldc);
// Compute LU factorization
void dgetrf_ (const int* m, const int* n, double* A,
const int* lda, int* ipiv, int* info);
+#ifdef HAVE_DAXPY_
+inline void
+axpy (const int* n, const double* alpha, const double* x, const int* incx, double* y, const int* incy)
+{
+ daxpy_ (n,alpha,x,incx,y,incy);
+}
+#else
+inline void
+axpy (const int*, const double*, const double*, const int*, double*, const int*)
+{
+ Assert (false, LAPACKSupport::ExcMissing("daxpy"));
+}
+#endif
+
+
+#ifdef HAVE_SAXPY_
+inline void
+axpy (const int* n, const float* alpha, const float* x, const int* incx, float* y, const int* incy)
+{
+ saxpy_ (n,alpha,x,incx,y,incy);
+}
+#else
+inline void
+axpy (const int*, const float*, const float*, const int*, float*, const int*)
+{
+ Assert (false, LAPACKSupport::ExcMissing("saxpy"));
+}
+#endif
+
+
#ifdef HAVE_DGEMV_
inline void
gemv (const char* trans, const int* m, const int* n, const double* alpha, const double* A, const int* lda, const double* x, const int* incx, const double* b, double* y, const int* incy)
if (last_action != Insert)
last_action = Insert;
- int ierr;
for (unsigned int i=0; i<n_elements; ++i)
{
const unsigned int row = indices[i];
const int local_row = vector->Map().LID(indices[i]);
if (local_row == -1)
{
- ierr = vector->ReplaceGlobalValues (1,
- (const int*)(&row),
- &values[i]);
+ const int ierr = vector->ReplaceGlobalValues (1,
+ (const int*)(&row),
+ &values[i]);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
compressed = false;
}
else
- ierr = vector->ReplaceMyValue (local_row, 0, values[i]);
-
- AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ (*vector)[0][local_row] = values[i];
}
}
if (last_action != Add)
last_action = Add;
- int ierr;
for (unsigned int i=0; i<n_elements; ++i)
{
const unsigned int row = indices[i];
const int local_row = vector->Map().LID(indices[i]);
if (local_row == -1)
{
- ierr = vector->SumIntoGlobalValues (1,
- (const int*)(&row),
- &values[i]);
+ const int ierr = vector->SumIntoGlobalValues (1,
+ (const int*)(&row),
+ &values[i]);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
compressed = false;
}
else
- ierr = vector->SumIntoMyValue (local_row, 0, values[i]);
-
- AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ (*vector)[0][local_row] += values[i];
}
}
// these bounds by ourselves, so
// we can use []. Note that we
// can only get local values.
- AssertThrow (vector.in_local_range(index),
- ExcAccessToNonLocalElement (index,
- vector.vector->Map().MinMyGID(),
- vector.vector->Map().MaxMyGID()));
- return (*(vector.vector))[0][index];
+ const int local_index = vector.vector->Map().LID(index);
+ Assert (local_index >= 0,
+ ExcAccessToNonLocalElement (index,
+ vector.vector->Map().MinMyGID(),
+ vector.vector->Map().MaxMyGID()));
+
+
+ return (*(vector.vector))[0][local_index];
}
}