243{
244 int size =
static_cast<int>(A->
numRows());
245 int bsize =
static_cast<int>(b->
numColumns());
246 int info;
247
248
250 {
251 ERROR(
"expected a square matrix");
252 return false;
253 }
254
255
257 {
258 ERROR(
"expected matrices to have same number of rows");
259 return false;
260 ;
261 }
262
263 if (size == 0)
264 {
265 x->resize(size, bsize);
266 return true;
267 }
268
269 int* perm = new int[size];
272
274 &bsize,
275 copyA.data(),
276 &size,
277 perm,
278 copyb.data(),
279 &size,
280 &info);
281
282 delete [] perm;
283
284
285 x->resize(size, bsize);
287
288 if (info > 0)
289 {
290 ERROR(
"according to dgesv, matrix is singular");
291 return false;
292 }
293 else if (info < 0)
294 {
295 ERROR(
"argument passed to dgesv had an illegal value");
296 return false;
297 }
298
299 return true;
300}
size_t numColumns() const
std::vector< double > make_lapack_array(const DMatRR &mat)
void fill_from_lapack_array(const std::vector< double > &doubles, DMatRR &mat)
int dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info)