float *A, const dealii::types::blas_int *lda);
// Multiply rectangular mxn real matrix by real scalar CTO/CFROM
void dlascl_(const char *type,
- const int *kl,
- const int *ku,
+ const dealii::types::blas_int *kl,
+ const dealii::types::blas_int *ku,
const double *cfrom,
const double *cto,
- const int *m,
- const int *n,
+ const dealii::types::blas_int *m,
+ const dealii::types::blas_int *n,
double *A,
- const int *lda,
- int *info);
+ const dealii::types::blas_int *lda,
+ dealii::types::blas_int *info);
void slascl_(const char *type,
- const int *kl,
- const int *ku,
+ const dealii::types::blas_int *kl,
+ const dealii::types::blas_int *ku,
const float *cfrom,
const float *cto,
- const int *m,
- const int *n,
+ const dealii::types::blas_int *m,
+ const dealii::types::blas_int *n,
float *A,
- const int *lda,
- int *info);
+ const dealii::types::blas_int *lda,
+ dealii::types::blas_int *info);
}
DEAL_II_NAMESPACE_OPEN
const types::blas_int n = this->n();
const types::blas_int lda = this->m();
types::blas_int info;
- // kl and ku will not be referenced for type = G (dense matrices)
+ // kl and ku will not be referenced for type = G (dense matrices).
const types::blas_int kl=0;
number *values = &this->values[0];
lascl(&type,&kl,&kl,&cfrom,&factor,&m,&n,values,&lda,&info);
+ // Negative return value implies a wrong argument. This should be internal.
Assert(info >= 0, ExcInternalError());
return *this;
const types::blas_int n = this->n();
const types::blas_int lda = this->m();
types::blas_int info;
- // kl and ku will not be referenced for type = G (dense matrices)
+ // kl and ku will not be referenced for type = G (dense matrices).
const types::blas_int kl=0;
number *values = &this->values[0];
lascl(&type,&kl,&kl,&factor,&cto,&m,&n,values,&lda,&info);
+ // Negative return value implies a wrong argument. This should be internal.
Assert(info >= 0, ExcInternalError());
return *this;
template <typename number>
void
-LAPACKFullMatrix<number>::add (const number a,
+LAPACKFullMatrix<number>::add (const number a,
const LAPACKFullMatrix<number> &A)
{
Assert(state == LAPACKSupport::matrix ||
AssertIsFinite(a);
- for (size_type i=0; i<m(); ++i)
- for (size_type j=0; j<n(); ++j)
- (*this)(i,j) += a * A(i,j);
+ // BLAS does not offer functions to add matrices.
+ // LapackFullMatrix is stored in contiguous array
+ // ==> use BLAS 1 for adding vectors
+ const types::blas_int n = this->m() * this->n();
+ const types::blas_int inc=1;
+ number *values = &this->values[0];
+ const number *values_A = &A.values[0];
+
+ axpy(&n,&a,values_A,&inc,values,&inc);
}