20 #include <tensor/tensor.h>
21 #include <tensor/tensor_lapack.h>
22 #include <tensor/linalg.h>
26 using namespace lapack;
47 std::cerr <<
"Routine solve() can only operate on square systems of equations, i.e\n"
48 <<
"when the number of unknowns is equal to the number of equations.\n"
49 <<
"However, you have passed a matrix of size " << A.
columns() <<
" by " << A.
rows();
54 std::cerr <<
"In solve(A,B), the number of equations does not match the number of right\n"
55 <<
"hand members. That is, while matrix A has " << n <<
" columns, the vector\n"
56 <<
"B has " << ldb <<
" elements.";
62 RTensor::elt_t *b = tensor_pointer(output);
66 nrhs = B.
size() / ldb;
70 RTensor::elt_t *a = tensor_pointer(aux);
72 integer *ipiv =
new integer[n];
74 #ifdef TENSOR_USE_ACML
75 dgesv(n, nrhs, a, lda, ipiv, b, ldb, &info);
77 F77NAME(dgesv)(&n, &nrhs, a, &lda, ipiv, b, &ldb, &info);
84 "The matrix of the system of equations is singular and"
85 " thus the problem cannot be\n"
86 "solved with the standard resolutor.\n";
index columns() const
Query the size of 2nd index.
index rows() const
Query then size of 1st index.
Real Tensor with elements of type "double".
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.