Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -12,82 +12,71 @@
namespace internal {
/* \internal
* Solve Ax=b with A a band triangular matrix
* TODO: extend it to matrices for x abd b */
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, int StorageOrder>
/* \internal
* Solve Ax=b with A a band triangular matrix
* TODO: extend it to matrices for x abd b */
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, int StorageOrder>
struct band_solve_triangular_selector;
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar>
struct band_solve_triangular_selector<Index, Mode, LhsScalar, ConjLhs, RhsScalar, RowMajor> {
typedef Map<const Matrix<LhsScalar, Dynamic, Dynamic, RowMajor>, 0, OuterStride<> > LhsMap;
typedef Map<Matrix<RhsScalar, Dynamic, 1> > RhsMap;
enum { IsLower = (Mode & Lower) ? 1 : 0 };
static void run(Index size, Index k, const LhsScalar* _lhs, Index lhsStride, RhsScalar* _other) {
const LhsMap lhs(_lhs, size, k + 1, OuterStride<>(lhsStride));
RhsMap other(_other, size, 1);
std::conditional_t<ConjLhs, const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>, LhsMap>,
const LhsMap&>
cjLhs(lhs);
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar>
struct band_solve_triangular_selector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,RowMajor>
{
typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,RowMajor>, 0, OuterStride<> > LhsMap;
typedef Map<Matrix<RhsScalar,Dynamic,1> > RhsMap;
enum { IsLower = (Mode&Lower) ? 1 : 0 };
static void run(Index size, Index k, const LhsScalar* _lhs, Index lhsStride, RhsScalar* _other)
{
const LhsMap lhs(_lhs,size,k+1,OuterStride<>(lhsStride));
RhsMap other(_other,size,1);
std::conditional_t<ConjLhs,
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
const LhsMap&> cjLhs(lhs);
for(int col=0 ; col<other.cols() ; ++col)
{
for(int ii=0; ii<size; ++ii)
{
int i = IsLower ? ii : size-ii-1;
int actual_k = (std::min)(k,ii);
int actual_start = IsLower ? k-actual_k : 1;
if(actual_k>0)
other.coeffRef(i,col) -= cjLhs.row(i).segment(actual_start,actual_k).transpose()
.cwiseProduct(other.col(col).segment(IsLower ? i-actual_k : i+1,actual_k)).sum();
for (int col = 0; col < other.cols(); ++col) {
for (int ii = 0; ii < size; ++ii) {
int i = IsLower ? ii : size - ii - 1;
int actual_k = (std::min)(k, ii);
int actual_start = IsLower ? k - actual_k : 1;
if((Mode&UnitDiag)==0)
other.coeffRef(i,col) /= cjLhs(i,IsLower ? k : 0);
}
}
}
};
if (actual_k > 0)
other.coeffRef(i, col) -= cjLhs.row(i)
.segment(actual_start, actual_k)
.transpose()
.cwiseProduct(other.col(col).segment(IsLower ? i - actual_k : i + 1, actual_k))
.sum();
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar>
struct band_solve_triangular_selector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ColMajor>
{
typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > LhsMap;
typedef Map<Matrix<RhsScalar,Dynamic,1> > RhsMap;
enum { IsLower = (Mode&Lower) ? 1 : 0 };
static void run(Index size, Index k, const LhsScalar* _lhs, Index lhsStride, RhsScalar* _other)
{
const LhsMap lhs(_lhs,k+1,size,OuterStride<>(lhsStride));
RhsMap other(_other,size,1);
std::conditional_t<ConjLhs,
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
const LhsMap&> cjLhs(lhs);
for(int col=0 ; col<other.cols() ; ++col)
{
for(int ii=0; ii<size; ++ii)
{
int i = IsLower ? ii : size-ii-1;
int actual_k = (std::min)(k,size-ii-1);
int actual_start = IsLower ? 1 : k-actual_k;
if((Mode&UnitDiag)==0)
other.coeffRef(i,col) /= cjLhs(IsLower ? 0 : k, i);
if(actual_k>0)
other.col(col).segment(IsLower ? i+1 : i-actual_k, actual_k)
-= other.coeff(i,col) * cjLhs.col(i).segment(actual_start,actual_k);
if ((Mode & UnitDiag) == 0) other.coeffRef(i, col) /= cjLhs(i, IsLower ? k : 0);
}
}
}
};
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar>
struct band_solve_triangular_selector<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ColMajor> {
typedef Map<const Matrix<LhsScalar, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> > LhsMap;
typedef Map<Matrix<RhsScalar, Dynamic, 1> > RhsMap;
enum { IsLower = (Mode & Lower) ? 1 : 0 };
static void run(Index size, Index k, const LhsScalar* _lhs, Index lhsStride, RhsScalar* _other) {
const LhsMap lhs(_lhs, k + 1, size, OuterStride<>(lhsStride));
RhsMap other(_other, size, 1);
std::conditional_t<ConjLhs, const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>, LhsMap>,
const LhsMap&>
cjLhs(lhs);
} // end namespace internal
for (int col = 0; col < other.cols(); ++col) {
for (int ii = 0; ii < size; ++ii) {
int i = IsLower ? ii : size - ii - 1;
int actual_k = (std::min)(k, size - ii - 1);
int actual_start = IsLower ? 1 : k - actual_k;
#endif // EIGEN_BAND_TRIANGULARSOLVER_H
if ((Mode & UnitDiag) == 0) other.coeffRef(i, col) /= cjLhs(IsLower ? 0 : k, i);
if (actual_k > 0)
other.col(col).segment(IsLower ? i + 1 : i - actual_k, actual_k) -=
other.coeff(i, col) * cjLhs.col(i).segment(actual_start, actual_k);
}
}
}
};
} // end namespace internal
#endif // EIGEN_BAND_TRIANGULARSOLVER_H

View File

@@ -13,32 +13,28 @@
namespace internal {
/* Optimized matrix += alpha * uv' */
template<typename Scalar, typename Index, int StorageOrder, bool ConjLhs, bool ConjRhs>
template <typename Scalar, typename Index, int StorageOrder, bool ConjLhs, bool ConjRhs>
struct general_rank1_update;
template<typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
struct general_rank1_update<Scalar,Index,ColMajor,ConjLhs,ConjRhs>
{
static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
{
typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;
template <typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
struct general_rank1_update<Scalar, Index, ColMajor, ConjLhs, ConjRhs> {
static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha) {
typedef Map<const Matrix<Scalar, Dynamic, 1> > OtherMap;
typedef typename conj_expr_if<ConjLhs, OtherMap>::type ConjRhsType;
conj_if<ConjRhs> cj;
for (Index i=0; i<cols; ++i)
Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i,rows) += alpha * cj(v[i]) * ConjRhsType(OtherMap(u,rows));
for (Index i = 0; i < cols; ++i)
Map<Matrix<Scalar, Dynamic, 1> >(mat + stride * i, rows) += alpha * cj(v[i]) * ConjRhsType(OtherMap(u, rows));
}
};
template<typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
struct general_rank1_update<Scalar,Index,RowMajor,ConjLhs,ConjRhs>
{
static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
{
general_rank1_update<Scalar,Index,ColMajor,ConjRhs,ConjRhs>::run(rows,cols,mat,stride,u,v,alpha);
template <typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
struct general_rank1_update<Scalar, Index, RowMajor, ConjLhs, ConjRhs> {
static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha) {
general_rank1_update<Scalar, Index, ColMajor, ConjRhs, ConjRhs>::run(rows, cols, mat, stride, u, v, alpha);
}
};
} // end namespace internal
} // end namespace internal
#endif // EIGEN_GENERAL_RANK1UPDATE_H
#endif // EIGEN_GENERAL_RANK1UPDATE_H

View File

@@ -15,39 +15,36 @@ namespace internal {
/* Optimized matrix += alpha * uv'
* The matrix is in packed form.
*/
template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>
template <typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>
struct selfadjoint_packed_rank1_update;
template<typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>
struct selfadjoint_packed_rank1_update<Scalar,Index,ColMajor,UpLo,ConjLhs,ConjRhs>
{
template <typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>
struct selfadjoint_packed_rank1_update<Scalar, Index, ColMajor, UpLo, ConjLhs, ConjRhs> {
typedef typename NumTraits<Scalar>::Real RealScalar;
static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha)
{
typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;
static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha) {
typedef Map<const Matrix<Scalar, Dynamic, 1> > OtherMap;
typedef typename conj_expr_if<ConjLhs, OtherMap>::type ConjRhsType;
conj_if<ConjRhs> cj;
for (Index i=0; i<size; ++i)
{
Map<Matrix<Scalar,Dynamic,1> >(mat, UpLo==Lower ? size-i : (i+1)) += alpha * cj(vec[i]) * ConjRhsType(OtherMap(vec+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1)));
//FIXME This should be handled outside.
mat[UpLo==Lower ? 0 : i] = numext::real(mat[UpLo==Lower ? 0 : i]);
mat += UpLo==Lower ? size-i : (i+1);
for (Index i = 0; i < size; ++i) {
Map<Matrix<Scalar, Dynamic, 1> >(mat, UpLo == Lower ? size - i : (i + 1)) +=
alpha * cj(vec[i]) * ConjRhsType(OtherMap(vec + (UpLo == Lower ? i : 0), UpLo == Lower ? size - i : (i + 1)));
// FIXME This should be handled outside.
mat[UpLo == Lower ? 0 : i] = numext::real(mat[UpLo == Lower ? 0 : i]);
mat += UpLo == Lower ? size - i : (i + 1);
}
}
};
template<typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>
struct selfadjoint_packed_rank1_update<Scalar,Index,RowMajor,UpLo,ConjLhs,ConjRhs>
{
template <typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>
struct selfadjoint_packed_rank1_update<Scalar, Index, RowMajor, UpLo, ConjLhs, ConjRhs> {
typedef typename NumTraits<Scalar>::Real RealScalar;
static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha)
{
selfadjoint_packed_rank1_update<Scalar,Index,ColMajor,UpLo==Lower?Upper:Lower,ConjRhs,ConjLhs>::run(size,mat,vec,alpha);
static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha) {
selfadjoint_packed_rank1_update<Scalar, Index, ColMajor, UpLo == Lower ? Upper : Lower, ConjRhs, ConjLhs>::run(
size, mat, vec, alpha);
}
};
} // end namespace internal
} // end namespace internal
#endif // EIGEN_SELFADJOINT_PACKED_PRODUCT_H
#endif // EIGEN_SELFADJOINT_PACKED_PRODUCT_H

View File

@@ -12,24 +12,23 @@
namespace internal {
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int StorageOrder>
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs,
int StorageOrder>
struct packed_triangular_matrix_vector_product;
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor>
{
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, ColMajor> {
typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
IsLower = (Mode & Lower) ==Lower,
HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
IsLower = (Mode & Lower) == Lower,
HasUnitDiag = (Mode & UnitDiag) == UnitDiag,
HasZeroDiag = (Mode & ZeroDiag) == ZeroDiag
};
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha)
{
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha) {
internal::conj_if<ConjRhs> cj;
typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;
typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;
typedef Map<Matrix<ResScalar,Dynamic,1> > ResMap;
typedef Map<const Matrix<LhsScalar, Dynamic, 1> > LhsMap;
typedef typename conj_expr_if<ConjLhs, LhsMap>::type ConjLhsType;
typedef Map<Matrix<ResScalar, Dynamic, 1> > ResMap;
for (Index i = 0; i < size; ++i) {
Index s = IsLower && (HasUnitDiag || HasZeroDiag) ? 1 : 0;
@@ -45,28 +44,28 @@ struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsS
};
};
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor>
{
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, RowMajor> {
typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
IsLower = (Mode & Lower) ==Lower,
HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
IsLower = (Mode & Lower) == Lower,
HasUnitDiag = (Mode & UnitDiag) == UnitDiag,
HasZeroDiag = (Mode & ZeroDiag) == ZeroDiag
};
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha)
{
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha) {
internal::conj_if<ConjRhs> cj;
typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;
typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;
typedef Map<const Matrix<RhsScalar,Dynamic,1> > RhsMap;
typedef typename conj_expr_if<ConjRhs,RhsMap>::type ConjRhsType;
typedef Map<const Matrix<LhsScalar, Dynamic, 1> > LhsMap;
typedef typename conj_expr_if<ConjLhs, LhsMap>::type ConjLhsType;
typedef Map<const Matrix<RhsScalar, Dynamic, 1> > RhsMap;
typedef typename conj_expr_if<ConjRhs, RhsMap>::type ConjRhsType;
for (Index i = 0; i < size; ++i) {
Index s = !IsLower && (HasUnitDiag || HasZeroDiag) ? 1 : 0;
Index r = IsLower ? i + 1 : size - i;
if (!(HasUnitDiag || HasZeroDiag) || (--r > 0)) {
res[i] += alpha * (ConjLhsType(LhsMap(lhs + s, r)).cwiseProduct(ConjRhsType(RhsMap(rhs + (IsLower ? 0 : s + i), r)))).sum();
res[i] +=
alpha *
(ConjLhsType(LhsMap(lhs + s, r)).cwiseProduct(ConjRhsType(RhsMap(rhs + (IsLower ? 0 : s + i), r)))).sum();
}
if (HasUnitDiag) {
res[i] += alpha * cj(rhs[i]);
@@ -76,6 +75,6 @@ struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsS
};
};
} // end namespace internal
} // end namespace internal
#endif // EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H
#endif // EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H

View File

@@ -12,77 +12,63 @@
namespace internal {
template<typename LhsScalar, typename RhsScalar, typename Index, int Side, int Mode, bool Conjugate, int StorageOrder>
template <typename LhsScalar, typename RhsScalar, typename Index, int Side, int Mode, bool Conjugate, int StorageOrder>
struct packed_triangular_solve_vector;
// forward and backward substitution, row-major, rhs is a vector
template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>
struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, RowMajor>
{
enum {
IsLower = (Mode&Lower)==Lower
};
static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs)
{
template <typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>
struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, RowMajor> {
enum { IsLower = (Mode & Lower) == Lower };
static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs) {
internal::conj_if<Conjugate> cj;
typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;
typedef typename conj_expr_if<Conjugate,LhsMap>::type ConjLhsType;
typedef Map<const Matrix<LhsScalar, Dynamic, 1> > LhsMap;
typedef typename conj_expr_if<Conjugate, LhsMap>::type ConjLhsType;
lhs += IsLower ? 0 : (size*(size+1)>>1)-1;
for(Index pi=0; pi<size; ++pi)
{
Index i = IsLower ? pi : size-pi-1;
lhs += IsLower ? 0 : (size * (size + 1) >> 1) - 1;
for (Index pi = 0; pi < size; ++pi) {
Index i = IsLower ? pi : size - pi - 1;
Index s = IsLower ? 0 : 1;
if (pi>0)
rhs[i] -= (ConjLhsType(LhsMap(lhs+s,pi))
.cwiseProduct(Map<const Matrix<RhsScalar,Dynamic,1> >(rhs+(IsLower ? 0 : i+1),pi))).sum();
if (!(Mode & UnitDiag))
rhs[i] /= cj(lhs[IsLower ? i : 0]);
IsLower ? lhs += pi+1 : lhs -= pi+2;
if (pi > 0)
rhs[i] -= (ConjLhsType(LhsMap(lhs + s, pi))
.cwiseProduct(Map<const Matrix<RhsScalar, Dynamic, 1> >(rhs + (IsLower ? 0 : i + 1), pi)))
.sum();
if (!(Mode & UnitDiag)) rhs[i] /= cj(lhs[IsLower ? i : 0]);
IsLower ? lhs += pi + 1 : lhs -= pi + 2;
}
}
};
// forward and backward substitution, column-major, rhs is a vector
template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>
struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, ColMajor>
{
enum {
IsLower = (Mode&Lower)==Lower
};
static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs)
{
template <typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>
struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, ColMajor> {
enum { IsLower = (Mode & Lower) == Lower };
static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs) {
internal::conj_if<Conjugate> cj;
typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;
typedef typename conj_expr_if<Conjugate,LhsMap>::type ConjLhsType;
typedef Map<const Matrix<LhsScalar, Dynamic, 1> > LhsMap;
typedef typename conj_expr_if<Conjugate, LhsMap>::type ConjLhsType;
lhs += IsLower ? 0 : size*(size-1)>>1;
for(Index pi=0; pi<size; ++pi)
{
Index i = IsLower ? pi : size-pi-1;
lhs += IsLower ? 0 : size * (size - 1) >> 1;
for (Index pi = 0; pi < size; ++pi) {
Index i = IsLower ? pi : size - pi - 1;
Index r = size - pi - 1;
if (!(Mode & UnitDiag))
rhs[i] /= cj(lhs[IsLower ? 0 : i]);
if (r>0)
Map<Matrix<RhsScalar,Dynamic,1> >(rhs+(IsLower? i+1 : 0),r) -=
rhs[i] * ConjLhsType(LhsMap(lhs+(IsLower? 1 : 0),r));
IsLower ? lhs += size-pi : lhs -= r;
if (!(Mode & UnitDiag)) rhs[i] /= cj(lhs[IsLower ? 0 : i]);
if (r > 0)
Map<Matrix<RhsScalar, Dynamic, 1> >(rhs + (IsLower ? i + 1 : 0), r) -=
rhs[i] * ConjLhsType(LhsMap(lhs + (IsLower ? 1 : 0), r));
IsLower ? lhs += size - pi : lhs -= r;
}
}
};
template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate, int StorageOrder>
struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheRight, Mode, Conjugate, StorageOrder>
{
static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs)
{
packed_triangular_solve_vector<LhsScalar,RhsScalar,Index,OnTheLeft,
((Mode&Upper)==Upper ? Lower : Upper) | (Mode&UnitDiag),
Conjugate,StorageOrder==RowMajor?ColMajor:RowMajor
>::run(size, lhs, rhs);
template <typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate, int StorageOrder>
struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheRight, Mode, Conjugate, StorageOrder> {
static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs) {
packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft,
((Mode & Upper) == Upper ? Lower : Upper) | (Mode & UnitDiag), Conjugate,
StorageOrder == RowMajor ? ColMajor : RowMajor>::run(size, lhs, rhs);
}
};
} // end namespace internal
} // end namespace internal
#endif // EIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H
#endif // EIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H

View File

@@ -15,17 +15,16 @@ namespace internal {
/* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'
* This is the low-level version of SelfadjointRank2Update.h
*/
template<typename Scalar, typename Index, int UpLo>
struct rank2_update_selector
{
static void run(Index size, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
{
typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
for (Index i=0; i<size; ++i)
{
Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1)) +=
numext::conj(alpha) * numext::conj(u[i]) * OtherMap(v+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))
+ alpha * numext::conj(v[i]) * OtherMap(u+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1));
template <typename Scalar, typename Index, int UpLo>
struct rank2_update_selector {
static void run(Index size, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha) {
typedef Map<const Matrix<Scalar, Dynamic, 1> > OtherMap;
for (Index i = 0; i < size; ++i) {
Map<Matrix<Scalar, Dynamic, 1> >(mat + stride * i + (UpLo == Lower ? i : 0),
UpLo == Lower ? size - i : (i + 1)) +=
numext::conj(alpha) * numext::conj(u[i]) *
OtherMap(v + (UpLo == Lower ? i : 0), UpLo == Lower ? size - i : (i + 1)) +
alpha * numext::conj(v[i]) * OtherMap(u + (UpLo == Lower ? i : 0), UpLo == Lower ? size - i : (i + 1));
}
}
};
@@ -33,25 +32,23 @@ struct rank2_update_selector
/* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'
* The matrix is in packed form.
*/
template<typename Scalar, typename Index, int UpLo>
struct packed_rank2_update_selector
{
static void run(Index size, Scalar* mat, const Scalar* u, const Scalar* v, Scalar alpha)
{
typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
template <typename Scalar, typename Index, int UpLo>
struct packed_rank2_update_selector {
static void run(Index size, Scalar* mat, const Scalar* u, const Scalar* v, Scalar alpha) {
typedef Map<const Matrix<Scalar, Dynamic, 1> > OtherMap;
Index offset = 0;
for (Index i=0; i<size; ++i)
{
Map<Matrix<Scalar,Dynamic,1> >(mat+offset, UpLo==Lower ? size-i : (i+1)) +=
numext::conj(alpha) * numext::conj(u[i]) * OtherMap(v+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))
+ alpha * numext::conj(v[i]) * OtherMap(u+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1));
//FIXME This should be handled outside.
mat[offset+(UpLo==Lower ? 0 : i)] = numext::real(mat[offset+(UpLo==Lower ? 0 : i)]);
offset += UpLo==Lower ? size-i : (i+1);
for (Index i = 0; i < size; ++i) {
Map<Matrix<Scalar, Dynamic, 1> >(mat + offset, UpLo == Lower ? size - i : (i + 1)) +=
numext::conj(alpha) * numext::conj(u[i]) *
OtherMap(v + (UpLo == Lower ? i : 0), UpLo == Lower ? size - i : (i + 1)) +
alpha * numext::conj(v[i]) * OtherMap(u + (UpLo == Lower ? i : 0), UpLo == Lower ? size - i : (i + 1));
// FIXME This should be handled outside.
mat[offset + (UpLo == Lower ? 0 : i)] = numext::real(mat[offset + (UpLo == Lower ? 0 : i)]);
offset += UpLo == Lower ? size - i : (i + 1);
}
}
};
} // end namespace internal
} // end namespace internal
#endif // EIGEN_RANK2UPDATE_H
#endif // EIGEN_RANK2UPDATE_H

View File

@@ -2,8 +2,7 @@
#define BLAS_H
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
#define BLASFUNC(FUNC) FUNC##_
@@ -16,422 +15,454 @@ typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
int BLASFUNC(xerbla)(const char *, int *info, int);
int BLASFUNC(xerbla)(const char *, int *info, int);
float BLASFUNC(sdot) (int *, float *, int *, float *, int *);
float BLASFUNC(sdsdot)(int *, float *, float *, int *, float *, int *);
float BLASFUNC(sdot)(int *, float *, int *, float *, int *);
float BLASFUNC(sdsdot)(int *, float *, float *, int *, float *, int *);
double BLASFUNC(dsdot) (int *, float *, int *, float *, int *);
double BLASFUNC(ddot) (int *, double *, int *, double *, int *);
double BLASFUNC(qdot) (int *, double *, int *, double *, int *);
double BLASFUNC(dsdot)(int *, float *, int *, float *, int *);
double BLASFUNC(ddot)(int *, double *, int *, double *, int *);
double BLASFUNC(qdot)(int *, double *, int *, double *, int *);
int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*);
int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*);
int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*);
int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*);
int BLASFUNC(cdotuw)(int *, float *, int *, float *, int *, float *);
int BLASFUNC(cdotcw)(int *, float *, int *, float *, int *, float *);
int BLASFUNC(zdotuw)(int *, double *, int *, double *, int *, double *);
int BLASFUNC(zdotcw)(int *, double *, int *, double *, int *, double *);
int BLASFUNC(saxpy) (const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(daxpy) (const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(qaxpy) (const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(caxpy) (const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(zaxpy) (const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(xaxpy) (const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(caxpyc)(const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(zaxpyc)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(xaxpyc)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(saxpy)(const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(daxpy)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(qaxpy)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(caxpy)(const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(zaxpy)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(xaxpy)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(caxpyc)(const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(zaxpyc)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(xaxpyc)(const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(scopy) (int *, float *, int *, float *, int *);
int BLASFUNC(dcopy) (int *, double *, int *, double *, int *);
int BLASFUNC(qcopy) (int *, double *, int *, double *, int *);
int BLASFUNC(ccopy) (int *, float *, int *, float *, int *);
int BLASFUNC(zcopy) (int *, double *, int *, double *, int *);
int BLASFUNC(xcopy) (int *, double *, int *, double *, int *);
int BLASFUNC(scopy)(int *, float *, int *, float *, int *);
int BLASFUNC(dcopy)(int *, double *, int *, double *, int *);
int BLASFUNC(qcopy)(int *, double *, int *, double *, int *);
int BLASFUNC(ccopy)(int *, float *, int *, float *, int *);
int BLASFUNC(zcopy)(int *, double *, int *, double *, int *);
int BLASFUNC(xcopy)(int *, double *, int *, double *, int *);
int BLASFUNC(sswap) (int *, float *, int *, float *, int *);
int BLASFUNC(dswap) (int *, double *, int *, double *, int *);
int BLASFUNC(qswap) (int *, double *, int *, double *, int *);
int BLASFUNC(cswap) (int *, float *, int *, float *, int *);
int BLASFUNC(zswap) (int *, double *, int *, double *, int *);
int BLASFUNC(xswap) (int *, double *, int *, double *, int *);
int BLASFUNC(sswap)(int *, float *, int *, float *, int *);
int BLASFUNC(dswap)(int *, double *, int *, double *, int *);
int BLASFUNC(qswap)(int *, double *, int *, double *, int *);
int BLASFUNC(cswap)(int *, float *, int *, float *, int *);
int BLASFUNC(zswap)(int *, double *, int *, double *, int *);
int BLASFUNC(xswap)(int *, double *, int *, double *, int *);
float BLASFUNC(sasum) (int *, float *, int *);
float BLASFUNC(scasum)(int *, float *, int *);
double BLASFUNC(dasum) (int *, double *, int *);
double BLASFUNC(qasum) (int *, double *, int *);
float BLASFUNC(sasum)(int *, float *, int *);
float BLASFUNC(scasum)(int *, float *, int *);
double BLASFUNC(dasum)(int *, double *, int *);
double BLASFUNC(qasum)(int *, double *, int *);
double BLASFUNC(dzasum)(int *, double *, int *);
double BLASFUNC(qxasum)(int *, double *, int *);
int BLASFUNC(isamax)(int *, float *, int *);
int BLASFUNC(idamax)(int *, double *, int *);
int BLASFUNC(iqamax)(int *, double *, int *);
int BLASFUNC(icamax)(int *, float *, int *);
int BLASFUNC(izamax)(int *, double *, int *);
int BLASFUNC(ixamax)(int *, double *, int *);
int BLASFUNC(isamax)(int *, float *, int *);
int BLASFUNC(idamax)(int *, double *, int *);
int BLASFUNC(iqamax)(int *, double *, int *);
int BLASFUNC(icamax)(int *, float *, int *);
int BLASFUNC(izamax)(int *, double *, int *);
int BLASFUNC(ixamax)(int *, double *, int *);
int BLASFUNC(ismax) (int *, float *, int *);
int BLASFUNC(idmax) (int *, double *, int *);
int BLASFUNC(iqmax) (int *, double *, int *);
int BLASFUNC(icmax) (int *, float *, int *);
int BLASFUNC(izmax) (int *, double *, int *);
int BLASFUNC(ixmax) (int *, double *, int *);
int BLASFUNC(ismax)(int *, float *, int *);
int BLASFUNC(idmax)(int *, double *, int *);
int BLASFUNC(iqmax)(int *, double *, int *);
int BLASFUNC(icmax)(int *, float *, int *);
int BLASFUNC(izmax)(int *, double *, int *);
int BLASFUNC(ixmax)(int *, double *, int *);
int BLASFUNC(isamin)(int *, float *, int *);
int BLASFUNC(idamin)(int *, double *, int *);
int BLASFUNC(iqamin)(int *, double *, int *);
int BLASFUNC(icamin)(int *, float *, int *);
int BLASFUNC(izamin)(int *, double *, int *);
int BLASFUNC(ixamin)(int *, double *, int *);
int BLASFUNC(isamin)(int *, float *, int *);
int BLASFUNC(idamin)(int *, double *, int *);
int BLASFUNC(iqamin)(int *, double *, int *);
int BLASFUNC(icamin)(int *, float *, int *);
int BLASFUNC(izamin)(int *, double *, int *);
int BLASFUNC(ixamin)(int *, double *, int *);
int BLASFUNC(ismin)(int *, float *, int *);
int BLASFUNC(idmin)(int *, double *, int *);
int BLASFUNC(iqmin)(int *, double *, int *);
int BLASFUNC(icmin)(int *, float *, int *);
int BLASFUNC(izmin)(int *, double *, int *);
int BLASFUNC(ixmin)(int *, double *, int *);
int BLASFUNC(ismin)(int *, float *, int *);
int BLASFUNC(idmin)(int *, double *, int *);
int BLASFUNC(iqmin)(int *, double *, int *);
int BLASFUNC(icmin)(int *, float *, int *);
int BLASFUNC(izmin)(int *, double *, int *);
int BLASFUNC(ixmin)(int *, double *, int *);
float BLASFUNC(samax) (int *, float *, int *);
double BLASFUNC(damax) (int *, double *, int *);
double BLASFUNC(qamax) (int *, double *, int *);
float BLASFUNC(scamax)(int *, float *, int *);
float BLASFUNC(samax)(int *, float *, int *);
double BLASFUNC(damax)(int *, double *, int *);
double BLASFUNC(qamax)(int *, double *, int *);
float BLASFUNC(scamax)(int *, float *, int *);
double BLASFUNC(dzamax)(int *, double *, int *);
double BLASFUNC(qxamax)(int *, double *, int *);
float BLASFUNC(samin) (int *, float *, int *);
double BLASFUNC(damin) (int *, double *, int *);
double BLASFUNC(qamin) (int *, double *, int *);
float BLASFUNC(scamin)(int *, float *, int *);
float BLASFUNC(samin)(int *, float *, int *);
double BLASFUNC(damin)(int *, double *, int *);
double BLASFUNC(qamin)(int *, double *, int *);
float BLASFUNC(scamin)(int *, float *, int *);
double BLASFUNC(dzamin)(int *, double *, int *);
double BLASFUNC(qxamin)(int *, double *, int *);
float BLASFUNC(smax) (int *, float *, int *);
double BLASFUNC(dmax) (int *, double *, int *);
double BLASFUNC(qmax) (int *, double *, int *);
float BLASFUNC(scmax) (int *, float *, int *);
double BLASFUNC(dzmax) (int *, double *, int *);
double BLASFUNC(qxmax) (int *, double *, int *);
float BLASFUNC(smax)(int *, float *, int *);
double BLASFUNC(dmax)(int *, double *, int *);
double BLASFUNC(qmax)(int *, double *, int *);
float BLASFUNC(scmax)(int *, float *, int *);
double BLASFUNC(dzmax)(int *, double *, int *);
double BLASFUNC(qxmax)(int *, double *, int *);
float BLASFUNC(smin) (int *, float *, int *);
double BLASFUNC(dmin) (int *, double *, int *);
double BLASFUNC(qmin) (int *, double *, int *);
float BLASFUNC(scmin) (int *, float *, int *);
double BLASFUNC(dzmin) (int *, double *, int *);
double BLASFUNC(qxmin) (int *, double *, int *);
float BLASFUNC(smin)(int *, float *, int *);
double BLASFUNC(dmin)(int *, double *, int *);
double BLASFUNC(qmin)(int *, double *, int *);
float BLASFUNC(scmin)(int *, float *, int *);
double BLASFUNC(dzmin)(int *, double *, int *);
double BLASFUNC(qxmin)(int *, double *, int *);
int BLASFUNC(sscal) (int *, float *, float *, int *);
int BLASFUNC(dscal) (int *, double *, double *, int *);
int BLASFUNC(qscal) (int *, double *, double *, int *);
int BLASFUNC(cscal) (int *, float *, float *, int *);
int BLASFUNC(zscal) (int *, double *, double *, int *);
int BLASFUNC(xscal) (int *, double *, double *, int *);
int BLASFUNC(csscal)(int *, float *, float *, int *);
int BLASFUNC(zdscal)(int *, double *, double *, int *);
int BLASFUNC(xqscal)(int *, double *, double *, int *);
int BLASFUNC(sscal)(int *, float *, float *, int *);
int BLASFUNC(dscal)(int *, double *, double *, int *);
int BLASFUNC(qscal)(int *, double *, double *, int *);
int BLASFUNC(cscal)(int *, float *, float *, int *);
int BLASFUNC(zscal)(int *, double *, double *, int *);
int BLASFUNC(xscal)(int *, double *, double *, int *);
int BLASFUNC(csscal)(int *, float *, float *, int *);
int BLASFUNC(zdscal)(int *, double *, double *, int *);
int BLASFUNC(xqscal)(int *, double *, double *, int *);
float BLASFUNC(snrm2) (int *, float *, int *);
float BLASFUNC(scnrm2)(int *, float *, int *);
float BLASFUNC(snrm2)(int *, float *, int *);
float BLASFUNC(scnrm2)(int *, float *, int *);
double BLASFUNC(dnrm2) (int *, double *, int *);
double BLASFUNC(qnrm2) (int *, double *, int *);
double BLASFUNC(dnrm2)(int *, double *, int *);
double BLASFUNC(qnrm2)(int *, double *, int *);
double BLASFUNC(dznrm2)(int *, double *, int *);
double BLASFUNC(qxnrm2)(int *, double *, int *);
int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *);
int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *);
int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(srot)(int *, float *, int *, float *, int *, float *, float *);
int BLASFUNC(drot)(int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(qrot)(int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(csrot)(int *, float *, int *, float *, int *, float *, float *);
int BLASFUNC(zdrot)(int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(xqrot)(int *, double *, int *, double *, int *, double *, double *);
int BLASFUNC(srotg) (float *, float *, float *, float *);
int BLASFUNC(drotg) (double *, double *, double *, double *);
int BLASFUNC(qrotg) (double *, double *, double *, double *);
int BLASFUNC(crotg) (float *, float *, float *, float *);
int BLASFUNC(zrotg) (double *, double *, double *, double *);
int BLASFUNC(xrotg) (double *, double *, double *, double *);
int BLASFUNC(srotg)(float *, float *, float *, float *);
int BLASFUNC(drotg)(double *, double *, double *, double *);
int BLASFUNC(qrotg)(double *, double *, double *, double *);
int BLASFUNC(crotg)(float *, float *, float *, float *);
int BLASFUNC(zrotg)(double *, double *, double *, double *);
int BLASFUNC(xrotg)(double *, double *, double *, double *);
int BLASFUNC(srotmg)(float *, float *, float *, float *, float *);
int BLASFUNC(drotmg)(double *, double *, double *, double *, double *);
int BLASFUNC(srotmg)(float *, float *, float *, float *, float *);
int BLASFUNC(drotmg)(double *, double *, double *, double *, double *);
int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *);
int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *);
int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *);
int BLASFUNC(srotm)(int *, float *, int *, float *, int *, float *);
int BLASFUNC(drotm)(int *, double *, int *, double *, int *, double *);
int BLASFUNC(qrotm)(int *, double *, int *, double *, int *, double *);
/* Level 2 routines */
int BLASFUNC(sger)(int *, int *, float *, float *, int *,
float *, int *, float *, int *);
int BLASFUNC(dger)(int *, int *, double *, double *, int *,
double *, int *, double *, int *);
int BLASFUNC(qger)(int *, int *, double *, double *, int *,
double *, int *, double *, int *);
int BLASFUNC(cgeru)(int *, int *, float *, float *, int *,
float *, int *, float *, int *);
int BLASFUNC(cgerc)(int *, int *, float *, float *, int *,
float *, int *, float *, int *);
int BLASFUNC(zgeru)(int *, int *, double *, double *, int *,
double *, int *, double *, int *);
int BLASFUNC(zgerc)(int *, int *, double *, double *, int *,
double *, int *, double *, int *);
int BLASFUNC(xgeru)(int *, int *, double *, double *, int *,
double *, int *, double *, int *);
int BLASFUNC(xgerc)(int *, int *, double *, double *, int *,
double *, int *, double *, int *);
int BLASFUNC(sger)(int *, int *, float *, float *, int *, float *, int *, float *, int *);
int BLASFUNC(dger)(int *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(qger)(int *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(cgeru)(int *, int *, float *, float *, int *, float *, int *, float *, int *);
int BLASFUNC(cgerc)(int *, int *, float *, float *, int *, float *, int *, float *, int *);
int BLASFUNC(zgeru)(int *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(zgerc)(int *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(xgeru)(int *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(xgerc)(int *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(sgemv)(const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cgemv)(const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(sgemv)(const char *, const int *, const int *, const float *, const float *, const int *, const float *,
const int *, const float *, float *, const int *);
int BLASFUNC(dgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *,
const int *, const double *, double *, const int *);
int BLASFUNC(qgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *,
const int *, const double *, double *, const int *);
int BLASFUNC(cgemv)(const char *, const int *, const int *, const float *, const float *, const int *, const float *,
const int *, const float *, float *, const int *);
int BLASFUNC(zgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *,
const int *, const double *, double *, const int *);
int BLASFUNC(xgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *,
const int *, const double *, double *, const int *);
int BLASFUNC(strsv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *);
int BLASFUNC(dtrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(qtrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(ctrsv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *);
int BLASFUNC(ztrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(xtrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(strsv)(const char *, const char *, const char *, const int *, const float *, const int *, float *,
const int *);
int BLASFUNC(dtrsv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(qtrsv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(ctrsv)(const char *, const char *, const char *, const int *, const float *, const int *, float *,
const int *);
int BLASFUNC(ztrsv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(xtrsv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(stpsv)(char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(dtpsv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(qtpsv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(ctpsv)(char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(ztpsv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(xtpsv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(strmv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *);
int BLASFUNC(dtrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(qtrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(ctrmv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *);
int BLASFUNC(ztrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(xtrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(strmv)(const char *, const char *, const char *, const int *, const float *, const int *, float *,
const int *);
int BLASFUNC(dtrmv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(qtrmv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(ctrmv)(const char *, const char *, const char *, const int *, const float *, const int *, float *,
const int *);
int BLASFUNC(ztrmv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(xtrmv)(const char *, const char *, const char *, const int *, const double *, const int *, double *,
const int *);
int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(stpmv)(char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(dtpmv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(qtpmv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(ctpmv)(char *, char *, char *, int *, float *, float *, int *);
int BLASFUNC(ztpmv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(xtpmv)(char *, char *, char *, int *, double *, double *, int *);
int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(stbmv)(char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(dtbmv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(qtbmv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(ctbmv)(char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(ztbmv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(xtbmv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(stbsv)(char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(dtbsv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(qtbsv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(ctbsv)(char *, char *, char *, int *, int *, float *, int *, float *, int *);
int BLASFUNC(ztbsv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(xtbsv)(char *, char *, char *, int *, int *, double *, int *, double *, int *);
int BLASFUNC(ssymv) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dsymv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qsymv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(ssymv)(const char *, const int *, const float *, const float *, const int *, const float *, const int *,
const float *, float *, const int *);
int BLASFUNC(dsymv)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(qsymv)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(sspmv) (char *, int *, float *, float *,
float *, int *, float *, float *, int *);
int BLASFUNC(dspmv) (char *, int *, double *, double *,
double *, int *, double *, double *, int *);
int BLASFUNC(qspmv) (char *, int *, double *, double *,
double *, int *, double *, double *, int *);
int BLASFUNC(sspmv)(char *, int *, float *, float *, float *, int *, float *, float *, int *);
int BLASFUNC(dspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
int BLASFUNC(qspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
int BLASFUNC(ssyr) (const char *, const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(dsyr) (const char *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(qsyr) (const char *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(ssyr)(const char *, const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(dsyr)(const char *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(qsyr)(const char *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(ssyr2) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, float *, const int *);
int BLASFUNC(dsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(qsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(csyr2) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, float *, const int *);
int BLASFUNC(zsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(xsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *);
int BLASFUNC(ssyr2)(const char *, const int *, const float *, const float *, const int *, const float *, const int *,
float *, const int *);
int BLASFUNC(dsyr2)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
double *, const int *);
int BLASFUNC(qsyr2)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
double *, const int *);
int BLASFUNC(csyr2)(const char *, const int *, const float *, const float *, const int *, const float *, const int *,
float *, const int *);
int BLASFUNC(zsyr2)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
double *, const int *);
int BLASFUNC(xsyr2)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
double *, const int *);
int BLASFUNC(sspr) (char *, int *, float *, float *, int *,
float *);
int BLASFUNC(dspr) (char *, int *, double *, double *, int *,
double *);
int BLASFUNC(qspr) (char *, int *, double *, double *, int *,
double *);
int BLASFUNC(sspr)(char *, int *, float *, float *, int *, float *);
int BLASFUNC(dspr)(char *, int *, double *, double *, int *, double *);
int BLASFUNC(qspr)(char *, int *, double *, double *, int *, double *);
int BLASFUNC(sspr2) (char *, int *, float *,
float *, int *, float *, int *, float *);
int BLASFUNC(dspr2) (char *, int *, double *,
double *, int *, double *, int *, double *);
int BLASFUNC(qspr2) (char *, int *, double *,
double *, int *, double *, int *, double *);
int BLASFUNC(cspr2) (char *, int *, float *,
float *, int *, float *, int *, float *);
int BLASFUNC(zspr2) (char *, int *, double *,
double *, int *, double *, int *, double *);
int BLASFUNC(xspr2) (char *, int *, double *,
double *, int *, double *, int *, double *);
int BLASFUNC(sspr2)(char *, int *, float *, float *, int *, float *, int *, float *);
int BLASFUNC(dspr2)(char *, int *, double *, double *, int *, double *, int *, double *);
int BLASFUNC(qspr2)(char *, int *, double *, double *, int *, double *, int *, double *);
int BLASFUNC(cspr2)(char *, int *, float *, float *, int *, float *, int *, float *);
int BLASFUNC(zspr2)(char *, int *, double *, double *, int *, double *, int *, double *);
int BLASFUNC(xspr2)(char *, int *, double *, double *, int *, double *, int *, double *);
int BLASFUNC(cher) (char *, int *, float *, float *, int *,
float *, int *);
int BLASFUNC(zher) (char *, int *, double *, double *, int *,
double *, int *);
int BLASFUNC(xher) (char *, int *, double *, double *, int *,
double *, int *);
int BLASFUNC(cher)(char *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(zher)(char *, int *, double *, double *, int *, double *, int *);
int BLASFUNC(xher)(char *, int *, double *, double *, int *, double *, int *);
int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *);
int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *);
int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *);
int BLASFUNC(chpr)(char *, int *, float *, float *, int *, float *);
int BLASFUNC(zhpr)(char *, int *, double *, double *, int *, double *);
int BLASFUNC(xhpr)(char *, int *, double *, double *, int *, double *);
int BLASFUNC(cher2) (char *, int *, float *,
float *, int *, float *, int *, float *, int *);
int BLASFUNC(zher2) (char *, int *, double *,
double *, int *, double *, int *, double *, int *);
int BLASFUNC(xher2) (char *, int *, double *,
double *, int *, double *, int *, double *, int *);
int BLASFUNC(cher2)(char *, int *, float *, float *, int *, float *, int *, float *, int *);
int BLASFUNC(zher2)(char *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(xher2)(char *, int *, double *, double *, int *, double *, int *, double *, int *);
int BLASFUNC(chpr2) (char *, int *, float *,
float *, int *, float *, int *, float *);
int BLASFUNC(zhpr2) (char *, int *, double *,
double *, int *, double *, int *, double *);
int BLASFUNC(xhpr2) (char *, int *, double *,
double *, int *, double *, int *, double *);
int BLASFUNC(chpr2)(char *, int *, float *, float *, int *, float *, int *, float *);
int BLASFUNC(zhpr2)(char *, int *, double *, double *, int *, double *, int *, double *);
int BLASFUNC(xhpr2)(char *, int *, double *, double *, int *, double *, int *, double *);
int BLASFUNC(chemv) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zhemv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xhemv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(chemv)(const char *, const int *, const float *, const float *, const int *, const float *, const int *,
const float *, float *, const int *);
int BLASFUNC(zhemv)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(xhemv)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(chpmv) (char *, int *, float *, float *,
float *, int *, float *, float *, int *);
int BLASFUNC(zhpmv) (char *, int *, double *, double *,
double *, int *, double *, double *, int *);
int BLASFUNC(xhpmv) (char *, int *, double *, double *,
double *, int *, double *, double *, int *);
int BLASFUNC(chpmv)(char *, int *, float *, float *, float *, int *, float *, float *, int *);
int BLASFUNC(zhpmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
int BLASFUNC(xhpmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
int BLASFUNC(snorm)(char *, int *, int *, float *, int *);
int BLASFUNC(snorm)(char *, int *, int *, float *, int *);
int BLASFUNC(dnorm)(char *, int *, int *, double *, int *);
int BLASFUNC(cnorm)(char *, int *, int *, float *, int *);
int BLASFUNC(cnorm)(char *, int *, int *, float *, int *);
int BLASFUNC(znorm)(char *, int *, int *, double *, int *);
int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *,
float *, int *, float *, float *, int *);
int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *,
float *, int *, float *, float *, int *);
int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *,
int *);
int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *,
int *);
int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *,
float *, int *, float *, float *, int *);
int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *,
float *, int *, float *, float *, int *);
int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *,
float *, int *, float *, float *, int *);
int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
/* Level 3 routines */
int BLASFUNC(sgemm)(const char *, const char *, const int *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cgemm)(const char *, const char *, const int *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(sgemm)(const char *, const char *, const int *, const int *, const int *, const float *, const float *,
const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *,
const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *,
const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cgemm)(const char *, const char *, const int *, const int *, const int *, const float *, const float *,
const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *,
const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *,
const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *,
float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *,
double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *,
double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *,
int *);
int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *,
double *, int *);
int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *,
double *, int *);
int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *,
float *, float *, int *, float *, int *,
float *, float *, int *);
int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *,
double *, double *, int *, double *, int *,
double *, double *, int *);
int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *,
float *, float *, int *, float *, int *,
float *, float *, int *);
int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *,
double *, double *, int *, double *, int *,
double *, double *, int *);
int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *,
int *);
int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *, double *, double *, int *, double *, int *, double *,
double *, int *);
int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *,
int *);
int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *, double *, double *, int *, double *, int *, double *,
double *, int *);
int BLASFUNC(strsm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(dtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(qtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(ctrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(ztrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(xtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(strsm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *,
const float *, const int *, float *, const int *);
int BLASFUNC(dtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(qtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(ctrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *,
const float *, const int *, float *, const int *);
int BLASFUNC(ztrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(xtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(strmm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(dtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(qtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(ctrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *);
int BLASFUNC(ztrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(xtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *);
int BLASFUNC(strmm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *,
const float *, const int *, float *, const int *);
int BLASFUNC(dtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(qtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(ctrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *,
const float *, const int *, float *, const int *);
int BLASFUNC(ztrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(xtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *,
const double *, const int *, double *, const int *);
int BLASFUNC(ssymm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(csymm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(ssymm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(csymm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(ssyrk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(csyrk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(ssyrk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, float *, const int *);
int BLASFUNC(dsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(qsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(csyrk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, float *, const int *);
int BLASFUNC(zsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(xsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(ssyr2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *);
int BLASFUNC(qsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *);
int BLASFUNC(csyr2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *);
int BLASFUNC(xsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *);
int BLASFUNC(ssyr2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, const int *, const float *, float *, const int *);
int BLASFUNC(dsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(qsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(csyr2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(chemm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zhemm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xhemm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(chemm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zhemm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xhemm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *,
float *, int *, float *, float *, int *);
int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *,
double *, int *, double *, double *, int *);
int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *);
int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *,
int *);
int BLASFUNC(cherk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zherk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xherk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cher2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zher2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xher2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cher2m)(const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zher2m)(const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *);
int BLASFUNC(xher2m)(const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *);
int BLASFUNC(cherk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, float *, const int *);
int BLASFUNC(zherk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(xherk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(cher2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *,
const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zher2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xher2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *,
const double *, const int *, const double *, double *, const int *);
int BLASFUNC(cher2m)(const char *, const char *, const char *, const int *, const int *, const float *, const float *,
const int *, const float *, const int *, const float *, float *, const int *);
int BLASFUNC(zher2m)(const char *, const char *, const char *, const int *, const int *, const double *, const double *,
const int *, const double *, const int *, const double *, double *, const int *);
int BLASFUNC(xher2m)(const char *, const char *, const char *, const int *, const int *, const double *, const double *,
const int *, const double *, const int *, const double *, double *, const int *);
#ifdef __cplusplus
}

View File

@@ -11,11 +11,11 @@
#define EIGEN_BLAS_COMMON_H
#ifdef __GNUC__
# if __GNUC__<5
#if __GNUC__ < 5
// GCC < 5.0 does not like the global Scalar typedef
// we just keep shadow-warnings disabled permanently
# define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
# endif
#define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
#endif
#endif
#include "../Eigen/Core"
@@ -29,54 +29,35 @@
#include "blas.h"
#define NOTR 0
#define TR 1
#define ADJ 2
#define NOTR 0
#define TR 1
#define ADJ 2
#define LEFT 0
#define RIGHT 1
#define LEFT 0
#define RIGHT 1
#define UP 0
#define LO 1
#define UP 0
#define LO 1
#define NUNIT 0
#define UNIT 1
#define NUNIT 0
#define UNIT 1
#define INVALID 0xff
#define OP(X) ( ((X)=='N' || (X)=='n') ? NOTR \
: ((X)=='T' || (X)=='t') ? TR \
: ((X)=='C' || (X)=='c') ? ADJ \
: INVALID)
#define OP(X) \
(((X) == 'N' || (X) == 'n') ? NOTR : ((X) == 'T' || (X) == 't') ? TR : ((X) == 'C' || (X) == 'c') ? ADJ : INVALID)
#define SIDE(X) ( ((X)=='L' || (X)=='l') ? LEFT \
: ((X)=='R' || (X)=='r') ? RIGHT \
: INVALID)
#define SIDE(X) (((X) == 'L' || (X) == 'l') ? LEFT : ((X) == 'R' || (X) == 'r') ? RIGHT : INVALID)
#define UPLO(X) ( ((X)=='U' || (X)=='u') ? UP \
: ((X)=='L' || (X)=='l') ? LO \
: INVALID)
#define UPLO(X) (((X) == 'U' || (X) == 'u') ? UP : ((X) == 'L' || (X) == 'l') ? LO : INVALID)
#define DIAG(X) ( ((X)=='N' || (X)=='n') ? NUNIT \
: ((X)=='U' || (X)=='u') ? UNIT \
: INVALID)
#define DIAG(X) (((X) == 'N' || (X) == 'n') ? NUNIT : ((X) == 'U' || (X) == 'u') ? UNIT : INVALID)
inline bool check_op(const char* op) { return OP(*op) != 0xff; }
inline bool check_op(const char* op)
{
return OP(*op)!=0xff;
}
inline bool check_side(const char* side)
{
return SIDE(*side)!=0xff;
}
inline bool check_uplo(const char* uplo)
{
return UPLO(*uplo)!=0xff;
}
inline bool check_side(const char* side) { return SIDE(*side) != 0xff; }
inline bool check_uplo(const char* uplo) { return UPLO(*uplo) != 0xff; }
namespace Eigen {
#include "BandTriangularSolver.h"
@@ -85,7 +66,7 @@ namespace Eigen {
#include "PackedTriangularMatrixVector.h"
#include "PackedTriangularSolverVector.h"
#include "Rank2Update.h"
}
} // namespace Eigen
using namespace Eigen;
@@ -93,76 +74,65 @@ typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef std::complex<RealScalar> Complex;
enum
{
IsComplex = Eigen::NumTraits<SCALAR>::IsComplex,
Conj = IsComplex
};
enum { IsComplex = Eigen::NumTraits<SCALAR>::IsComplex, Conj = IsComplex };
typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> PlainMatrixType;
typedef Map<Matrix<Scalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > MatrixType;
typedef Map<const Matrix<Scalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > ConstMatrixType;
typedef Map<Matrix<Scalar,Dynamic,1>, 0, InnerStride<Dynamic> > StridedVectorType;
typedef Map<Matrix<Scalar,Dynamic,1> > CompactVectorType;
typedef Matrix<Scalar, Dynamic, Dynamic, ColMajor> PlainMatrixType;
typedef Map<Matrix<Scalar, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> > MatrixType;
typedef Map<const Matrix<Scalar, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> > ConstMatrixType;
typedef Map<Matrix<Scalar, Dynamic, 1>, 0, InnerStride<Dynamic> > StridedVectorType;
typedef Map<Matrix<Scalar, Dynamic, 1> > CompactVectorType;
template<typename T>
Map<Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >
matrix(T* data, int rows, int cols, int stride)
{
return Map<Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >(data, rows, cols, OuterStride<>(stride));
template <typename T>
Map<Matrix<T, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> > matrix(T* data, int rows, int cols, int stride) {
return Map<Matrix<T, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> >(data, rows, cols, OuterStride<>(stride));
}
template<typename T>
Map<const Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >
matrix(const T* data, int rows, int cols, int stride)
{
return Map<const Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >(data, rows, cols, OuterStride<>(stride));
template <typename T>
Map<const Matrix<T, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> > matrix(const T* data, int rows, int cols,
int stride) {
return Map<const Matrix<T, Dynamic, Dynamic, ColMajor>, 0, OuterStride<> >(data, rows, cols, OuterStride<>(stride));
}
template<typename T>
Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> > make_vector(T* data, int size, int incr)
{
return Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));
template <typename T>
Map<Matrix<T, Dynamic, 1>, 0, InnerStride<Dynamic> > make_vector(T* data, int size, int incr) {
return Map<Matrix<T, Dynamic, 1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));
}
template<typename T>
Map<const Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> > make_vector(const T* data, int size, int incr)
{
return Map<const Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));
template <typename T>
Map<const Matrix<T, Dynamic, 1>, 0, InnerStride<Dynamic> > make_vector(const T* data, int size, int incr) {
return Map<const Matrix<T, Dynamic, 1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));
}
template<typename T>
Map<Matrix<T,Dynamic,1> > make_vector(T* data, int size)
{
return Map<Matrix<T,Dynamic,1> >(data, size);
template <typename T>
Map<Matrix<T, Dynamic, 1> > make_vector(T* data, int size) {
return Map<Matrix<T, Dynamic, 1> >(data, size);
}
template<typename T>
Map<const Matrix<T,Dynamic,1> > make_vector(const T* data, int size)
{
return Map<const Matrix<T,Dynamic,1> >(data, size);
template <typename T>
Map<const Matrix<T, Dynamic, 1> > make_vector(const T* data, int size) {
return Map<const Matrix<T, Dynamic, 1> >(data, size);
}
template<typename T>
T* get_compact_vector(T* x, int n, int incx)
{
if(incx==1)
return x;
template <typename T>
T* get_compact_vector(T* x, int n, int incx) {
if (incx == 1) return x;
std::remove_const_t<T>* ret = new Scalar[n];
if(incx<0) make_vector(ret,n) = make_vector(x,n,-incx).reverse();
else make_vector(ret,n) = make_vector(x,n, incx);
if (incx < 0)
make_vector(ret, n) = make_vector(x, n, -incx).reverse();
else
make_vector(ret, n) = make_vector(x, n, incx);
return ret;
}
template<typename T>
T* copy_back(T* x_cpy, T* x, int n, int incx)
{
if(x_cpy==x)
return 0;
template <typename T>
T* copy_back(T* x_cpy, T* x, int n, int incx) {
if (x_cpy == x) return 0;
if(incx<0) make_vector(x,n,-incx).reverse() = make_vector(x_cpy,n);
else make_vector(x,n, incx) = make_vector(x_cpy,n);
if (incx < 0)
make_vector(x, n, -incx).reverse() = make_vector(x_cpy, n);
else
make_vector(x, n, incx) = make_vector(x_cpy, n);
return x_cpy;
}
@@ -172,4 +142,4 @@ T* copy_back(T* x_cpy, T* x, int n, int incx)
#define EIGEN_BLAS_FUNC(X) EIGEN_CAT(SCALAR_SUFFIX, EIGEN_CAT(X, EIGEN_BLAS_FUNC_SUFFIX))
#endif // EIGEN_BLAS_COMMON_H
#endif // EIGEN_BLAS_COMMON_H

View File

@@ -7,11 +7,11 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define SCALAR std::complex<double>
#define SCALAR std::complex<double>
#define SCALAR_SUFFIX z
#define SCALAR_SUFFIX_UP "Z"
#define REAL_SCALAR_SUFFIX d
#define ISCOMPLEX 1
#define ISCOMPLEX 1
#include "level1_impl.h"
#include "level1_cplx_impl.h"

View File

@@ -7,11 +7,11 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define SCALAR std::complex<float>
#define SCALAR std::complex<float>
#define SCALAR_SUFFIX c
#define SCALAR_SUFFIX_UP "C"
#define REAL_SCALAR_SUFFIX s
#define ISCOMPLEX 1
#define ISCOMPLEX 1
#include "level1_impl.h"
#include "level1_cplx_impl.h"

View File

@@ -8,10 +8,10 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define SCALAR double
#define SCALAR double
#define SCALAR_SUFFIX d
#define SCALAR_SUFFIX_UP "D"
#define ISCOMPLEX 0
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
@@ -19,14 +19,25 @@
#include "level2_real_impl.h"
#include "level3_impl.h"
double EIGEN_BLAS_FUNC(sdot)(int* n, float* x, int* incx, float* y, int* incy)
{
if(*n<=0) return 0;
double EIGEN_BLAS_FUNC(sdot)(int* n, float* x, int* incx, float* y, int* incy) {
if (*n <= 0) return 0;
if(*incx==1 && *incy==1) return (make_vector(x,*n).cast<double>().cwiseProduct(make_vector(y,*n).cast<double>())).sum();
else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
else return 0;
if (*incx == 1 && *incy == 1)
return (make_vector(x, *n).cast<double>().cwiseProduct(make_vector(y, *n).cast<double>())).sum();
else if (*incx > 0 && *incy > 0)
return (make_vector(x, *n, *incx).cast<double>().cwiseProduct(make_vector(y, *n, *incy).cast<double>())).sum();
else if (*incx < 0 && *incy > 0)
return (make_vector(x, *n, -*incx).reverse().cast<double>().cwiseProduct(make_vector(y, *n, *incy).cast<double>()))
.sum();
else if (*incx > 0 && *incy < 0)
return (make_vector(x, *n, *incx).cast<double>().cwiseProduct(make_vector(y, *n, -*incy).reverse().cast<double>()))
.sum();
else if (*incx < 0 && *incy < 0)
return (make_vector(x, *n, -*incx)
.reverse()
.cast<double>()
.cwiseProduct(make_vector(y, *n, -*incy).reverse().cast<double>()))
.sum();
else
return 0;
}

View File

@@ -9,16 +9,20 @@ typedef int integer;
typedef unsigned int uinteger;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
typedef struct {
real r, i;
} complex;
typedef struct {
doublereal r, i;
} doublecomplex;
typedef int ftnlen;
typedef int logical;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (doublereal)abs(x)
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define max(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (doublereal)min(a,b)
#define dmax(a,b) (doublereal)max(a,b)
#define dabs(x) (doublereal) abs(x)
#define min(a, b) ((a) <= (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
#define dmin(a, b) (doublereal) min(a, b)
#define dmax(a, b) (doublereal) max(a, b)
#endif

View File

@@ -11,144 +11,155 @@
struct scalar_norm1_op {
typedef RealScalar result_type;
inline RealScalar operator() (const Scalar& a) const { return numext::norm1(a); }
inline RealScalar operator()(const Scalar &a) const { return numext::norm1(a); }
};
namespace Eigen {
namespace internal {
template<> struct functor_traits<scalar_norm1_op >
{
enum { Cost = 3 * NumTraits<Scalar>::AddCost, PacketAccess = 0 };
};
}
}
namespace internal {
template <>
struct functor_traits<scalar_norm1_op> {
enum { Cost = 3 * NumTraits<Scalar>::AddCost, PacketAccess = 0 };
};
} // namespace internal
} // namespace Eigen
// computes the sum of magnitudes of all vector elements or, for a complex vector x, the sum
// res = |Rex1| + |Imx1| + |Rex2| + |Imx2| + ... + |Rexn| + |Imxn|, where x is a vector of order n
RealScalar EIGEN_CAT(REAL_SCALAR_SUFFIX, EIGEN_BLAS_FUNC(asum))(int *n, RealScalar *px, int *incx)
{
// std::cerr << "__asum " << *n << " " << *incx << "\n";
Complex* x = reinterpret_cast<Complex*>(px);
RealScalar EIGEN_CAT(REAL_SCALAR_SUFFIX, EIGEN_BLAS_FUNC(asum))(int *n, RealScalar *px, int *incx) {
// std::cerr << "__asum " << *n << " " << *incx << "\n";
Complex *x = reinterpret_cast<Complex *>(px);
if(*n<=0) return 0;
if (*n <= 0) return 0;
if(*incx==1) return make_vector(x,*n).unaryExpr<scalar_norm1_op>().sum();
else return make_vector(x,*n,std::abs(*incx)).unaryExpr<scalar_norm1_op>().sum();
if (*incx == 1)
return make_vector(x, *n).unaryExpr<scalar_norm1_op>().sum();
else
return make_vector(x, *n, std::abs(*incx)).unaryExpr<scalar_norm1_op>().sum();
}
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amax))(int *n, RealScalar *px, int *incx)
{
if(*n<=0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amax))(int *n, RealScalar *px, int *incx) {
if (*n <= 0) return 0;
Scalar *x = reinterpret_cast<Scalar *>(px);
DenseIndex ret;
if(*incx==1) make_vector(x,*n).unaryExpr<scalar_norm1_op>().maxCoeff(&ret);
else make_vector(x,*n,std::abs(*incx)).unaryExpr<scalar_norm1_op>().maxCoeff(&ret);
return int(ret)+1;
if (*incx == 1)
make_vector(x, *n).unaryExpr<scalar_norm1_op>().maxCoeff(&ret);
else
make_vector(x, *n, std::abs(*incx)).unaryExpr<scalar_norm1_op>().maxCoeff(&ret);
return int(ret) + 1;
}
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amin))(int *n, RealScalar *px, int *incx)
{
if(*n<=0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amin))(int *n, RealScalar *px, int *incx) {
if (*n <= 0) return 0;
Scalar *x = reinterpret_cast<Scalar *>(px);
DenseIndex ret;
if(*incx==1) make_vector(x,*n).unaryExpr<scalar_norm1_op>().minCoeff(&ret);
else make_vector(x,*n,std::abs(*incx)).unaryExpr<scalar_norm1_op>().minCoeff(&ret);
return int(ret)+1;
if (*incx == 1)
make_vector(x, *n).unaryExpr<scalar_norm1_op>().minCoeff(&ret);
else
make_vector(x, *n, std::abs(*incx)).unaryExpr<scalar_norm1_op>().minCoeff(&ret);
return int(ret) + 1;
}
// computes a dot product of a conjugated vector with another vector.
int EIGEN_BLAS_FUNC(dotcw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)
{
// std::cerr << "_dotc " << *n << " " << *incx << " " << *incy << "\n";
Scalar* res = reinterpret_cast<Scalar*>(pres);
int EIGEN_BLAS_FUNC(dotcw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pres) {
// std::cerr << "_dotc " << *n << " " << *incx << " " << *incy << "\n";
Scalar *res = reinterpret_cast<Scalar *>(pres);
if(*n<=0)
{
if (*n <= 0) {
*res = Scalar(0);
return 0;
}
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
if(*incx==1 && *incy==1) *res = (make_vector(x,*n).dot(make_vector(y,*n)));
else if(*incx>0 && *incy>0) *res = (make_vector(x,*n,*incx).dot(make_vector(y,*n,*incy)));
else if(*incx<0 && *incy>0) *res = (make_vector(x,*n,-*incx).reverse().dot(make_vector(y,*n,*incy)));
else if(*incx>0 && *incy<0) *res = (make_vector(x,*n,*incx).dot(make_vector(y,*n,-*incy).reverse()));
else if(*incx<0 && *incy<0) *res = (make_vector(x,*n,-*incx).reverse().dot(make_vector(y,*n,-*incy).reverse()));
if (*incx == 1 && *incy == 1)
*res = (make_vector(x, *n).dot(make_vector(y, *n)));
else if (*incx > 0 && *incy > 0)
*res = (make_vector(x, *n, *incx).dot(make_vector(y, *n, *incy)));
else if (*incx < 0 && *incy > 0)
*res = (make_vector(x, *n, -*incx).reverse().dot(make_vector(y, *n, *incy)));
else if (*incx > 0 && *incy < 0)
*res = (make_vector(x, *n, *incx).dot(make_vector(y, *n, -*incy).reverse()));
else if (*incx < 0 && *incy < 0)
*res = (make_vector(x, *n, -*incx).reverse().dot(make_vector(y, *n, -*incy).reverse()));
return 0;
}
// computes a vector-vector dot product without complex conjugation.
int EIGEN_BLAS_FUNC(dotuw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)
{
Scalar* res = reinterpret_cast<Scalar*>(pres);
int EIGEN_BLAS_FUNC(dotuw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pres) {
Scalar *res = reinterpret_cast<Scalar *>(pres);
if(*n<=0)
{
if (*n <= 0) {
*res = Scalar(0);
return 0;
}
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
if(*incx==1 && *incy==1) *res = (make_vector(x,*n).cwiseProduct(make_vector(y,*n))).sum();
else if(*incx>0 && *incy>0) *res = (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,*incy))).sum();
else if(*incx<0 && *incy>0) *res = (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,*incy))).sum();
else if(*incx>0 && *incy<0) *res = (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
else if(*incx<0 && *incy<0) *res = (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
if (*incx == 1 && *incy == 1)
*res = (make_vector(x, *n).cwiseProduct(make_vector(y, *n))).sum();
else if (*incx > 0 && *incy > 0)
*res = (make_vector(x, *n, *incx).cwiseProduct(make_vector(y, *n, *incy))).sum();
else if (*incx < 0 && *incy > 0)
*res = (make_vector(x, *n, -*incx).reverse().cwiseProduct(make_vector(y, *n, *incy))).sum();
else if (*incx > 0 && *incy < 0)
*res = (make_vector(x, *n, *incx).cwiseProduct(make_vector(y, *n, -*incy).reverse())).sum();
else if (*incx < 0 && *incy < 0)
*res = (make_vector(x, *n, -*incx).reverse().cwiseProduct(make_vector(y, *n, -*incy).reverse())).sum();
return 0;
}
RealScalar EIGEN_CAT(REAL_SCALAR_SUFFIX, EIGEN_BLAS_FUNC(nrm2))(int *n, RealScalar *px, int *incx)
{
// std::cerr << "__nrm2 " << *n << " " << *incx << "\n";
if(*n<=0) return 0;
RealScalar EIGEN_CAT(REAL_SCALAR_SUFFIX, EIGEN_BLAS_FUNC(nrm2))(int *n, RealScalar *px, int *incx) {
// std::cerr << "__nrm2 " << *n << " " << *incx << "\n";
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar *x = reinterpret_cast<Scalar *>(px);
if(*incx==1)
return make_vector(x,*n).stableNorm();
if (*incx == 1) return make_vector(x, *n).stableNorm();
return make_vector(x,*n,*incx).stableNorm();
return make_vector(x, *n, *incx).stableNorm();
}
int EIGEN_BLAS_FUNC(EIGEN_CAT(REAL_SCALAR_SUFFIX, rot))(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)
{
if(*n<=0) return 0;
int EIGEN_BLAS_FUNC(EIGEN_CAT(REAL_SCALAR_SUFFIX, rot))(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy,
RealScalar *pc, RealScalar *ps) {
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
RealScalar c = *pc;
RealScalar s = *ps;
StridedVectorType vx(make_vector(x,*n,std::abs(*incx)));
StridedVectorType vy(make_vector(y,*n,std::abs(*incy)));
StridedVectorType vx(make_vector(x, *n, std::abs(*incx)));
StridedVectorType vy(make_vector(y, *n, std::abs(*incy)));
Reverse<StridedVectorType> rvx(vx);
Reverse<StridedVectorType> rvy(vy);
// TODO implement mixed real-scalar rotations
if(*incx<0 && *incy>0) internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c,s));
else if(*incx>0 && *incy<0) internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c,s));
else internal::apply_rotation_in_the_plane(vx, vy, JacobiRotation<Scalar>(c,s));
if (*incx < 0 && *incy > 0)
internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c, s));
else if (*incx > 0 && *incy < 0)
internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c, s));
else
internal::apply_rotation_in_the_plane(vx, vy, JacobiRotation<Scalar>(c, s));
return 0;
}
int EIGEN_BLAS_FUNC(EIGEN_CAT(REAL_SCALAR_SUFFIX, scal))(int *n, RealScalar *palpha, RealScalar *px, int *incx)
{
if(*n<=0) return 0;
int EIGEN_BLAS_FUNC(EIGEN_CAT(REAL_SCALAR_SUFFIX, scal))(int *n, RealScalar *palpha, RealScalar *px, int *incx) {
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar *x = reinterpret_cast<Scalar *>(px);
RealScalar alpha = *palpha;
// std::cerr << "__scal " << *n << " " << alpha << " " << *incx << "\n";
// std::cerr << "__scal " << *n << " " << alpha << " " << *incx << "\n";
if(*incx==1) make_vector(x,*n) *= alpha;
else make_vector(x,*n,std::abs(*incx)) *= alpha;
if (*incx == 1)
make_vector(x, *n) *= alpha;
else
make_vector(x, *n, std::abs(*incx)) *= alpha;
return 0;
}

View File

@@ -9,39 +9,41 @@
#include "common.h"
int EIGEN_BLAS_FUNC(axpy)(const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, RealScalar *py, const int *incy)
{
const Scalar* x = reinterpret_cast<const Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
int EIGEN_BLAS_FUNC(axpy)(const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, RealScalar *py,
const int *incy) {
const Scalar *x = reinterpret_cast<const Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
if(*n<=0) return 0;
if (*n <= 0) return 0;
if(*incx==1 && *incy==1) make_vector(y,*n) += alpha * make_vector(x,*n);
else if(*incx>0 && *incy>0) make_vector(y,*n,*incy) += alpha * make_vector(x,*n,*incx);
else if(*incx>0 && *incy<0) make_vector(y,*n,-*incy).reverse() += alpha * make_vector(x,*n,*incx);
else if(*incx<0 && *incy>0) make_vector(y,*n,*incy) += alpha * make_vector(x,*n,-*incx).reverse();
else if(*incx<0 && *incy<0) make_vector(y,*n,-*incy).reverse() += alpha * make_vector(x,*n,-*incx).reverse();
if (*incx == 1 && *incy == 1)
make_vector(y, *n) += alpha * make_vector(x, *n);
else if (*incx > 0 && *incy > 0)
make_vector(y, *n, *incy) += alpha * make_vector(x, *n, *incx);
else if (*incx > 0 && *incy < 0)
make_vector(y, *n, -*incy).reverse() += alpha * make_vector(x, *n, *incx);
else if (*incx < 0 && *incy > 0)
make_vector(y, *n, *incy) += alpha * make_vector(x, *n, -*incx).reverse();
else if (*incx < 0 && *incy < 0)
make_vector(y, *n, -*incy).reverse() += alpha * make_vector(x, *n, -*incx).reverse();
return 0;
}
int EIGEN_BLAS_FUNC(copy)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
{
if(*n<=0) return 0;
int EIGEN_BLAS_FUNC(copy)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy) {
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
// be careful, *incx==0 is allowed !!
if(*incx==1 && *incy==1)
make_vector(y,*n) = make_vector(x,*n);
else
{
if(*incx<0) x = x - (*n-1)*(*incx);
if(*incy<0) y = y - (*n-1)*(*incy);
for(int i=0;i<*n;++i)
{
if (*incx == 1 && *incy == 1)
make_vector(y, *n) = make_vector(x, *n);
else {
if (*incx < 0) x = x - (*n - 1) * (*incx);
if (*incy < 0) y = y - (*n - 1) * (*incy);
for (int i = 0; i < *n; ++i) {
*y = *x;
x += *incx;
y += *incy;
@@ -51,94 +53,91 @@ int EIGEN_BLAS_FUNC(copy)(int *n, RealScalar *px, int *incx, RealScalar *py, int
return 0;
}
int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealScalar *ps)
{
using std::sqrt;
int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealScalar *ps) {
using std::abs;
using std::sqrt;
Scalar& a = *reinterpret_cast<Scalar*>(pa);
Scalar& b = *reinterpret_cast<Scalar*>(pb);
RealScalar* c = pc;
Scalar* s = reinterpret_cast<Scalar*>(ps);
Scalar &a = *reinterpret_cast<Scalar *>(pa);
Scalar &b = *reinterpret_cast<Scalar *>(pb);
RealScalar *c = pc;
Scalar *s = reinterpret_cast<Scalar *>(ps);
#if !ISCOMPLEX
Scalar r,z;
#if !ISCOMPLEX
Scalar r, z;
Scalar aa = abs(a);
Scalar ab = abs(b);
if((aa+ab)==Scalar(0))
{
if ((aa + ab) == Scalar(0)) {
*c = 1;
*s = 0;
r = 0;
z = 0;
}
else
{
r = sqrt(a*a + b*b);
Scalar amax = aa>ab ? a : b;
r = amax>0 ? r : -r;
*c = a/r;
*s = b/r;
} else {
r = sqrt(a * a + b * b);
Scalar amax = aa > ab ? a : b;
r = amax > 0 ? r : -r;
*c = a / r;
*s = b / r;
z = 1;
if (aa > ab) z = *s;
if (ab > aa && *c!=RealScalar(0))
z = Scalar(1)/ *c;
if (ab > aa && *c != RealScalar(0)) z = Scalar(1) / *c;
}
*pa = r;
*pb = z;
#else
#else
Scalar alpha;
RealScalar norm,scale;
if(abs(a)==RealScalar(0))
{
RealScalar norm, scale;
if (abs(a) == RealScalar(0)) {
*c = RealScalar(0);
*s = Scalar(1);
a = b;
}
else
{
} else {
scale = abs(a) + abs(b);
norm = scale*sqrt((numext::abs2(a/scale)) + (numext::abs2(b/scale)));
alpha = a/abs(a);
*c = abs(a)/norm;
*s = alpha*numext::conj(b)/norm;
a = alpha*norm;
norm = scale * sqrt((numext::abs2(a / scale)) + (numext::abs2(b / scale)));
alpha = a / abs(a);
*c = abs(a) / norm;
*s = alpha * numext::conj(b) / norm;
a = alpha * norm;
}
#endif
#endif
// JacobiRotation<Scalar> r;
// r.makeGivens(a,b);
// *c = r.c();
// *s = r.s();
// JacobiRotation<Scalar> r;
// r.makeGivens(a,b);
// *c = r.c();
// *s = r.s();
return 0;
}
int EIGEN_BLAS_FUNC(scal)(int *n, RealScalar *palpha, RealScalar *px, int *incx)
{
if(*n<=0) return 0;
int EIGEN_BLAS_FUNC(scal)(int *n, RealScalar *palpha, RealScalar *px, int *incx) {
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
if(*incx==1) make_vector(x,*n) *= alpha;
else make_vector(x,*n,std::abs(*incx)) *= alpha;
if (*incx == 1)
make_vector(x, *n) *= alpha;
else
make_vector(x, *n, std::abs(*incx)) *= alpha;
return 0;
}
int EIGEN_BLAS_FUNC(swap)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
{
if(*n<=0) return 0;
int EIGEN_BLAS_FUNC(swap)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy) {
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
if(*incx==1 && *incy==1) make_vector(y,*n).swap(make_vector(x,*n));
else if(*incx>0 && *incy>0) make_vector(y,*n,*incy).swap(make_vector(x,*n,*incx));
else if(*incx>0 && *incy<0) make_vector(y,*n,-*incy).reverse().swap(make_vector(x,*n,*incx));
else if(*incx<0 && *incy>0) make_vector(y,*n,*incy).swap(make_vector(x,*n,-*incx).reverse());
else if(*incx<0 && *incy<0) make_vector(y,*n,-*incy).reverse().swap(make_vector(x,*n,-*incx).reverse());
if (*incx == 1 && *incy == 1)
make_vector(y, *n).swap(make_vector(x, *n));
else if (*incx > 0 && *incy > 0)
make_vector(y, *n, *incy).swap(make_vector(x, *n, *incx));
else if (*incx > 0 && *incy < 0)
make_vector(y, *n, -*incy).reverse().swap(make_vector(x, *n, *incx));
else if (*incx < 0 && *incy > 0)
make_vector(y, *n, *incy).swap(make_vector(x, *n, -*incx).reverse());
else if (*incx < 0 && *incy < 0)
make_vector(y, *n, -*incy).reverse().swap(make_vector(x, *n, -*incx).reverse());
return 1;
}

View File

@@ -11,91 +11,101 @@
// computes the sum of magnitudes of all vector elements or, for a complex vector x, the sum
// res = |Rex1| + |Imx1| + |Rex2| + |Imx2| + ... + |Rexn| + |Imxn|, where x is a vector of order n
RealScalar EIGEN_BLAS_FUNC(asum)(int *n, RealScalar *px, int *incx)
{
// std::cerr << "_asum " << *n << " " << *incx << "\n";
RealScalar EIGEN_BLAS_FUNC(asum)(int *n, RealScalar *px, int *incx) {
// std::cerr << "_asum " << *n << " " << *incx << "\n";
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar *x = reinterpret_cast<Scalar *>(px);
if(*n<=0) return 0;
if (*n <= 0) return 0;
if(*incx==1) return make_vector(x,*n).cwiseAbs().sum();
else return make_vector(x,*n,std::abs(*incx)).cwiseAbs().sum();
if (*incx == 1)
return make_vector(x, *n).cwiseAbs().sum();
else
return make_vector(x, *n, std::abs(*incx)).cwiseAbs().sum();
}
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amax))(int *n, RealScalar *px, int *incx)
{
if(*n<=0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amax))(int *n, RealScalar *px, int *incx) {
if (*n <= 0) return 0;
Scalar *x = reinterpret_cast<Scalar *>(px);
DenseIndex ret;
if(*incx==1) make_vector(x,*n).cwiseAbs().maxCoeff(&ret);
else make_vector(x,*n,std::abs(*incx)).cwiseAbs().maxCoeff(&ret);
return int(ret)+1;
if (*incx == 1)
make_vector(x, *n).cwiseAbs().maxCoeff(&ret);
else
make_vector(x, *n, std::abs(*incx)).cwiseAbs().maxCoeff(&ret);
return int(ret) + 1;
}
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amin))(int *n, RealScalar *px, int *incx)
{
if(*n<=0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
int EIGEN_CAT(i, EIGEN_BLAS_FUNC(amin))(int *n, RealScalar *px, int *incx) {
if (*n <= 0) return 0;
Scalar *x = reinterpret_cast<Scalar *>(px);
DenseIndex ret;
if(*incx==1) make_vector(x,*n).cwiseAbs().minCoeff(&ret);
else make_vector(x,*n,std::abs(*incx)).cwiseAbs().minCoeff(&ret);
return int(ret)+1;
if (*incx == 1)
make_vector(x, *n).cwiseAbs().minCoeff(&ret);
else
make_vector(x, *n, std::abs(*incx)).cwiseAbs().minCoeff(&ret);
return int(ret) + 1;
}
// computes a vector-vector dot product.
Scalar EIGEN_BLAS_FUNC(dot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
{
// std::cerr << "_dot " << *n << " " << *incx << " " << *incy << "\n";
Scalar EIGEN_BLAS_FUNC(dot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy) {
// std::cerr << "_dot " << *n << " " << *incx << " " << *incy << "\n";
if(*n<=0) return 0;
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
if(*incx==1 && *incy==1) return (make_vector(x,*n).cwiseProduct(make_vector(y,*n))).sum();
else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,*incy))).sum();
else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,*incy))).sum();
else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
else return 0;
if (*incx == 1 && *incy == 1)
return (make_vector(x, *n).cwiseProduct(make_vector(y, *n))).sum();
else if (*incx > 0 && *incy > 0)
return (make_vector(x, *n, *incx).cwiseProduct(make_vector(y, *n, *incy))).sum();
else if (*incx < 0 && *incy > 0)
return (make_vector(x, *n, -*incx).reverse().cwiseProduct(make_vector(y, *n, *incy))).sum();
else if (*incx > 0 && *incy < 0)
return (make_vector(x, *n, *incx).cwiseProduct(make_vector(y, *n, -*incy).reverse())).sum();
else if (*incx < 0 && *incy < 0)
return (make_vector(x, *n, -*incx).reverse().cwiseProduct(make_vector(y, *n, -*incy).reverse())).sum();
else
return 0;
}
// computes the Euclidean norm of a vector.
// FIXME
Scalar EIGEN_BLAS_FUNC(nrm2)(int *n, RealScalar *px, int *incx)
{
// std::cerr << "_nrm2 " << *n << " " << *incx << "\n";
if(*n<=0) return 0;
Scalar EIGEN_BLAS_FUNC(nrm2)(int *n, RealScalar *px, int *incx) {
// std::cerr << "_nrm2 " << *n << " " << *incx << "\n";
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar *x = reinterpret_cast<Scalar *>(px);
if(*incx==1) return make_vector(x,*n).stableNorm();
else return make_vector(x,*n,std::abs(*incx)).stableNorm();
if (*incx == 1)
return make_vector(x, *n).stableNorm();
else
return make_vector(x, *n, std::abs(*incx)).stableNorm();
}
int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)
{
// std::cerr << "_rot " << *n << " " << *incx << " " << *incy << "\n";
if(*n<=0) return 0;
int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps) {
// std::cerr << "_rot " << *n << " " << *incx << " " << *incy << "\n";
if (*n <= 0) return 0;
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar c = *reinterpret_cast<Scalar*>(pc);
Scalar s = *reinterpret_cast<Scalar*>(ps);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar c = *reinterpret_cast<Scalar *>(pc);
Scalar s = *reinterpret_cast<Scalar *>(ps);
StridedVectorType vx(make_vector(x,*n,std::abs(*incx)));
StridedVectorType vy(make_vector(y,*n,std::abs(*incy)));
StridedVectorType vx(make_vector(x, *n, std::abs(*incx)));
StridedVectorType vy(make_vector(y, *n, std::abs(*incy)));
Reverse<StridedVectorType> rvx(vx);
Reverse<StridedVectorType> rvy(vy);
if(*incx<0 && *incy>0) internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c,s));
else if(*incx>0 && *incy<0) internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c,s));
else internal::apply_rotation_in_the_plane(vx, vy, JacobiRotation<Scalar>(c,s));
if (*incx < 0 && *incy > 0)
internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c, s));
else if (*incx > 0 && *incy < 0)
internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c, s));
else
internal::apply_rotation_in_the_plane(vx, vy, JacobiRotation<Scalar>(c, s));
return 0;
}

View File

@@ -10,73 +10,75 @@
#include "common.h"
/** ZHEMV performs the matrix-vector operation
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n hermitian matrix.
*/
int EIGEN_BLAS_FUNC(hemv)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *pa, const int *lda,
const RealScalar *px, const int *incx, const RealScalar *pbeta, RealScalar *py, const int *incy)
{
typedef void (*functype)(int, const Scalar*, int, const Scalar*, Scalar*, Scalar);
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n hermitian matrix.
*/
int EIGEN_BLAS_FUNC(hemv)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *pa,
const int *lda, const RealScalar *px, const int *incx, const RealScalar *pbeta,
RealScalar *py, const int *incy) {
typedef void (*functype)(int, const Scalar *, int, const Scalar *, Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Upper,false,false>::run),
// array index: LO
(internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Lower,false,false>::run),
// array index: UP
(internal::selfadjoint_matrix_vector_product<Scalar, int, ColMajor, Upper, false, false>::run),
// array index: LO
(internal::selfadjoint_matrix_vector_product<Scalar, int, ColMajor, Lower, false, false>::run),
};
const Scalar* a = reinterpret_cast<const Scalar*>(pa);
const Scalar* x = reinterpret_cast<const Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
Scalar beta = *reinterpret_cast<const Scalar*>(pbeta);
const Scalar *a = reinterpret_cast<const Scalar *>(pa);
const Scalar *x = reinterpret_cast<const Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
Scalar beta = *reinterpret_cast<const Scalar *>(pbeta);
// check arguments
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*lda<std::max(1,*n)) info = 5;
else if(*incx==0) info = 7;
else if(*incy==0) info = 10;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"HEMV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*lda < std::max(1, *n))
info = 5;
else if (*incx == 0)
info = 7;
else if (*incy == 0)
info = 10;
if (info) return xerbla_(SCALAR_SUFFIX_UP "HEMV ", &info, 6);
if(*n==0)
return 1;
if (*n == 0) return 1;
const Scalar* actual_x = get_compact_vector(x,*n,*incx);
Scalar* actual_y = get_compact_vector(y,*n,*incy);
const Scalar *actual_x = get_compact_vector(x, *n, *incx);
Scalar *actual_y = get_compact_vector(y, *n, *incy);
if(beta!=Scalar(1))
{
if(beta==Scalar(0)) make_vector(actual_y, *n).setZero();
else make_vector(actual_y, *n) *= beta;
if (beta != Scalar(1)) {
if (beta == Scalar(0))
make_vector(actual_y, *n).setZero();
else
make_vector(actual_y, *n) *= beta;
}
if(alpha!=Scalar(0))
{
if (alpha != Scalar(0)) {
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, a, *lda, actual_x, actual_y, alpha);
}
if(actual_x!=x) delete[] actual_x;
if(actual_y!=y) delete[] copy_back(actual_y,y,*n,*incy);
if (actual_x != x) delete[] actual_x;
if (actual_y != y) delete[] copy_back(actual_y, y, *n, *incy);
return 1;
}
/** ZHBMV performs the matrix-vector operation
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n hermitian band matrix, with k super-diagonals.
*/
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n hermitian band matrix, with k super-diagonals.
*/
// int EIGEN_BLAS_FUNC(hbmv)(char *uplo, int *n, int *k, RealScalar *alpha, RealScalar *a, int *lda,
// RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)
// {
@@ -84,277 +86,286 @@ int EIGEN_BLAS_FUNC(hemv)(const char *uplo, const int *n, const RealScalar *palp
// }
/** ZHPMV performs the matrix-vector operation
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n hermitian matrix, supplied in packed form.
*/
// int EIGEN_BLAS_FUNC(hpmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n hermitian matrix, supplied in packed form.
*/
// int EIGEN_BLAS_FUNC(hpmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar
// *beta, RealScalar *y, int *incy)
// {
// return 1;
// }
/** ZHPR performs the hermitian rank 1 operation
*
* A := alpha*x*conjg( x' ) + A,
*
* where alpha is a real scalar, x is an n element vector and A is an
* n by n hermitian matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(hpr)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pap)
{
typedef void (*functype)(int, Scalar*, const Scalar*, RealScalar);
*
* A := alpha*x*conjg( x' ) + A,
*
* where alpha is a real scalar, x is an n element vector and A is an
* n by n hermitian matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(hpr)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pap) {
typedef void (*functype)(int, Scalar *, const Scalar *, RealScalar);
static const functype func[2] = {
// array index: UP
(internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run),
// array index: LO
(internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run),
// array index: UP
(internal::selfadjoint_packed_rank1_update<Scalar, int, ColMajor, Upper, false, Conj>::run),
// array index: LO
(internal::selfadjoint_packed_rank1_update<Scalar, int, ColMajor, Lower, false, Conj>::run),
};
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* ap = reinterpret_cast<Scalar*>(pap);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *ap = reinterpret_cast<Scalar *>(pap);
RealScalar alpha = *palpha;
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"HPR ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
if (info) return xerbla_(SCALAR_SUFFIX_UP "HPR ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x, *n, *incx);
Scalar *x_cpy = get_compact_vector(x, *n, *incx);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, ap, x_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if (x_cpy != x) delete[] x_cpy;
return 1;
}
/** ZHPR2 performs the hermitian rank 2 operation
*
* A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,
*
* where alpha is a scalar, x and y are n element vectors and A is an
* n by n hermitian matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(hpr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pap)
{
typedef void (*functype)(int, Scalar*, const Scalar*, const Scalar*, Scalar);
*
* A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,
*
* where alpha is a scalar, x and y are n element vectors and A is an
* n by n hermitian matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(hpr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy,
RealScalar *pap) {
typedef void (*functype)(int, Scalar *, const Scalar *, const Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::packed_rank2_update_selector<Scalar,int,Upper>::run),
// array index: LO
(internal::packed_rank2_update_selector<Scalar,int,Lower>::run),
// array index: UP
(internal::packed_rank2_update_selector<Scalar, int, Upper>::run),
// array index: LO
(internal::packed_rank2_update_selector<Scalar, int, Lower>::run),
};
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar* ap = reinterpret_cast<Scalar*>(pap);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar *ap = reinterpret_cast<Scalar *>(pap);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"HPR2 ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
if (info) return xerbla_(SCALAR_SUFFIX_UP "HPR2 ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x, *n, *incx);
Scalar* y_cpy = get_compact_vector(y, *n, *incy);
Scalar *x_cpy = get_compact_vector(x, *n, *incx);
Scalar *y_cpy = get_compact_vector(y, *n, *incy);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, ap, x_cpy, y_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
return 1;
}
/** ZHER performs the hermitian rank 1 operation
*
* A := alpha*x*conjg( x' ) + A,
*
* where alpha is a real scalar, x is an n element vector and A is an
* n by n hermitian matrix.
*/
int EIGEN_BLAS_FUNC(her)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pa, int *lda)
{
typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, const Scalar&);
*
* A := alpha*x*conjg( x' ) + A,
*
* where alpha is a real scalar, x is an n element vector and A is an
* n by n hermitian matrix.
*/
int EIGEN_BLAS_FUNC(her)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pa, int *lda) {
typedef void (*functype)(int, Scalar *, int, const Scalar *, const Scalar *, const Scalar &);
static const functype func[2] = {
// array index: UP
(selfadjoint_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run),
// array index: LO
(selfadjoint_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run),
// array index: UP
(selfadjoint_rank1_update<Scalar, int, ColMajor, Upper, false, Conj>::run),
// array index: LO
(selfadjoint_rank1_update<Scalar, int, ColMajor, Lower, false, Conj>::run),
};
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* a = reinterpret_cast<Scalar*>(pa);
RealScalar alpha = *reinterpret_cast<RealScalar*>(palpha);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *a = reinterpret_cast<Scalar *>(pa);
RealScalar alpha = *reinterpret_cast<RealScalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*lda<std::max(1,*n)) info = 7;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"HER ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*lda < std::max(1, *n))
info = 7;
if (info) return xerbla_(SCALAR_SUFFIX_UP "HER ", &info, 6);
if(alpha==RealScalar(0))
return 1;
if (alpha == RealScalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x, *n, *incx);
Scalar *x_cpy = get_compact_vector(x, *n, *incx);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, a, *lda, x_cpy, x_cpy, alpha);
matrix(a,*n,*n,*lda).diagonal().imag().setZero();
matrix(a, *n, *n, *lda).diagonal().imag().setZero();
if(x_cpy!=x) delete[] x_cpy;
if (x_cpy != x) delete[] x_cpy;
return 1;
}
/** ZHER2 performs the hermitian rank 2 operation
*
* A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,
*
* where alpha is a scalar, x and y are n element vectors and A is an n
* by n hermitian matrix.
*/
int EIGEN_BLAS_FUNC(her2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)
{
typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, Scalar);
*
* A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,
*
* where alpha is a scalar, x and y are n element vectors and A is an n
* by n hermitian matrix.
*/
int EIGEN_BLAS_FUNC(her2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy,
RealScalar *pa, int *lda) {
typedef void (*functype)(int, Scalar *, int, const Scalar *, const Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::rank2_update_selector<Scalar,int,Upper>::run),
// array index: LO
(internal::rank2_update_selector<Scalar,int,Lower>::run),
// array index: UP
(internal::rank2_update_selector<Scalar, int, Upper>::run),
// array index: LO
(internal::rank2_update_selector<Scalar, int, Lower>::run),
};
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar* a = reinterpret_cast<Scalar*>(pa);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar *a = reinterpret_cast<Scalar *>(pa);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
else if(*lda<std::max(1,*n)) info = 9;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"HER2 ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
else if (*lda < std::max(1, *n))
info = 9;
if (info) return xerbla_(SCALAR_SUFFIX_UP "HER2 ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x, *n, *incx);
Scalar* y_cpy = get_compact_vector(y, *n, *incy);
Scalar *x_cpy = get_compact_vector(x, *n, *incx);
Scalar *y_cpy = get_compact_vector(y, *n, *incy);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, a, *lda, x_cpy, y_cpy, alpha);
matrix(a,*n,*n,*lda).diagonal().imag().setZero();
matrix(a, *n, *n, *lda).diagonal().imag().setZero();
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
return 1;
}
/** ZGERU performs the rank 1 operation
*
* A := alpha*x*y' + A,
*
* where alpha is a scalar, x is an m element vector, y is an n element
* vector and A is an m by n matrix.
*/
int EIGEN_BLAS_FUNC(geru)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)
{
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar* a = reinterpret_cast<Scalar*>(pa);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
*
* A := alpha*x*y' + A,
*
* where alpha is a scalar, x is an m element vector, y is an n element
* vector and A is an m by n matrix.
*/
int EIGEN_BLAS_FUNC(geru)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy,
RealScalar *pa, int *lda) {
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar *a = reinterpret_cast<Scalar *>(pa);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(*m<0) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
else if(*lda<std::max(1,*m)) info = 9;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"GERU ",&info,6);
if (*m < 0)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
else if (*lda < std::max(1, *m))
info = 9;
if (info) return xerbla_(SCALAR_SUFFIX_UP "GERU ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x,*m,*incx);
Scalar* y_cpy = get_compact_vector(y,*n,*incy);
Scalar *x_cpy = get_compact_vector(x, *m, *incx);
Scalar *y_cpy = get_compact_vector(y, *n, *incy);
internal::general_rank1_update<Scalar,int,ColMajor,false,false>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);
internal::general_rank1_update<Scalar, int, ColMajor, false, false>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
return 1;
}
/** ZGERC performs the rank 1 operation
*
* A := alpha*x*conjg( y' ) + A,
*
* where alpha is a scalar, x is an m element vector, y is an n element
* vector and A is an m by n matrix.
*/
int EIGEN_BLAS_FUNC(gerc)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)
{
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar* a = reinterpret_cast<Scalar*>(pa);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
*
* A := alpha*x*conjg( y' ) + A,
*
* where alpha is a scalar, x is an m element vector, y is an n element
* vector and A is an m by n matrix.
*/
int EIGEN_BLAS_FUNC(gerc)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy,
RealScalar *pa, int *lda) {
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar *a = reinterpret_cast<Scalar *>(pa);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(*m<0) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
else if(*lda<std::max(1,*m)) info = 9;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"GERC ",&info,6);
if (*m < 0)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
else if (*lda < std::max(1, *m))
info = 9;
if (info) return xerbla_(SCALAR_SUFFIX_UP "GERC ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x,*m,*incx);
Scalar* y_cpy = get_compact_vector(y,*n,*incy);
Scalar *x_cpy = get_compact_vector(x, *m, *incx);
Scalar *y_cpy = get_compact_vector(y, *n, *incy);
internal::general_rank1_update<Scalar,int,ColMajor,false,Conj>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);
internal::general_rank1_update<Scalar, int, ColMajor, false, Conj>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
return 1;
}

View File

@@ -9,270 +9,273 @@
#include "common.h"
template<typename Index, typename Scalar, int StorageOrder, bool ConjugateLhs, bool ConjugateRhs>
struct general_matrix_vector_product_wrapper
{
static void run(Index rows, Index cols,const Scalar *lhs, Index lhsStride, const Scalar *rhs, Index rhsIncr, Scalar* res, Index resIncr, Scalar alpha)
{
typedef internal::const_blas_data_mapper<Scalar,Index,StorageOrder> LhsMapper;
typedef internal::const_blas_data_mapper<Scalar,Index,RowMajor> RhsMapper;
internal::general_matrix_vector_product
<Index,Scalar,LhsMapper,StorageOrder,ConjugateLhs,Scalar,RhsMapper,ConjugateRhs>::run(
rows, cols, LhsMapper(lhs, lhsStride), RhsMapper(rhs, rhsIncr), res, resIncr, alpha);
template <typename Index, typename Scalar, int StorageOrder, bool ConjugateLhs, bool ConjugateRhs>
struct general_matrix_vector_product_wrapper {
static void run(Index rows, Index cols, const Scalar *lhs, Index lhsStride, const Scalar *rhs, Index rhsIncr,
Scalar *res, Index resIncr, Scalar alpha) {
typedef internal::const_blas_data_mapper<Scalar, Index, StorageOrder> LhsMapper;
typedef internal::const_blas_data_mapper<Scalar, Index, RowMajor> RhsMapper;
internal::general_matrix_vector_product<Index, Scalar, LhsMapper, StorageOrder, ConjugateLhs, Scalar, RhsMapper,
ConjugateRhs>::run(rows, cols, LhsMapper(lhs, lhsStride),
RhsMapper(rhs, rhsIncr), res, resIncr, alpha);
}
};
int EIGEN_BLAS_FUNC(gemv)(const char *opa, const int *m, const int *n, const RealScalar *palpha,
const RealScalar *pa, const int *lda, const RealScalar *pb, const int *incb, const RealScalar *pbeta, RealScalar *pc, const int *incc)
{
typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int , Scalar *, int, Scalar);
static const functype func[4] = {
// array index: NOTR
(general_matrix_vector_product_wrapper<int,Scalar,ColMajor,false,false>::run),
// array index: TR
(general_matrix_vector_product_wrapper<int,Scalar,RowMajor,false,false>::run),
// array index: ADJ
(general_matrix_vector_product_wrapper<int,Scalar,RowMajor,Conj ,false>::run),
0
};
int EIGEN_BLAS_FUNC(gemv)(const char *opa, const int *m, const int *n, const RealScalar *palpha, const RealScalar *pa,
const int *lda, const RealScalar *pb, const int *incb, const RealScalar *pbeta,
RealScalar *pc, const int *incc) {
typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int, Scalar *, int, Scalar);
static const functype func[4] = {// array index: NOTR
(general_matrix_vector_product_wrapper<int, Scalar, ColMajor, false, false>::run),
// array index: TR
(general_matrix_vector_product_wrapper<int, Scalar, RowMajor, false, false>::run),
// array index: ADJ
(general_matrix_vector_product_wrapper<int, Scalar, RowMajor, Conj, false>::run), 0};
const Scalar* a = reinterpret_cast<const Scalar*>(pa);
const Scalar* b = reinterpret_cast<const Scalar*>(pb);
Scalar* c = reinterpret_cast<Scalar*>(pc);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
Scalar beta = *reinterpret_cast<const Scalar*>(pbeta);
const Scalar *a = reinterpret_cast<const Scalar *>(pa);
const Scalar *b = reinterpret_cast<const Scalar *>(pb);
Scalar *c = reinterpret_cast<Scalar *>(pc);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
Scalar beta = *reinterpret_cast<const Scalar *>(pbeta);
// check arguments
int info = 0;
if(OP(*opa)==INVALID) info = 1;
else if(*m<0) info = 2;
else if(*n<0) info = 3;
else if(*lda<std::max(1,*m)) info = 6;
else if(*incb==0) info = 8;
else if(*incc==0) info = 11;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"GEMV ",&info,6);
if (OP(*opa) == INVALID)
info = 1;
else if (*m < 0)
info = 2;
else if (*n < 0)
info = 3;
else if (*lda < std::max(1, *m))
info = 6;
else if (*incb == 0)
info = 8;
else if (*incc == 0)
info = 11;
if (info) return xerbla_(SCALAR_SUFFIX_UP "GEMV ", &info, 6);
if(*m==0 || *n==0 || (alpha==Scalar(0) && beta==Scalar(1)))
return 0;
if (*m == 0 || *n == 0 || (alpha == Scalar(0) && beta == Scalar(1))) return 0;
int actual_m = *m;
int actual_n = *n;
int code = OP(*opa);
if(code!=NOTR)
std::swap(actual_m,actual_n);
if (code != NOTR) std::swap(actual_m, actual_n);
const Scalar* actual_b = get_compact_vector(b,actual_n,*incb);
Scalar* actual_c = get_compact_vector(c,actual_m,*incc);
const Scalar *actual_b = get_compact_vector(b, actual_n, *incb);
Scalar *actual_c = get_compact_vector(c, actual_m, *incc);
if(beta!=Scalar(1))
{
if(beta==Scalar(0)) make_vector(actual_c, actual_m).setZero();
else make_vector(actual_c, actual_m) *= beta;
if (beta != Scalar(1)) {
if (beta == Scalar(0))
make_vector(actual_c, actual_m).setZero();
else
make_vector(actual_c, actual_m) *= beta;
}
if(code>=4 || func[code]==0)
return 0;
if (code >= 4 || func[code] == 0) return 0;
func[code](actual_m, actual_n, a, *lda, actual_b, 1, actual_c, 1, alpha);
if(actual_b!=b) delete[] actual_b;
if(actual_c!=c) delete[] copy_back(actual_c,c,actual_m,*incc);
if (actual_b != b) delete[] actual_b;
if (actual_c != c) delete[] copy_back(actual_c, c, actual_m, *incc);
return 1;
}
int EIGEN_BLAS_FUNC(trsv)(const char *uplo, const char *opa, const char *diag, const int *n, const RealScalar *pa, const int *lda, RealScalar *pb, const int *incb)
{
int EIGEN_BLAS_FUNC(trsv)(const char *uplo, const char *opa, const char *diag, const int *n, const RealScalar *pa,
const int *lda, RealScalar *pb, const int *incb) {
typedef void (*functype)(int, const Scalar *, int, Scalar *);
static const functype func[16] = {
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0, false,ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0, false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0, Conj, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0, false,ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0, false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0, Conj, RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,Conj, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,Conj, RowMajor>::run),
0
};
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | 0, false, ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | 0, false, RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | 0, Conj, RowMajor>::run), 0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | 0, false, ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | 0, false, RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | 0, Conj, RowMajor>::run), 0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | UnitDiag, false, ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | UnitDiag, false, RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | UnitDiag, Conj, RowMajor>::run), 0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | UnitDiag, false, ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | UnitDiag, false, RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | UnitDiag, Conj, RowMajor>::run), 0};
const Scalar* a = reinterpret_cast<const Scalar*>(pa);
Scalar* b = reinterpret_cast<Scalar*>(pb);
const Scalar *a = reinterpret_cast<const Scalar *>(pa);
Scalar *b = reinterpret_cast<Scalar *>(pb);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(OP(*opa)==INVALID) info = 2;
else if(DIAG(*diag)==INVALID) info = 3;
else if(*n<0) info = 4;
else if(*lda<std::max(1,*n)) info = 6;
else if(*incb==0) info = 8;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"TRSV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (OP(*opa) == INVALID)
info = 2;
else if (DIAG(*diag) == INVALID)
info = 3;
else if (*n < 0)
info = 4;
else if (*lda < std::max(1, *n))
info = 6;
else if (*incb == 0)
info = 8;
if (info) return xerbla_(SCALAR_SUFFIX_UP "TRSV ", &info, 6);
Scalar* actual_b = get_compact_vector(b,*n,*incb);
Scalar *actual_b = get_compact_vector(b, *n, *incb);
int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);
func[code](*n, a, *lda, actual_b);
if(actual_b!=b) delete[] copy_back(actual_b,b,*n,*incb);
if (actual_b != b) delete[] copy_back(actual_b, b, *n, *incb);
return 0;
}
int EIGEN_BLAS_FUNC(trmv)(const char *uplo, const char *opa, const char *diag, const int *n, const RealScalar *pa, const int *lda, RealScalar *pb, const int *incb)
{
typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int, Scalar *, int, const Scalar&);
int EIGEN_BLAS_FUNC(trmv)(const char *uplo, const char *opa, const char *diag, const int *n, const RealScalar *pa,
const int *lda, RealScalar *pb, const int *incb) {
typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int, Scalar *, int, const Scalar &);
static const functype func[16] = {
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int,Upper|0, Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int,Lower|0, Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int,Lower|0, Scalar,Conj, Scalar,false,RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int,Lower|0, Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int,Upper|0, Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int,Upper|0, Scalar,Conj, Scalar,false,RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),
0
};
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int, Upper | 0, Scalar, false, Scalar, false, ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int, Lower | 0, Scalar, false, Scalar, false, RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int, Lower | 0, Scalar, Conj, Scalar, false, RowMajor>::run), 0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int, Lower | 0, Scalar, false, Scalar, false, ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int, Upper | 0, Scalar, false, Scalar, false, RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::triangular_matrix_vector_product<int, Upper | 0, Scalar, Conj, Scalar, false, RowMajor>::run), 0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int, Upper | UnitDiag, Scalar, false, Scalar, false, ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int, Lower | UnitDiag, Scalar, false, Scalar, false, RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int, Lower | UnitDiag, Scalar, Conj, Scalar, false, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int, Lower | UnitDiag, Scalar, false, Scalar, false, ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int, Upper | UnitDiag, Scalar, false, Scalar, false, RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::triangular_matrix_vector_product<int, Upper | UnitDiag, Scalar, Conj, Scalar, false, RowMajor>::run),
0};
const Scalar* a = reinterpret_cast<const Scalar*>(pa);
Scalar* b = reinterpret_cast<Scalar*>(pb);
const Scalar *a = reinterpret_cast<const Scalar *>(pa);
Scalar *b = reinterpret_cast<Scalar *>(pb);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(OP(*opa)==INVALID) info = 2;
else if(DIAG(*diag)==INVALID) info = 3;
else if(*n<0) info = 4;
else if(*lda<std::max(1,*n)) info = 6;
else if(*incb==0) info = 8;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"TRMV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (OP(*opa) == INVALID)
info = 2;
else if (DIAG(*diag) == INVALID)
info = 3;
else if (*n < 0)
info = 4;
else if (*lda < std::max(1, *n))
info = 6;
else if (*incb == 0)
info = 8;
if (info) return xerbla_(SCALAR_SUFFIX_UP "TRMV ", &info, 6);
if(*n==0)
return 1;
if (*n == 0) return 1;
Scalar* actual_b = get_compact_vector(b,*n,*incb);
Matrix<Scalar,Dynamic,1> res(*n);
Scalar *actual_b = get_compact_vector(b, *n, *incb);
Matrix<Scalar, Dynamic, 1> res(*n);
res.setZero();
int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);
if(code>=16 || func[code]==0)
return 0;
if (code >= 16 || func[code] == 0) return 0;
func[code](*n, *n, a, *lda, actual_b, 1, res.data(), 1, Scalar(1));
copy_back(res.data(),b,*n,*incb);
if(actual_b!=b) delete[] actual_b;
copy_back(res.data(), b, *n, *incb);
if (actual_b != b) delete[] actual_b;
return 1;
}
/** GBMV performs one of the matrix-vector operations
*
* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y,
*
* where alpha and beta are scalars, x and y are vectors and A is an
* m by n band matrix, with kl sub-diagonals and ku super-diagonals.
*/
*
* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y,
*
* where alpha and beta are scalars, x and y are vectors and A is an
* m by n band matrix, with kl sub-diagonals and ku super-diagonals.
*/
int EIGEN_BLAS_FUNC(gbmv)(char *trans, int *m, int *n, int *kl, int *ku, RealScalar *palpha, RealScalar *pa, int *lda,
RealScalar *px, int *incx, RealScalar *pbeta, RealScalar *py, int *incy)
{
const Scalar* a = reinterpret_cast<const Scalar*>(pa);
const Scalar* x = reinterpret_cast<const Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
Scalar beta = *reinterpret_cast<const Scalar*>(pbeta);
int coeff_rows = *kl+*ku+1;
RealScalar *px, int *incx, RealScalar *pbeta, RealScalar *py, int *incy) {
const Scalar *a = reinterpret_cast<const Scalar *>(pa);
const Scalar *x = reinterpret_cast<const Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
Scalar beta = *reinterpret_cast<const Scalar *>(pbeta);
int coeff_rows = *kl + *ku + 1;
int info = 0;
if(OP(*trans)==INVALID) info = 1;
else if(*m<0) info = 2;
else if(*n<0) info = 3;
else if(*kl<0) info = 4;
else if(*ku<0) info = 5;
else if(*lda<coeff_rows) info = 8;
else if(*incx==0) info = 10;
else if(*incy==0) info = 13;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"GBMV ",&info,6);
if (OP(*trans) == INVALID)
info = 1;
else if (*m < 0)
info = 2;
else if (*n < 0)
info = 3;
else if (*kl < 0)
info = 4;
else if (*ku < 0)
info = 5;
else if (*lda < coeff_rows)
info = 8;
else if (*incx == 0)
info = 10;
else if (*incy == 0)
info = 13;
if (info) return xerbla_(SCALAR_SUFFIX_UP "GBMV ", &info, 6);
if(*m==0 || *n==0 || (alpha==Scalar(0) && beta==Scalar(1)))
return 0;
if (*m == 0 || *n == 0 || (alpha == Scalar(0) && beta == Scalar(1))) return 0;
int actual_m = *m;
int actual_n = *n;
if(OP(*trans)!=NOTR)
std::swap(actual_m,actual_n);
if (OP(*trans) != NOTR) std::swap(actual_m, actual_n);
const Scalar* actual_x = get_compact_vector(x,actual_n,*incx);
Scalar* actual_y = get_compact_vector(y,actual_m,*incy);
const Scalar *actual_x = get_compact_vector(x, actual_n, *incx);
Scalar *actual_y = get_compact_vector(y, actual_m, *incy);
if(beta!=Scalar(1))
{
if(beta==Scalar(0)) make_vector(actual_y, actual_m).setZero();
else make_vector(actual_y, actual_m) *= beta;
if (beta != Scalar(1)) {
if (beta == Scalar(0))
make_vector(actual_y, actual_m).setZero();
else
make_vector(actual_y, actual_m) *= beta;
}
ConstMatrixType mat_coeffs(a,coeff_rows,*n,*lda);
ConstMatrixType mat_coeffs(a, coeff_rows, *n, *lda);
int nb = std::min(*n,(*m)+(*ku));
for(int j=0; j<nb; ++j)
{
int start = std::max(0,j - *ku);
int end = std::min((*m)-1,j + *kl);
int nb = std::min(*n, (*m) + (*ku));
for (int j = 0; j < nb; ++j) {
int start = std::max(0, j - *ku);
int end = std::min((*m) - 1, j + *kl);
int len = end - start + 1;
int offset = (*ku) - j + start;
if(OP(*trans)==NOTR)
make_vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);
else if(OP(*trans)==TR)
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * make_vector(actual_x+start,len) ).value();
if (OP(*trans) == NOTR)
make_vector(actual_y + start, len) += (alpha * actual_x[j]) * mat_coeffs.col(j).segment(offset, len);
else if (OP(*trans) == TR)
actual_y[j] +=
alpha * (mat_coeffs.col(j).segment(offset, len).transpose() * make_vector(actual_x + start, len)).value();
else
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint() * make_vector(actual_x+start,len) ).value();
actual_y[j] +=
alpha * (mat_coeffs.col(j).segment(offset, len).adjoint() * make_vector(actual_x + start, len)).value();
}
if(actual_x!=x) delete[] actual_x;
if(actual_y!=y) delete[] copy_back(actual_y,y,actual_m,*incy);
if (actual_x != x) delete[] actual_x;
if (actual_y != y) delete[] copy_back(actual_y, y, actual_m, *incy);
return 0;
}
@@ -337,217 +340,231 @@ int EIGEN_BLAS_FUNC(tbmv)(char *uplo, char *opa, char *diag, int *n, int *k, Rea
#endif
/** DTBSV solves one of the systems of equations
*
* A*x = b, or A'*x = b,
*
* where b and x are n element vectors and A is an n by n unit, or
* non-unit, upper or lower triangular band matrix, with ( k + 1 )
* diagonals.
*
* No test for singularity or near-singularity is included in this
* routine. Such tests must be performed before calling this routine.
*/
int EIGEN_BLAS_FUNC(tbsv)(char *uplo, char *op, char *diag, int *n, int *k, RealScalar *pa, int *lda, RealScalar *px, int *incx)
{
*
* A*x = b, or A'*x = b,
*
* where b and x are n element vectors and A is an n by n unit, or
* non-unit, upper or lower triangular band matrix, with ( k + 1 )
* diagonals.
*
* No test for singularity or near-singularity is included in this
* routine. Such tests must be performed before calling this routine.
*/
int EIGEN_BLAS_FUNC(tbsv)(char *uplo, char *op, char *diag, int *n, int *k, RealScalar *pa, int *lda, RealScalar *px,
int *incx) {
typedef void (*functype)(int, int, const Scalar *, int, Scalar *);
static const functype func[16] = {
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int,Upper|0, Scalar,false,Scalar,ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int,Lower|0, Scalar,false,Scalar,RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int,Lower|0, Scalar,Conj, Scalar,RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int,Lower|0, Scalar,false,Scalar,ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int,Upper|0, Scalar,false,Scalar,RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int,Upper|0, Scalar,Conj, Scalar,RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int,Upper|UnitDiag,Scalar,false,Scalar,ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int,Lower|UnitDiag,Scalar,false,Scalar,RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int,Lower|UnitDiag,Scalar,Conj, Scalar,RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int,Lower|UnitDiag,Scalar,false,Scalar,ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int,Upper|UnitDiag,Scalar,false,Scalar,RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int,Upper|UnitDiag,Scalar,Conj, Scalar,RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int, Upper | 0, Scalar, false, Scalar, ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int, Lower | 0, Scalar, false, Scalar, RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int, Lower | 0, Scalar, Conj, Scalar, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int, Lower | 0, Scalar, false, Scalar, ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int, Upper | 0, Scalar, false, Scalar, RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::band_solve_triangular_selector<int, Upper | 0, Scalar, Conj, Scalar, RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int, Upper | UnitDiag, Scalar, false, Scalar, ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int, Lower | UnitDiag, Scalar, false, Scalar, RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int, Lower | UnitDiag, Scalar, Conj, Scalar, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int, Lower | UnitDiag, Scalar, false, Scalar, ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int, Upper | UnitDiag, Scalar, false, Scalar, RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::band_solve_triangular_selector<int, Upper | UnitDiag, Scalar, Conj, Scalar, RowMajor>::run),
0,
};
Scalar* a = reinterpret_cast<Scalar*>(pa);
Scalar* x = reinterpret_cast<Scalar*>(px);
int coeff_rows = *k+1;
Scalar *a = reinterpret_cast<Scalar *>(pa);
Scalar *x = reinterpret_cast<Scalar *>(px);
int coeff_rows = *k + 1;
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(OP(*op)==INVALID) info = 2;
else if(DIAG(*diag)==INVALID) info = 3;
else if(*n<0) info = 4;
else if(*k<0) info = 5;
else if(*lda<coeff_rows) info = 7;
else if(*incx==0) info = 9;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"TBSV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (OP(*op) == INVALID)
info = 2;
else if (DIAG(*diag) == INVALID)
info = 3;
else if (*n < 0)
info = 4;
else if (*k < 0)
info = 5;
else if (*lda < coeff_rows)
info = 7;
else if (*incx == 0)
info = 9;
if (info) return xerbla_(SCALAR_SUFFIX_UP "TBSV ", &info, 6);
if(*n==0 || (*k==0 && DIAG(*diag)==UNIT))
return 0;
if (*n == 0 || (*k == 0 && DIAG(*diag) == UNIT)) return 0;
int actual_n = *n;
Scalar* actual_x = get_compact_vector(x,actual_n,*incx);
Scalar *actual_x = get_compact_vector(x, actual_n, *incx);
int code = OP(*op) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);
if(code>=16 || func[code]==0)
return 0;
if (code >= 16 || func[code] == 0) return 0;
func[code](*n, *k, a, *lda, actual_x);
if(actual_x!=x) delete[] copy_back(actual_x,x,actual_n,*incx);
if (actual_x != x) delete[] copy_back(actual_x, x, actual_n, *incx);
return 0;
}
/** DTPMV performs one of the matrix-vector operations
*
* x := A*x, or x := A'*x,
*
* where x is an n element vector and A is an n by n unit, or non-unit,
* upper or lower triangular matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(tpmv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pap, RealScalar *px, int *incx)
{
typedef void (*functype)(int, const Scalar*, const Scalar*, Scalar*, Scalar);
*
* x := A*x, or x := A'*x,
*
* where x is an n element vector and A is an n by n unit, or non-unit,
* upper or lower triangular matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(tpmv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pap, RealScalar *px, int *incx) {
typedef void (*functype)(int, const Scalar *, const Scalar *, Scalar *, Scalar);
static const functype func[16] = {
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Upper|0, Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Lower|0, Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Lower|0, Scalar,Conj, Scalar,false,RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Lower|0, Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Upper|0, Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Upper|0, Scalar,Conj, Scalar,false,RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),
0
};
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Upper | 0, Scalar, false, Scalar, false, ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Lower | 0, Scalar, false, Scalar, false, RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Lower | 0, Scalar, Conj, Scalar, false, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Lower | 0, Scalar, false, Scalar, false, ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Upper | 0, Scalar, false, Scalar, false, RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Upper | 0, Scalar, Conj, Scalar, false, RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Upper | UnitDiag, Scalar, false, Scalar, false,
ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Lower | UnitDiag, Scalar, false, Scalar, false,
RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Lower | UnitDiag, Scalar, Conj, Scalar, false,
RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Lower | UnitDiag, Scalar, false, Scalar, false,
ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Upper | UnitDiag, Scalar, false, Scalar, false,
RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_matrix_vector_product<int, Upper | UnitDiag, Scalar, Conj, Scalar, false,
RowMajor>::run),
0};
Scalar* ap = reinterpret_cast<Scalar*>(pap);
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar *ap = reinterpret_cast<Scalar *>(pap);
Scalar *x = reinterpret_cast<Scalar *>(px);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(OP(*opa)==INVALID) info = 2;
else if(DIAG(*diag)==INVALID) info = 3;
else if(*n<0) info = 4;
else if(*incx==0) info = 7;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"TPMV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (OP(*opa) == INVALID)
info = 2;
else if (DIAG(*diag) == INVALID)
info = 3;
else if (*n < 0)
info = 4;
else if (*incx == 0)
info = 7;
if (info) return xerbla_(SCALAR_SUFFIX_UP "TPMV ", &info, 6);
if(*n==0)
return 1;
if (*n == 0) return 1;
Scalar* actual_x = get_compact_vector(x,*n,*incx);
Matrix<Scalar,Dynamic,1> res(*n);
Scalar *actual_x = get_compact_vector(x, *n, *incx);
Matrix<Scalar, Dynamic, 1> res(*n);
res.setZero();
int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);
if(code>=16 || func[code]==0)
return 0;
if (code >= 16 || func[code] == 0) return 0;
func[code](*n, ap, actual_x, res.data(), Scalar(1));
copy_back(res.data(),x,*n,*incx);
if(actual_x!=x) delete[] actual_x;
copy_back(res.data(), x, *n, *incx);
if (actual_x != x) delete[] actual_x;
return 1;
}
/** DTPSV solves one of the systems of equations
*
* A*x = b, or A'*x = b,
*
* where b and x are n element vectors and A is an n by n unit, or
* non-unit, upper or lower triangular matrix, supplied in packed form.
*
* No test for singularity or near-singularity is included in this
* routine. Such tests must be performed before calling this routine.
*/
int EIGEN_BLAS_FUNC(tpsv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pap, RealScalar *px, int *incx)
{
typedef void (*functype)(int, const Scalar*, Scalar*);
*
* A*x = b, or A'*x = b,
*
* where b and x are n element vectors and A is an n by n unit, or
* non-unit, upper or lower triangular matrix, supplied in packed form.
*
* No test for singularity or near-singularity is included in this
* routine. Such tests must be performed before calling this routine.
*/
int EIGEN_BLAS_FUNC(tpsv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pap, RealScalar *px, int *incx) {
typedef void (*functype)(int, const Scalar *, Scalar *);
static const functype func[16] = {
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0, false,ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0, false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0, Conj, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0, false,ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0, false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0, Conj, RowMajor>::run),
0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,Conj, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,Conj, RowMajor>::run),
0
};
// array index: NOTR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | 0, false, ColMajor>::run),
// array index: TR | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | 0, false, RowMajor>::run),
// array index: ADJ | (UP << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | 0, Conj, RowMajor>::run), 0,
// array index: NOTR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | 0, false, ColMajor>::run),
// array index: TR | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | 0, false, RowMajor>::run),
// array index: ADJ | (LO << 2) | (NUNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | 0, Conj, RowMajor>::run), 0,
// array index: NOTR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | UnitDiag, false,
ColMajor>::run),
// array index: TR | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | UnitDiag, false,
RowMajor>::run),
// array index: ADJ | (UP << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | UnitDiag, Conj, RowMajor>::run),
0,
// array index: NOTR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Lower | UnitDiag, false,
ColMajor>::run),
// array index: TR | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | UnitDiag, false,
RowMajor>::run),
// array index: ADJ | (LO << 2) | (UNIT << 3)
(internal::packed_triangular_solve_vector<Scalar, Scalar, int, OnTheLeft, Upper | UnitDiag, Conj, RowMajor>::run),
0};
Scalar* ap = reinterpret_cast<Scalar*>(pap);
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar *ap = reinterpret_cast<Scalar *>(pap);
Scalar *x = reinterpret_cast<Scalar *>(px);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(OP(*opa)==INVALID) info = 2;
else if(DIAG(*diag)==INVALID) info = 3;
else if(*n<0) info = 4;
else if(*incx==0) info = 7;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"TPSV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (OP(*opa) == INVALID)
info = 2;
else if (DIAG(*diag) == INVALID)
info = 3;
else if (*n < 0)
info = 4;
else if (*incx == 0)
info = 7;
if (info) return xerbla_(SCALAR_SUFFIX_UP "TPSV ", &info, 6);
Scalar* actual_x = get_compact_vector(x,*n,*incx);
Scalar *actual_x = get_compact_vector(x, *n, *incx);
int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);
func[code](*n, ap, actual_x);
if(actual_x!=x) delete[] copy_back(actual_x,x,*n,*incx);
if (actual_x != x) delete[] copy_back(actual_x, x, *n, *incx);
return 1;
}

View File

@@ -10,297 +10,306 @@
#include "common.h"
// y = alpha*A*x + beta*y
int EIGEN_BLAS_FUNC(symv) (const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *pa, const int *lda,
const RealScalar *px, const int *incx, const RealScalar *pbeta, RealScalar *py, const int *incy)
{
typedef void (*functype)(int, const Scalar*, int, const Scalar*, Scalar*, Scalar);
int EIGEN_BLAS_FUNC(symv)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *pa,
const int *lda, const RealScalar *px, const int *incx, const RealScalar *pbeta,
RealScalar *py, const int *incy) {
typedef void (*functype)(int, const Scalar *, int, const Scalar *, Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Upper,false,false>::run),
// array index: LO
(internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Lower,false,false>::run),
// array index: UP
(internal::selfadjoint_matrix_vector_product<Scalar, int, ColMajor, Upper, false, false>::run),
// array index: LO
(internal::selfadjoint_matrix_vector_product<Scalar, int, ColMajor, Lower, false, false>::run),
};
const Scalar* a = reinterpret_cast<const Scalar*>(pa);
const Scalar* x = reinterpret_cast<const Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
Scalar beta = *reinterpret_cast<const Scalar*>(pbeta);
const Scalar *a = reinterpret_cast<const Scalar *>(pa);
const Scalar *x = reinterpret_cast<const Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
Scalar beta = *reinterpret_cast<const Scalar *>(pbeta);
// check arguments
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*lda<std::max(1,*n)) info = 5;
else if(*incx==0) info = 7;
else if(*incy==0) info = 10;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"SYMV ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*lda < std::max(1, *n))
info = 5;
else if (*incx == 0)
info = 7;
else if (*incy == 0)
info = 10;
if (info) return xerbla_(SCALAR_SUFFIX_UP "SYMV ", &info, 6);
if(*n==0)
return 0;
if (*n == 0) return 0;
const Scalar* actual_x = get_compact_vector(x,*n,*incx);
Scalar* actual_y = get_compact_vector(y,*n,*incy);
const Scalar *actual_x = get_compact_vector(x, *n, *incx);
Scalar *actual_y = get_compact_vector(y, *n, *incy);
if(beta!=Scalar(1))
{
if(beta==Scalar(0)) make_vector(actual_y, *n).setZero();
else make_vector(actual_y, *n) *= beta;
if (beta != Scalar(1)) {
if (beta == Scalar(0))
make_vector(actual_y, *n).setZero();
else
make_vector(actual_y, *n) *= beta;
}
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, a, *lda, actual_x, actual_y, alpha);
if(actual_x!=x) delete[] actual_x;
if(actual_y!=y) delete[] copy_back(actual_y,y,*n,*incy);
if (actual_x != x) delete[] actual_x;
if (actual_y != y) delete[] copy_back(actual_y, y, *n, *incy);
return 1;
}
// C := alpha*x*x' + C
int EIGEN_BLAS_FUNC(syr)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, RealScalar *pc, const int *ldc)
{
typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, const Scalar&);
int EIGEN_BLAS_FUNC(syr)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *px,
const int *incx, RealScalar *pc, const int *ldc) {
typedef void (*functype)(int, Scalar *, int, const Scalar *, const Scalar *, const Scalar &);
static const functype func[2] = {
// array index: UP
(selfadjoint_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run),
// array index: LO
(selfadjoint_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run),
// array index: UP
(selfadjoint_rank1_update<Scalar, int, ColMajor, Upper, false, Conj>::run),
// array index: LO
(selfadjoint_rank1_update<Scalar, int, ColMajor, Lower, false, Conj>::run),
};
const Scalar* x = reinterpret_cast<const Scalar*>(px);
Scalar* c = reinterpret_cast<Scalar*>(pc);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
const Scalar *x = reinterpret_cast<const Scalar *>(px);
Scalar *c = reinterpret_cast<Scalar *>(pc);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*ldc<std::max(1,*n)) info = 7;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"SYR ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*ldc < std::max(1, *n))
info = 7;
if (info) return xerbla_(SCALAR_SUFFIX_UP "SYR ", &info, 6);
if(*n==0 || alpha==Scalar(0)) return 1;
if (*n == 0 || alpha == Scalar(0)) return 1;
// if the increment is not 1, let's copy it to a temporary vector to enable vectorization
const Scalar* x_cpy = get_compact_vector(x,*n,*incx);
const Scalar *x_cpy = get_compact_vector(x, *n, *incx);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, c, *ldc, x_cpy, x_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if (x_cpy != x) delete[] x_cpy;
return 1;
}
// C := alpha*x*y' + alpha*y*x' + C
int EIGEN_BLAS_FUNC(syr2)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, const RealScalar *py, const int *incy, RealScalar *pc, const int *ldc)
{
typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, Scalar);
int EIGEN_BLAS_FUNC(syr2)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *px,
const int *incx, const RealScalar *py, const int *incy, RealScalar *pc, const int *ldc) {
typedef void (*functype)(int, Scalar *, int, const Scalar *, const Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::rank2_update_selector<Scalar,int,Upper>::run),
// array index: LO
(internal::rank2_update_selector<Scalar,int,Lower>::run),
// array index: UP
(internal::rank2_update_selector<Scalar, int, Upper>::run),
// array index: LO
(internal::rank2_update_selector<Scalar, int, Lower>::run),
};
const Scalar* x = reinterpret_cast<const Scalar*>(px);
const Scalar* y = reinterpret_cast<const Scalar*>(py);
Scalar* c = reinterpret_cast<Scalar*>(pc);
Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);
const Scalar *x = reinterpret_cast<const Scalar *>(px);
const Scalar *y = reinterpret_cast<const Scalar *>(py);
Scalar *c = reinterpret_cast<Scalar *>(pc);
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
else if(*ldc<std::max(1,*n)) info = 9;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"SYR2 ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
else if (*ldc < std::max(1, *n))
info = 9;
if (info) return xerbla_(SCALAR_SUFFIX_UP "SYR2 ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
const Scalar* x_cpy = get_compact_vector(x,*n,*incx);
const Scalar* y_cpy = get_compact_vector(y,*n,*incy);
const Scalar *x_cpy = get_compact_vector(x, *n, *incx);
const Scalar *y_cpy = get_compact_vector(y, *n, *incy);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, c, *ldc, x_cpy, y_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
// int code = UPLO(*uplo);
// if(code>=2 || func[code]==0)
// return 0;
// int code = UPLO(*uplo);
// if(code>=2 || func[code]==0)
// return 0;
// func[code](*n, a, *inca, b, *incb, c, *ldc, alpha);
// func[code](*n, a, *inca, b, *incb, c, *ldc, alpha);
return 1;
}
/** DSBMV performs the matrix-vector operation
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n symmetric band matrix, with k super-diagonals.
*/
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n symmetric band matrix, with k super-diagonals.
*/
// int EIGEN_BLAS_FUNC(sbmv)( char *uplo, int *n, int *k, RealScalar *alpha, RealScalar *a, int *lda,
// RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)
// {
// return 1;
// }
/** DSPMV performs the matrix-vector operation
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n symmetric matrix, supplied in packed form.
*
*/
// int EIGEN_BLAS_FUNC(spmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)
*
* y := alpha*A*x + beta*y,
*
* where alpha and beta are scalars, x and y are n element vectors and
* A is an n by n symmetric matrix, supplied in packed form.
*
*/
// int EIGEN_BLAS_FUNC(spmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar
// *beta, RealScalar *y, int *incy)
// {
// return 1;
// }
/** DSPR performs the symmetric rank 1 operation
*
* A := alpha*x*x' + A,
*
* where alpha is a real scalar, x is an n element vector and A is an
* n by n symmetric matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(spr)(char *uplo, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *pap)
{
typedef void (*functype)(int, Scalar*, const Scalar*, Scalar);
*
* A := alpha*x*x' + A,
*
* where alpha is a real scalar, x is an n element vector and A is an
* n by n symmetric matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(spr)(char *uplo, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *pap) {
typedef void (*functype)(int, Scalar *, const Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Upper,false,false>::run),
// array index: LO
(internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Lower,false,false>::run),
// array index: UP
(internal::selfadjoint_packed_rank1_update<Scalar, int, ColMajor, Upper, false, false>::run),
// array index: LO
(internal::selfadjoint_packed_rank1_update<Scalar, int, ColMajor, Lower, false, false>::run),
};
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* ap = reinterpret_cast<Scalar*>(pap);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *ap = reinterpret_cast<Scalar *>(pap);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"SPR ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
if (info) return xerbla_(SCALAR_SUFFIX_UP "SPR ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x, *n, *incx);
Scalar *x_cpy = get_compact_vector(x, *n, *incx);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, ap, x_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if (x_cpy != x) delete[] x_cpy;
return 1;
}
/** DSPR2 performs the symmetric rank 2 operation
*
* A := alpha*x*y' + alpha*y*x' + A,
*
* where alpha is a scalar, x and y are n element vectors and A is an
* n by n symmetric matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(spr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pap)
{
typedef void (*functype)(int, Scalar*, const Scalar*, const Scalar*, Scalar);
*
* A := alpha*x*y' + alpha*y*x' + A,
*
* where alpha is a scalar, x and y are n element vectors and A is an
* n by n symmetric matrix, supplied in packed form.
*/
int EIGEN_BLAS_FUNC(spr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy,
RealScalar *pap) {
typedef void (*functype)(int, Scalar *, const Scalar *, const Scalar *, Scalar);
static const functype func[2] = {
// array index: UP
(internal::packed_rank2_update_selector<Scalar,int,Upper>::run),
// array index: LO
(internal::packed_rank2_update_selector<Scalar,int,Lower>::run),
// array index: UP
(internal::packed_rank2_update_selector<Scalar, int, Upper>::run),
// array index: LO
(internal::packed_rank2_update_selector<Scalar, int, Lower>::run),
};
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar* ap = reinterpret_cast<Scalar*>(pap);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar *ap = reinterpret_cast<Scalar *>(pap);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(UPLO(*uplo)==INVALID) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"SPR2 ",&info,6);
if (UPLO(*uplo) == INVALID)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
if (info) return xerbla_(SCALAR_SUFFIX_UP "SPR2 ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x, *n, *incx);
Scalar* y_cpy = get_compact_vector(y, *n, *incy);
Scalar *x_cpy = get_compact_vector(x, *n, *incx);
Scalar *y_cpy = get_compact_vector(y, *n, *incy);
int code = UPLO(*uplo);
if(code>=2 || func[code]==0)
return 0;
if (code >= 2 || func[code] == 0) return 0;
func[code](*n, ap, x_cpy, y_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
return 1;
}
/** DGER performs the rank 1 operation
*
* A := alpha*x*y' + A,
*
* where alpha is a scalar, x is an m element vector, y is an n element
* vector and A is an m by n matrix.
*/
int EIGEN_BLAS_FUNC(ger)(int *m, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pa, int *lda)
{
Scalar* x = reinterpret_cast<Scalar*>(px);
Scalar* y = reinterpret_cast<Scalar*>(py);
Scalar* a = reinterpret_cast<Scalar*>(pa);
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
*
* A := alpha*x*y' + A,
*
* where alpha is a scalar, x is an m element vector, y is an n element
* vector and A is an m by n matrix.
*/
int EIGEN_BLAS_FUNC(ger)(int *m, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pa,
int *lda) {
Scalar *x = reinterpret_cast<Scalar *>(px);
Scalar *y = reinterpret_cast<Scalar *>(py);
Scalar *a = reinterpret_cast<Scalar *>(pa);
Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
int info = 0;
if(*m<0) info = 1;
else if(*n<0) info = 2;
else if(*incx==0) info = 5;
else if(*incy==0) info = 7;
else if(*lda<std::max(1,*m)) info = 9;
if(info)
return xerbla_(SCALAR_SUFFIX_UP"GER ",&info,6);
if (*m < 0)
info = 1;
else if (*n < 0)
info = 2;
else if (*incx == 0)
info = 5;
else if (*incy == 0)
info = 7;
else if (*lda < std::max(1, *m))
info = 9;
if (info) return xerbla_(SCALAR_SUFFIX_UP "GER ", &info, 6);
if(alpha==Scalar(0))
return 1;
if (alpha == Scalar(0)) return 1;
Scalar* x_cpy = get_compact_vector(x,*m,*incx);
Scalar* y_cpy = get_compact_vector(y,*n,*incy);
Scalar *x_cpy = get_compact_vector(x, *m, *incx);
Scalar *y_cpy = get_compact_vector(y, *n, *incy);
internal::general_rank1_update<Scalar,int,ColMajor,false,false>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);
internal::general_rank1_update<Scalar, int, ColMajor, false, false>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);
if(x_cpy!=x) delete[] x_cpy;
if(y_cpy!=y) delete[] y_cpy;
if (x_cpy != x) delete[] x_cpy;
if (y_cpy != y) delete[] y_cpy;
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,10 +7,10 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define SCALAR float
#define SCALAR float
#define SCALAR_SUFFIX s
#define SCALAR_SUFFIX_UP "S"
#define ISCOMPLEX 0
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
@@ -18,5 +18,6 @@
#include "level2_real_impl.h"
#include "level3_impl.h"
float EIGEN_BLAS_FUNC(dsdot)(int* n, float* alpha, float* x, int* incx, float* y, int* incy)
{ return double(*alpha) + BLASFUNC(dsdot)(n, x, incx, y, incy); }
float EIGEN_BLAS_FUNC(dsdot)(int* n, float* alpha, float* x, int* incx, float* y, int* incy) {
return double(*alpha) + BLASFUNC(dsdot)(n, x, incx, y, incy);
}

View File

@@ -2,19 +2,17 @@
#include <stdio.h>
#if (defined __GNUC__) && (!defined __MINGW32__) && (!defined __CYGWIN__)
#define EIGEN_WEAK_LINKING __attribute__ ((weak))
#define EIGEN_WEAK_LINKING __attribute__((weak))
#else
#define EIGEN_WEAK_LINKING
#endif
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
EIGEN_WEAK_LINKING int xerbla_(const char * msg, int *info, int)
{
printf("Eigen BLAS ERROR #%i: %s\n", *info, msg );
EIGEN_WEAK_LINKING int xerbla_(const char *msg, int *info, int) {
printf("Eigen BLAS ERROR #%i: %s\n", *info, msg);
return 0;
}