42 "This matrix is not square, the matrix MUST be square!",
129 "This matrix is not square, the matrix MUST be square!",
156 for (
unsigned long i = 0;
i <
N;
i++)
159 for (
unsigned long j = 0;
j <
M;
j++)
161 double tmp = std::abs((*
this)(
i,
j));
170 scaling[
i] = 1.0 /
big;
187 for (
unsigned long i = 0;
i < (
N *
M);
i++)
200 for (
unsigned long j = 0;
j <
M;
j++)
203 unsigned long imax = 0;
205 for (
unsigned long i = 0;
i <
j;
i++)
208 for (
unsigned long k = 0;
k <
i;
k++)
217 for (
unsigned long i =
j;
i <
N;
i++)
220 for (
unsigned long k = 0;
k <
j;
k++)
226 double tmp = scaling[
i] * std::abs(
sum);
237 for (
unsigned long k = 0;
k <
N;
k++)
246 scaling[
imax] = scaling[
j];
259 for (
unsigned long i =
j + 1;
i <
N;
i++)
273 for (
unsigned i = 0;
i <
N;
i++)
276 std::complex<double>
entry;
304 for (
unsigned i = 0;
i < 3;
i += 2)
314 for (
int index =
lower; index <
upper; ++index)
328 for (
int index =
lower; index <
upper; ++index)
384 "This matrix is not square, the matrix MUST be square!",
393 <<
rhs.
size() <<
", it should be " <<
N << std::endl;
402 "Index vector has not been allocated. Have you called ludecompse()\n",
410 <<
Index->size() <<
", it should be " <<
N
419 unsigned long ii = 0;
420 for (
unsigned i = 0;
i <
N;
i++)
422 unsigned long ip = (*Index)[
i];
428 for (
unsigned long j =
ii - 1;
j <
i;
j++)
441 for (
long i =
long(
N) - 1;
i >= 0;
i--)
443 std::complex<double>
sum =
rhs[
i];
455 Vector<std::complex<double>>& residual)
462 "This matrix is not square, the matrix MUST be square!",
471 <<
rhs.
size() <<
", it should be " <<
N << std::endl;
482 << x.
size() <<
", it should be " <<
N << std::endl;
496 for (
unsigned long i = 0;
i <
N;
i++)
499 for (
unsigned long j = 0;
j <
M;
j++)
519 << x.
size() <<
", it should be " <<
M << std::endl;
534 for (
unsigned long i = 0;
i <
N;
i++)
537 for (
unsigned long j = 0;
j <
M;
j++)
563 const unsigned long n = this->
nrow();
569 std::complex<double>*
value = 0;
590 row_start =
new int[
n + 1];
672 std::ostringstream error_message;
673 error_message <<
"Error inserting value in result";
706 new std::map<int, std::complex<double>>[
n];
759 for (std::map<
int, std::complex<double>>::iterator
i =
779 std::vector<std::vector<std::complex<double>>>
result_vals(
n);
806 for (
int i = 0;
i <= size;
i++)
850 for (
unsigned i = 0;
i <
nnn;
i++)
860 const unsigned long n_nz = this->
nnz();
876 std::ostringstream error_message;
877 error_message <<
"matrix_in has a different number of rows than\n"
887 std::ostringstream error_message;
888 error_message <<
"matrix_in has a different number of columns than\n"
901 unsigned nrow_local = this->
nrow();
945 for (std::map<
int, std::complex<double>>::iterator
it =
974 std::ostringstream error_message;
975 error_message <<
"The matrix matrix_in is not built.\n"
976 <<
"Please build the matrix!\n";
982 const unsigned long n_row = this->
nrow();
986 std::ostringstream error_message;
987 error_message <<
"matrix_in has a different number of rows than\n"
997 std::ostringstream error_message;
998 error_message <<
"matrix_in has a different number of columns than\n"
1011 unsigned nrow_local = this->
nrow();
1055 for (std::map<
int, std::complex<double>>::iterator
it =
1087 << x.
size() <<
", it should be " <<
N << std::endl;
1102 for (
unsigned long i = 0;
i <
M;
i++)
1109 for (
unsigned long i = 0;
i <
N;
i++)
1111 for (
unsigned long j = 0;
j <
M;
j++)
1132 std::complex<double>*,
1135 std::complex<double>*,
1154 <<
"N, M " <<
N <<
" " <<
M << std::endl;
1208 <<
"N, rhs.size() " <<
N <<
" " <<
rhs.
size()
1219 <<
"N, M " <<
N <<
" " <<
M << std::endl;
1228 std::complex<double>* b =
new std::complex<double>[
N];
1231 for (
unsigned long i = 0;
i <
N;
i++)
1270 for (
unsigned long i = 0;
i <
N;
i++)
1325 const Vector<std::complex<double>>&
rhs,
1326 Vector<std::complex<double>>& residual)
1333 "This matrix is not square, the matrix MUST be square!",
1342 <<
rhs.
size() <<
", it should be " <<
N << std::endl;
1353 << x.
size() <<
", it should be " <<
N << std::endl;
1368 for (
unsigned i = 0;
i <
N;
i++)
1373 for (
unsigned long j = 0;
j <
N;
j++)
1397 << x.
size() <<
", it should be " <<
M << std::endl;
1410 for (
unsigned i = 0;
i <
N;
i++)
1415 for (
unsigned long j = 0;
j <
N;
j++)
1440 << x.
size() <<
", it should be " <<
N << std::endl;
1455 for (
unsigned long i = 0;
i <
M;
i++)
1461 for (
unsigned long i = 0;
i <
N;
i++)
1489 <<
"N, M " <<
N <<
" " <<
M << std::endl;
1542 <<
"N, rhs.size() " <<
N <<
" " <<
rhs.
size()
1553 <<
"N, M " <<
N <<
" " <<
M << std::endl;
1562 std::complex<double>* b =
new std::complex<double>[
N];
1565 for (
unsigned long i = 0;
i <
N;
i++)
1603 for (
unsigned long i = 0;
i <
N;
i++)
1657 const Vector<std::complex<double>>&
rhs,
1658 Vector<std::complex<double>>& residual)
1666 <<
rhs.
size() <<
", it should be " <<
N << std::endl;
1677 << x.
size() <<
", it should be " <<
M << std::endl;
1690 for (
unsigned long i = 0;
i <
N;
i++)
1715 << x.
size() <<
", it should be " <<
M << std::endl;
1728 for (
unsigned long i = 0;
i <
N;
i++)
1754 << x.
size() <<
", it should be " <<
N << std::endl;
1769 for (
unsigned long i = 0;
i <
M;
i++)
1775 for (
unsigned long i = 0;
i <
N;
i++)
int Info
Info flag for the SuperLU solver.
void multiply(const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
Multiply the matrix by the vector x: soln=Ax.
int ludecompose()
LU decomposition using SuperLU.
void multiply_transpose(const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
Multiply the transposed matrix by the vector x: soln=A^T x.
void clean_up_memory()
LU clean up (perhaps this should happen in the destructor)
bool Doc_stats_during_solve
Flag to indicate if stats are to be displayed during solution of linear system with SuperLU.
void * F_factors
Storage for the LU factors as required by SuperLU.
void lubksub(Vector< std::complex< double > > &rhs)
LU back solve for given RHS.
void residual(const Vector< std::complex< double > > &x, const Vector< std::complex< double > > &b, Vector< std::complex< double > > &residual)
Find the residulal to x of Ax=b, ie r=b-Ax.
int * Column_start
Start index for column.
int * Row_index
Row index.
A class for compressed row matrices.
unsigned long nrow() const
Return the number of rows of the matrix.
void * F_factors
Storage for the LU factors as required by SuperLU.
unsigned long ncol() const
Return the number of columns of the matrix.
bool Doc_stats_during_solve
Flag to indicate if stats are to be displayed during solution of linear system with SuperLU.
SerialMatrixMultiplyMethod Serial_matrix_matrix_multiply_method
A switch variable for selecting the matrix multiply method for serial (non-parallel) runs....
void multiply_transpose(const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
Multiply the transposed matrix by the vector x: soln=A^T x.
void multiply(const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
Multiply the matrix by the vector x: soln=Ax.
void add(const CRDoubleMatrix &matrix_in, CRComplexMatrix &result_matrix) const
Element-wise addition of this matrix with matrix_in.
int ludecompose()
LU decomposition using SuperLU.
void lubksub(Vector< std::complex< double > > &rhs)
LU back solve for given RHS.
int Info
Info flag for the SuperLU solver.
void residual(const Vector< std::complex< double > > &x, const Vector< std::complex< double > > &b, Vector< std::complex< double > > &residual)
Find the residual to x of Ax=b, i.e. r=b-Ax.
void clean_up_memory()
LU clean up (perhaps this should happen in the destructor)
A class for compressed row matrices. This is a distributable object.
int * column_index()
Access to C-style column index array.
int * Row_start
Start index for row.
int * Column_index
Column index.
int * row_start()
Access to C-style row_start array.
void build_without_copy(T *value, int *column_index, int *row_start, const unsigned long &nnz, const unsigned long &n, const unsigned long &m)
Function to build matrix from pointers to arrays which hold the row starts, column indices and non-ze...
virtual int ludecompose()
LU decomposition of the matrix using the appropriate linear solver. Return the sign of the determinan...
virtual void solve(Vector< std::complex< double > > &rhs)
Complete LU solve (replaces matrix by its LU decomposition and overwrites RHS with solution)....
virtual unsigned long ncol() const =0
Return the number of columns of the matrix.
virtual void lubksub(Vector< std::complex< double > > &rhs)
LU backsubstitue a previously LU-decomposed matrix; The passed rhs will be over-written with the solu...
virtual unsigned long nrow() const =0
Return the number of rows of the matrix.
bool Overwrite_matrix_storage
Boolean flag used to decided whether the LU decomposition is stored separately, or not.
virtual ~DenseComplexMatrix()
Destructor, delete the storage for Index vector and LU storage (if any)
Vector< long > * Index
Pointer to storage for the index of permutations in the LU solve.
void residual(const Vector< std::complex< double > > &x, const Vector< std::complex< double > > &rhs, Vector< std::complex< double > > &residual)
Find the residual of Ax=b, ie r=b-Ax for the "solution" x.
int ludecompose()
Overload the LU decomposition. For this storage scheme the matrix storage will be over-writeen by its...
void multiply_transpose(const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
Multiply the transposed matrix by the vector x: soln=A^T x.
void delete_lu_factors()
Function that deletes the storage for the LU_factors, if it is not the same as the matrix storage.
void lubksub(Vector< std::complex< double > > &rhs)
Overload the LU back substitution. Note that the rhs will be overwritten with the solution vector.
std::complex< double > * LU_factors
Pointer to storage for the LU decomposition.
void multiply(const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
Multiply the matrix by the vector x: soln=Ax.
unsigned long N
Number of rows.
std::complex< double > & entry(const unsigned long &i, const unsigned long &j)
The access function that will be called by the read-write round-bracket operator.
std::complex< double > * Matrixdata
Internal representation of matrix as a pointer to data.
unsigned long M
Number of columns.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
An OomphLibError object which should be thrown when an run-time error is encountered....
unsigned long Nnz
Number of non-zero values (i.e. size of Value array)
T * Value
Internal representation of the matrix values, a pointer.
T * value()
Access to C-style value array.
unsigned long nnz() const
Return the number of nonzero entries.
unsigned long N
Number of rows.
unsigned long M
Number of columns.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
std::string lower(const std::string &text)
int superlu_complex(int *, int *, int *, int *, std::complex< double > *, int *, int *, std::complex< double > *, int *, int *, int *, void *, int *)