160 const unsigned long&
m)
172 const unsigned long&
m,
232 "This matrix is not square, the matrix MUST be square!",
251 for (
unsigned long i = 0;
i <
N;
i++)
253 for (
unsigned long j = 0;
j <
M;
j++)
259 "Matrix needs to be symmetric for eigenvalues_by_jacobi()",
270 throw OomphLibError(
"Sorry JacobiEigenSolver::jacobi() removed because of "
271 "licencing problems.",
281 for (
unsigned long i = 0;
i <
N;
i++)
283 for (
unsigned long j = 0;
j <
M;
j++)
303 << x.
nrow() <<
", it should be " << this->
ncol()
314 <<
"The x vector cannot be distributed for DenseDoubleMatrix "
315 <<
"matrix-vector multiply" << std::endl;
324 if (
soln.distributed())
328 <<
"The x vector cannot be distributed for DenseDoubleMatrix "
329 <<
"matrix-vector multiply" << std::endl;
338 <<
"The soln vector is setup and therefore must have the same "
339 <<
"number of rows as the matrix";
345 *
soln.distribution_pt()->communicator_pt())
349 <<
"The soln vector and the x vector must have the same communicator"
367 soln.initialise(0.0);
372 for (
unsigned long i = 0;
i <
N;
i++)
374 for (
unsigned long j = 0;
j <
M;
j++)
394 << x.
nrow() <<
", it should be " << this->
nrow()
405 <<
"The x vector cannot be distributed for DenseDoubleMatrix "
406 <<
"matrix-vector multiply" << std::endl;
415 if (
soln.distributed())
419 <<
"The x vector cannot be distributed for DenseDoubleMatrix "
420 <<
"matrix-vector multiply" << std::endl;
429 <<
"The soln vector is setup and therefore must have the same "
430 <<
"number of columns as the matrix";
435 if (*
soln.distribution_pt()->communicator_pt() !=
440 <<
"The soln vector and the x vector must have the same communicator"
459 soln.initialise(0.0);
464 for (
unsigned long i = 0;
i <
N;
i++)
466 for (
unsigned long j = 0;
j <
M;
j++)
489 for (
unsigned i = 0;
i <
N;
i++)
495 for (
unsigned long j = 0;
j <
M;
j++)
505 for (
unsigned long j = 0;
j <
M;
j++)
526 if (this->
ncol() != matrix_in.
nrow())
528 std::ostringstream error_message;
530 <<
"Matrix dimensions incompatable for matrix-matrix multiplication"
531 <<
"ncol() for first matrix:" << this->
ncol()
532 <<
"nrow() for second matrix: " << matrix_in.
nrow();
550 for (
unsigned long k = 0;
k <
n_col;
k++)
552 for (
unsigned long i = 0;
i <
n_row;
i++)
554 for (
unsigned long j = 0;
j <
m_col;
j++)
588 const unsigned long&
n,
589 const unsigned long&
m)
630 << x.
nrow() <<
", it should be " << this->
ncol()
641 <<
"The x vector cannot be distributed for CCDoubleMatrix "
642 <<
"matrix-vector multiply" << std::endl;
651 if (
soln.distributed())
655 <<
"The x vector cannot be distributed for CCDoubleMatrix "
656 <<
"matrix-vector multiply" << std::endl;
665 <<
"The soln vector is setup and therefore must have the same "
666 <<
"number of rows as the matrix";
671 if (*
soln.distribution_pt()->communicator_pt() !=
676 <<
"The soln vector and the x vector must have the same communicator"
695 soln.initialise(0.0);
700 for (
unsigned long j = 0;
j <
N;
j++)
724 << x.
nrow() <<
", it should be " << this->
nrow()
735 <<
"The x vector cannot be distributed for CCDoubleMatrix "
736 <<
"matrix-vector multiply" << std::endl;
745 if (
soln.distributed())
749 <<
"The x vector cannot be distributed for CCDoubleMatrix "
750 <<
"matrix-vector multiply" << std::endl;
759 <<
"The soln vector is setup and therefore must have the same "
760 <<
"number of columns as the matrix";
765 if (*
soln.distribution_pt()->communicator_pt() !=
770 <<
"The soln vector and the x vector must have the same communicator"
789 soln.initialise(0.0);
794 for (
unsigned long i = 0;
i <
N;
i++)
826 if (this->
ncol() != matrix_in.
nrow())
828 std::ostringstream error_message;
830 <<
"Matrix dimensions incompatable for matrix-matrix multiplication"
831 <<
"ncol() for first matrix:" << this->
ncol()
832 <<
"nrow() for second matrix: " << matrix_in.
nrow();
840 unsigned long N = this->
nrow();
841 unsigned long M = matrix_in.
ncol();
842 unsigned long Nnz = 0;
873 std::set<unsigned>
rows;
944 std::ostringstream error_message;
945 error_message <<
"Error inserting value in result";
972 else if (method == 2)
975 std::map<int, double>*
result_maps =
new std::map<int, double>[
M];
1044 else if (method == 3)
1074 for (
int i = 0;
i <= size;
i++)
1130 std::ostringstream error_message;
1131 error_message <<
"Incorrect method set in matrix-matrix multiply"
1132 <<
"method=" << method <<
" not allowed";
1223#ifdef OOMPH_HAS_TRILINOS
1273#ifdef OOMPH_HAS_TRILINOS
1298#ifdef OOMPH_HAS_TRILINOS
1312 const unsigned& ncol,
1328#ifdef OOMPH_HAS_TRILINOS
1378 <<
"has not been implemented for use with MPI!\n";
1397 for (
unsigned i = 0;
i < n_rows;
i++)
1418 oomph_info <<
"Matrix has not been correctly sorted!"
1419 <<
"\nOn row: " <<
i <<
"\nEntry: " <<
j
1460 <<
"has not been tested with MPI!\n";
1475 double* value_pt = this->
value();
1673 const unsigned& ncol,
1711 const unsigned& nnz,
1766 <<
"The vector rhs must have the same distribution as the matrix";
1808 "number of columns in the "
1809 <<
"matrix must be the same";
1817 if (!(*
soln.distribution_pt() == *
this->distribution_pt()))
1821 <<
"The soln vector is setup and therefore must have the same "
1822 <<
"distribution as the matrix";
1845#ifdef OOMPH_HAS_TRILINOS
1851 <<
"Matrix-vector product on multiple processors with distributed "
1852 <<
"CRDoubleMatrix requires Trilinos.";
1860 unsigned n = this->
nrow();
1866 for (
unsigned long i = 0;
i <
n;
i++)
1900 <<
"The x vector and this matrix must have the same distribution.";
1908 if (
soln.distribution_pt()->nrow() !=
this->ncol())
1912 <<
"The soln vector is setup and therefore must have the same "
1913 <<
"number of rows as the vector x";
1927 this->distributed());
1933 soln.initialise(0.0);
1938#ifdef OOMPH_HAS_TRILINOS
1944 <<
"Matrix-vector product on multiple processors with distributed "
1945 <<
"CRDoubleMatrix requires Trilinos.";
1953 unsigned n = this->
nrow();
1960 for (
unsigned long i = 0;
i <
n;
i++)
2017 if (!(*
result.distribution_pt() == *
this->distribution_pt()))
2021 <<
"The matrix result is setup and therefore must have the same "
2022 <<
"distribution as the vector x";
2031 if (!
result.distribution_built())
2041 ((method == 1) || (method == 2) || (method == 3)))
2044 unsigned long N = this->
nrow();
2046 unsigned long Nnz = 0;
2051 int* Column_index = 0;
2070 Row_start =
new int[N + 1];
2109 Value =
new double[Nnz];
2110 Column_index =
new int[Nnz];
2113 for (
unsigned long i = 0;
i < Nnz;
i++)
2115 Column_index[
i] = -1;
2149 std::ostringstream error_message;
2150 error_message <<
"Error inserting value in result";
2156 else if (Column_index[
ptr] == -1)
2163 else if (Column_index[
ptr] ==
col)
2177 else if (method == 2)
2180 std::map<int, double>*
result_maps =
new std::map<int, double>[N];
2212 Row_start =
new int[N + 1];
2216 for (
unsigned long row = 0;
row < N;
row++)
2219 Row_start[
row + 1] = Row_start[
row] + size;
2226 Value =
new double[Nnz];
2227 Column_index =
new int[Nnz];
2230 for (
unsigned long row = 0;
row < N;
row++)
2232 unsigned ptr = Row_start[
row];
2237 Column_index[
ptr] =
i->first;
2238 Value[
ptr] =
i->second;
2249 else if (method == 3)
2279 for (
int i = 0;
i <= size;
i++)
2301 Row_start =
new int[N + 1];
2305 for (
unsigned long row = 0;
row < N;
row++)
2308 Row_start[
row + 1] = Row_start[
row] + size;
2315 Value =
new double[Nnz];
2316 Column_index =
new int[Nnz];
2319 for (
unsigned long row = 0;
row < N;
row++)
2321 unsigned ptr = Row_start[
row];
2323 for (
unsigned i = 0;
i <
nnn;
i++)
2333 result.build_without_copy(M, Nnz, Value, Column_index, Row_start);
2339#ifdef OOMPH_HAS_TRILINOS
2347 std::ostringstream error_message;
2348 error_message <<
"Serial_matrix_matrix_multiply_method = "
2350 <<
" requires trilinos.";
2492 double* global_value =
new double[
nnz_global];
2582 if (
dist_pt->nrow() !=
this->distribution_pt()->nrow())
2584 std::ostringstream error_message;
2585 error_message <<
"The number of global rows in the new distribution ("
2586 <<
dist_pt->nrow() <<
") is not equal to the number"
2587 <<
" of global rows in the current distribution ("
2597 std::ostringstream error_message;
2598 error_message <<
"The new distribution and the current distribution must "
2599 <<
"have the same communicator.";
2606 std::ostringstream error_message;
2607 error_message <<
"The matrix must be build to be redistributed";
2962 this->
build(dist_pt);
3032 double* global_value =
new double[
nnz_count];
3171 for (
int i = 0;
i <
nnz;
i++)
3211 this->
build(dist_pt);
3236 double* global_value = this->
value();
3253 for (
unsigned i = 0;
i <
nnz;
i++)
3260 this->
build(dist_pt);
3292 <<
"has not been tested with MPI!\n";
3302 result->distribution_pt()->build(
3307 const double* value_pt = this->
value();
3418 std::ostringstream error_message;
3419 error_message <<
"This matrix must be setup.";
3471 std::ostringstream error_message;
3472 error_message <<
"The matrix has not been built.\n"
3473 <<
"Please build it...\n";
3481 std::ostringstream error_message;
3482 error_message <<
"The matrix is not square. Can only get the diagonal\n"
3483 <<
"entries of a square matrix.\n";
3522 std::ostringstream error_message;
3523 error_message <<
"The matrix is not built.\n"
3524 <<
"Please build the matrix!\n";
3532 std::ostringstream error_message;
3533 error_message <<
"The matrix matrix_in is not built.\n"
3534 <<
"Please build the matrix!\n";
3544 std::ostringstream error_message;
3545 error_message <<
"matrix_in has a different number of rows than\n"
3546 <<
"this matrix.\n";
3555 std::ostringstream error_message;
3556 error_message <<
"matrix_in has a different number of columns than\n"
3557 <<
"this matrix.\n";
3566 std::ostringstream error_message;
3567 error_message <<
"matrix_in must have the same distribution as\n"
3568 <<
"this matrix.\n";
3579 std::ostringstream error_message;
3580 error_message <<
"The result_matrix is built. "
3581 <<
"But has a different distribution from matrix_in \n"
3582 <<
"They need to be the same.\n";
3637 for (std::map<int, double>::iterator
it =
res_row_map.begin();
3667 namespace CRDoubleMatrixHelpers
3677 const unsigned& nrow,
3678 const unsigned& ncol,
3689 std::ostringstream error_message;
3690 error_message <<
"Please supply the communicator.\n";
3698 std::ostringstream error_message;
3699 error_message <<
"The result matrix has been built.\n"
3700 <<
"Please clear the matrix.\n";
3708 bool distributed =
false;
3710 comm_pt, nrow, distributed);
3722 comm_pt, nrow, distributed);
3734 const unsigned nblockrow = matrix_pt.nrow();
3735 const unsigned nblockcol = matrix_pt.ncol();
3739 if (matrix_pt.nrow() == 0)
3741 std::ostringstream error_message;
3742 error_message <<
"There are no matrices... \n";
3757 std::ostringstream error_message;
3758 error_message <<
"The pointer martrix_pt(" <<
block_row_i <<
","
3767 std::ostringstream error_message;
3768 error_message <<
"The matrix at martrix_pt(" <<
block_row_i <<
","
3782 matrix_pt(0, 0)->distribution_pt()->communicator_pt();
3796 ->communicator_pt());
3799 std::ostringstream error_message;
3800 error_message <<
"The communicator of block martrix_pt("
3802 <<
") is not the same as block "
3803 <<
"matrix_pt(0,0).\n";
3813 if (comm_pt->nproc() > 1)
3828 std::ostringstream error_message;
3829 error_message <<
"Block matrix_pt(" <<
block_row_i <<
","
3831 <<
"have a different distributed boolean.\n";
3860 std::ostringstream error_message;
3886 std::ostringstream error_message;
3915 std::ostringstream error_message;
3916 error_message <<
"First distribution of block row " <<
block_row_i
3917 <<
" is different from the distribution from "
3949 const int* row_start =
block_pt->row_start();
3950 const double* value =
block_pt->value();
3968 if (matrix_pt(0, 0)->distributed() && comm_pt->nproc() > 1)
3975 comm_pt->mpi_comm());
4007 const unsigned nblockrow = matrix_pt.nrow();
4008 const unsigned nblockcol = matrix_pt.ncol();
4012 if (matrix_pt.nrow() == 0)
4014 std::ostringstream error_message;
4015 error_message <<
"There are no matrices... \n";
4030 std::ostringstream error_message;
4031 error_message <<
"The pointer martrix_pt(" <<
block_row_i <<
","
4040 std::ostringstream error_message;
4041 error_message <<
"The matrix at martrix_pt(" <<
block_row_i <<
","
4057 matrix_pt(0, 0)->distribution_pt()->communicator_pt();
4070 ->communicator_pt());
4073 std::ostringstream error_message;
4074 error_message <<
"The communicator of block martrix_pt("
4076 <<
") is not the same as block "
4077 <<
"matrix_pt(0,0).\n";
4087 if (comm_pt->nproc() > 1)
4102 std::ostringstream error_message;
4103 error_message <<
"Block matrix_pt(" <<
block_row_i <<
","
4105 <<
"have a different distributed boolean.\n";
4134 std::ostringstream error_message;
4160 std::ostringstream error_message;
4189 std::ostringstream error_message;
4190 error_message <<
"First distribution of block row " <<
block_row_i
4191 <<
" is different from the distribution from "
4223 const int* row_start =
block_pt->row_start();
4224 const double* value =
block_pt->value();
4262 std::ostringstream error_message;
4263 error_message <<
"The diagonal entry for the block(" <<
block_row_i
4266 <<
" does not exist." << std::endl;
4293 if (matrix_pt(0, 0)->distributed() && comm_pt->nproc() > 1)
4302 comm_pt->mpi_comm());
4311 comm_pt->mpi_comm());
4361 std::ostringstream error_message;
4362 error_message <<
"There are no matrices to concatenate.\n";
4373 <<
"This does not require concatenating...\n";
4386 std::ostringstream error_message;
4387 error_message <<
"The sub matrix (" <<
block_row_i <<
","
4389 <<
"is not built. \n";
4413 std::ostringstream error_message;
4414 error_message <<
"The sub matrix (" <<
block_row_i <<
","
4440 std::ostringstream error_message;
4441 error_message <<
"The sub matrix (" <<
block_row_i <<
","
4455 matrix_pt(0, 0)->distribution_pt()->communicator_pt();
4458 bool distributed = matrix_pt(0, 0)->distributed();
4492 std::ostringstream error_message;
4493 error_message <<
"The total number of rows from the matrices to\n"
4494 <<
"concatenate does not match the nrow from the\n"
4495 <<
"result matrix\n";
4520 ->communicator_pt());
4524 std::ostringstream error_message;
4525 error_message <<
"The OomphCommunicator of the sub matrix ("
4527 <<
"does not have the same communicator as the "
4528 "result matrix. \n";
4541 if (comm_pt->nproc() != 1)
4557 std::ostringstream error_message;
4558 error_message <<
"The distributed boolean of the sub matrix ("
4560 <<
"is not the same as the result matrix. \n";
4588 if ((comm_pt->nproc() == 1) || !distributed)
4678 unsigned nproc = comm_pt->nproc();
4681 unsigned my_rank = comm_pt->my_rank();
4908 comm_pt->mpi_comm());
4957 comm_pt->mpi_comm());
4968 comm_pt->mpi_comm());
5242 std::ostringstream error_message;
5243 error_message <<
"There are no matrices to concatenate.\n";
5254 <<
"This does not require concatenating...\n";
5266 std::ostringstream error_message;
5267 error_message <<
"The number of row distributions must be the same as\n"
5268 <<
"the number of block rows.";
5278 std::ostringstream error_message;
5280 <<
"The number of column distributions must be the same as\n"
5281 <<
"the number of block columns.";
5292 std::ostringstream error_message;
5293 error_message <<
"The row distribution pointer in position "
5306 std::ostringstream error_message;
5307 error_message <<
"The column distribution pointer in position "
5321 std::ostringstream error_message;
5322 error_message <<
"The distribution pointer in position "
5334 std::ostringstream error_message;
5335 error_message <<
"The distribution pointer in position "
5354 std::ostringstream error_message;
5356 <<
"The communicator from the row distribution in position "
5357 <<
block_row_i <<
" is not the same as the first "
5358 <<
"communicator from row_distribution_pt";
5374 std::ostringstream error_message;
5376 <<
"The communicator from the col distribution in position "
5377 <<
block_col_i <<
" is not the same as the first "
5378 <<
"communicator from row_distribution_pt";
5394 std::ostringstream error_message;
5395 error_message <<
"The sub matrix_pt(" <<
block_row_i <<
","
5397 <<
"is not built.\n";
5416 ->communicator_pt());
5419 std::ostringstream error_message;
5423 <<
"does not have the same communicator pointer as those in\n"
5424 <<
"(row|col)_distribution_pt.\n";
5453 std::ostringstream error_message;
5454 error_message <<
"The sub matrix (" <<
block_row_i <<
","
5458 <<
"Either the row_distribution_pt is incorrect or "
5459 <<
"the sub matrices are incorrect.\n";
5485 std::ostringstream error_message;
5486 error_message <<
"The sub matrix (" <<
block_row_i <<
","
5490 <<
"Either the col_distribution_pt is incorrect or "
5491 <<
"the sub matrices are incorrect.\n";
5524 std::ostringstream error_message;
5527 <<
"does not have the same distributoin as the first"
5528 <<
"block in this block row.\n"
5529 <<
"All distributions on a block row must be the same"
5530 <<
"for this function to concatenate matrices.\n";
5572 std::ostringstream error_message;
5574 <<
"The result distribution is not correct.\n"
5575 <<
"Please call the function without a result\n"
5576 <<
"distribution (clear the result matrix) or check the\n"
5577 <<
"distribution of the result matrix.\n"
5578 <<
"The result distribution must be the same as the one \n"
5580 <<
"LinearAlgebraDistributionHelpers::concatenate(...)";
5609 std::ostringstream error_message;
5610 error_message <<
"The OomphCommunicator of the result matrix is not "
5623 if (comm_pt->nproc() != 1)
5641 std::ostringstream error_message;
5642 error_message <<
"The distributed boolean of the sub matrix ("
5644 <<
"is not the same as the result matrix. \n";
5664 std::ostringstream error_message;
5666 <<
"The distributed boolean of row_distribution_pt["
5668 <<
"is not the same as the one from row_distribution_pt[0]. \n";
5683 std::ostringstream error_message;
5685 <<
"The distributed boolean of col_distribution_pt["
5687 <<
"is not the same as the one from row_distribution_pt[0]. \n";
5700 unsigned nproc = comm_pt->nproc();
5714 std::vector<std::vector<unsigned>>
col_offset(
5732 std::vector<unsigned>());
5791 unsigned long res_i = 0;
5806 if (matrix_pt(
i,
j) != 0)
5811 double*
b_value = matrix_pt(
i,
j)->value();
5898 std::ostringstream error_message;
5899 error_message <<
"There are no matrices to concatenate.\n";
5908 std::ostringstream error_message;
5910 <<
"The number of block rows and block columns\n"
5911 <<
"must be the same. Otherwise, call the other\n"
5912 <<
"concatenate_without_communication function, passing in\n"
5913 <<
"a Vector of distributions describing how to permute the\n"
5922 block_distribution_pt, block_distribution_pt, matrix_pt,
result_matrix);
A class for compressed column matrices that store doubles.
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
virtual void lubksub(DoubleVector &rhs)
LU back solve for given RHS.
void matrix_reduction(const double &alpha, CCDoubleMatrix &reduced_matrix)
For every row, find the maximum absolute value of the entries in this row. Set all values that are le...
virtual ~CCDoubleMatrix()
Destructor: Kill the LU factors if they have been setup.
unsigned long ncol() const
Return the number of columns of the matrix.
unsigned long nrow() const
Return the number of rows of the matrix.
CCDoubleMatrix()
Default constructor.
virtual void ludecompose()
LU decomposition using SuperLU.
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
unsigned Matrix_matrix_multiply_method
Flag to determine which matrix-matrix multiplication method is used.
A class for compressed column matrices: a sparse matrix format The class is passed as the MATRIX_TYPE...
int * Column_start
Start index for column.
int * Row_index
Row index.
int * column_start()
Access to C-style column_start array.
void build(const Vector< double > &value, const Vector< int > &row_index, const Vector< int > &column_start, const unsigned long &n, const unsigned long &m)
Build matrix from compressed representation. Number of nonzero entries is read off from value,...
int * row_index()
Access to C-style row index array.
A class for compressed row matrices. This is a distributable object.
void sort_entries()
Sorts the entries associated with each row of the matrix in the column index vector and the value vec...
virtual ~CRDoubleMatrix()
Destructor.
int * row_start()
Access to C-style row_start array.
struct oomph::CRDoubleMatrix::CRDoubleMatrixComparisonHelper Comparison_struct
void matrix_reduction(const double &alpha, CRDoubleMatrix &reduced_matrix)
For every row, find the maximum absolute value of the entries in this row. Set all values that are le...
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
virtual void ludecompose()
LU decomposition using SuperLU if matrix is not distributed or distributed onto a single processor.
unsigned long ncol() const
Return the number of columns of the matrix.
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
void add(const CRDoubleMatrix &matrix_in, CRDoubleMatrix &result_matrix) const
element-wise addition of this matrix with matrix_in.
bool Built
Flag to indicate whether the matrix has been built - i.e. the distribution has been setup AND the mat...
Vector< int > Index_of_diagonal_entries
Vector whose i'th entry contains the index of the last entry below or on the diagonal of the i'th row...
double inf_norm() const
returns the inf-norm of this matrix
void get_matrix_transpose(CRDoubleMatrix *result) const
Returns the transpose of this matrix.
int * column_index()
Access to C-style column index array.
unsigned long nnz() const
Return the number of nonzero entries (the local nnz)
CRDoubleMatrix * global_matrix() const
if this matrix is distributed then a the equivalent global matrix is built using new and returned....
void redistribute(const LinearAlgebraDistribution *const &dist_pt)
The contents of the matrix are redistributed to match the new distribution. In a non-MPI build this m...
bool built() const
access function to the Built flag - indicates whether the matrix has been build - i....
void build_without_copy(const unsigned &ncol, const unsigned &nnz, double *value, int *column_index, int *row_start)
keeps the existing distribution and just matrix that is stored without copying the matrix data
double * value()
Access to C-style value array.
unsigned long nrow() const
Return the number of rows of the matrix.
unsigned Serial_matrix_matrix_multiply_method
Flag to determine which matrix-matrix multiplication method is used (for serial (or global) matrices)
Vector< double > diagonal_entries() const
returns a Vector of diagonal entries of this matrix. This only works with square matrices....
CRDoubleMatrix()
Default constructor.
bool entries_are_sorted(const bool &doc_unordered_entries=false) const
Runs through the column index vector and checks if the entries follow the regular lexicographical ord...
CRMatrix< double > CR_matrix
Storage for the Matrix in CR Format.
virtual void lubksub(DoubleVector &rhs)
LU back solve for given RHS.
void build(const LinearAlgebraDistribution *distribution_pt, const unsigned &ncol, const Vector< double > &value, const Vector< int > &column_index, const Vector< int > &row_start)
build method: vector of values, vector of column indices, vector of row starts and number of rows and...
void clean_up_memory()
Wipe matrix data and set all values to 0.
int * column_index()
Access to C-style column index array.
void build(const Vector< T > &value, const Vector< int > &column_index, const Vector< int > &row_start, const unsigned long &n, const unsigned long &m)
Build matrix from compressed representation. Number of nonzero entries is read off from value,...
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...
T get_entry(const unsigned long &i, const unsigned long &j) const
Access function that will be called by the read-only round-bracket operator (const)
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
DenseDoubleMatrix()
Constructor, set the default linear solver.
virtual void lubksub(DoubleVector &rhs)
LU backsubstitution.
virtual ~DenseDoubleMatrix()
Destructor.
void matrix_reduction(const double &alpha, DenseDoubleMatrix &reduced_matrix)
For every row, find the maximum absolute value of the entries in this row. Set all values that are le...
virtual void ludecompose()
LU decomposition using DenseLU (default linea solver)
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
unsigned long nrow() const
Return the number of rows of the matrix.
unsigned long ncol() const
Return the number of columns of the matrix.
void eigenvalues_by_jacobi(Vector< double > &eigen_val, DenseMatrix< double > &eigen_vect) const
Determine eigenvalues and eigenvectors, using Jacobi rotations. Only for symmetric matrices....
Dense LU decomposition-based solve of full assembled linear system. VERY inefficient but useful to il...
Class for dense matrices, storing all the values of the matrix as a pointer to a pointer with assorte...
unsigned long N
Number of rows.
double * Matrixdata
Internal representation of matrix as a pointer to data.
unsigned long M
Number of columns.
void clear_distribution()
clear the distribution of this distributable linear algebra object
bool distributed() const
distribution is serial or distributed
unsigned nrow() const
access function to the number of global rows.
bool distribution_built() const
if the communicator_pt is null then the distribution is not setup then false is returned,...
unsigned nrow_local() const
access function for the num of local rows on this processor.
unsigned first_row() const
access function for the first row on this processor
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
void solve(DoubleVector &rhs)
Complete LU solve (replaces matrix by its LU decomposition and overwrites RHS with solution)....
LinearSolver * Default_linear_solver_pt
LinearSolver * Linear_solver_pt
A vector in the mathematical sense, initially developed for linear algebra type applications....
void initialise(const double &v)
initialise the whole vector with value v
double * values_pt()
access function to the underlying values
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
unsigned nrow() const
access function to the number of global rows.
virtual void solve(Problem *const &problem_pt, DoubleVector &result)=0
Solver: Takes pointer to problem and returns the results vector which contains the solution of the li...
virtual void clean_up_memory()
Empty virtual function that can be overloaded in specific linear solvers to clean up any memory that ...
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
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 N
Number of rows.
unsigned long M
Number of columns.
SuperLU Project Solver class. This is a combined wrapper for both SuperLU and SuperLU Dist....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
double gershgorin_eigenvalue_estimate(const DenseMatrix< CRDoubleMatrix * > &matrix_pt)
Calculates the largest Gershgorin disc whilst preserving the sign. Let A be an n by n matrix,...
void concatenate_without_communication(const Vector< LinearAlgebraDistribution * > &row_distribution_pt, const Vector< LinearAlgebraDistribution * > &col_distribution_pt, const DenseMatrix< CRDoubleMatrix * > &matrix_pt, CRDoubleMatrix &result_matrix)
Concatenate CRDoubleMatrix matrices.
double inf_norm(const DenseMatrix< CRDoubleMatrix * > &matrix_pt)
Compute infinity (maximum) norm of sub blocks as if it was one matrix.
void concatenate(const DenseMatrix< CRDoubleMatrix * > &matrix_pt, CRDoubleMatrix &result_matrix)
Concatenate CRDoubleMatrix matrices. The in matrices are concatenated such that the block structure o...
void create_uniformly_distributed_matrix(const unsigned &nrow, const unsigned &ncol, const OomphCommunicator *const comm_pt, const Vector< double > &values, const Vector< int > &column_indices, const Vector< int > &row_start, CRDoubleMatrix &matrix_out)
Builds a uniformly distributed matrix. A locally replicated matrix is constructed then redistributed ...
void concatenate(const Vector< LinearAlgebraDistribution * > &in_distribution_pt, LinearAlgebraDistribution &out_distribution)
Takes a vector of LinearAlgebraDistribution objects and concatenates them such that the nrow_local of...
double timer()
returns the time in seconds after some point in past
void multiply(const CRDoubleMatrix *matrix, const DoubleVector &x, DoubleVector &soln)
Function to perform a matrix-vector multiplication on a oomph-lib matrix and vector using Trilinos fu...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...