20 #include <tensor/tensor.h>
21 #include <tensor/tensor_lapack.h>
22 #include <tensor/linalg.h>
26 using namespace lapack;
40 if (n != (integer)A.
columns()) {
41 std::cerr <<
"Routine solve() can only operate on square systems of equations, i.e\n"
42 <<
"when the number of unknowns is equal to the number of equations.\n"
43 <<
"However, you have passed a matrix of size " << A.
columns() <<
" by " << A.
rows();
48 std::cerr <<
"In solve(A,B), the number of equations does not match the number of right\n"
49 <<
"hand members. That is, while matrix A has " << n <<
" columns, the vector\n"
50 <<
"B has " << ldb <<
" elements.";
56 cdouble *b = tensor_pointer(output);
60 nrhs = B.
size() / ldb;
64 cdouble *a = tensor_pointer(aux);
66 integer *ipiv =
new integer[n];
68 #ifdef TENSOR_USE_ACML
69 zgesv(n, nrhs, a, lda, ipiv, b, ldb, &info);
71 F77NAME(zgesv)(&n, &nrhs, a, &lda, ipiv, b, &ldb, &info);
78 "The matrix of the system of equations is singular and thus the problem cannot be\n"
79 "solved with the standard resolutor.\n";
index columns() const
Query the size of 2nd index.
index rows() const
Query then size of 1st index.
Complex Tensor with elements of type "cdouble".
index size() const
Returns total number of elements in Tensor.
index dimension(int which) const
Length of a given Tensor index.
const RTensor solve(const RTensor &A, const RTensor &B)
Solve a real linear system of equations by Gauss-Seidel method.