Macaulay2 Engine
Loading...
Searching...
No Matches

◆ solve_via_lapack_without_transposition()

bool solve_via_lapack_without_transposition ( int size,
complex * A,
int bsize,
complex * b,
complex * x )

Definition at line 1218 of file NAG.cpp.

1225{
1226 bool ret = true;
1227 int info;
1228
1229 int* permutation = newarray_atomic(int, size);
1230 // int i,j;
1231 double* copyA = (double*)A;
1233 double* copyb = (double*)x; // result is stored in copyb
1234
1235 /*
1236 printf("-----------(solve)-----------------------------------\ncopyA:\n");
1237 for (int i=0; i<size*size; i++)
1238 printf("(%lf %lf) ", *(copyA+2*i), *(copyA+2*i+1));
1239 printf("\nb:\n");
1240 for (int i=0; i<size; i++)
1241 printf("(%lf %lf) ", *(copyb+2*i), *(copyb+2*i+1));
1242 */
1243
1244 zgesv_(&size, &bsize, copyA, &size, permutation, copyb, &size, &info);
1245 /*
1246 printf("\nx = b:\n");
1247 for (i=0; i<size; i++)
1248 printf("(%lf %lf) ", *(copyb+2*i), *(copyb+2*i+1));
1249 printf("\n");
1250 */
1251 if (info > 0)
1252 {
1253 // ERROR("according to zgesv, matrix is singular");
1254 ret = false;
1255 }
1256 else if (info < 0)
1257 {
1258 ERROR("argument passed to zgesv had an illegal value");
1259 ret = false;
1260 }
1261
1262 freemem(permutation);
1263
1264 return ret;
1265}
void copy_complex_array(int n, const typename Field::element_type *a, typename Field::element_type *b)
Definition NAG.hpp:381
int zgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info)
void freemem(void *s)
Definition m2-mem.cpp:103
const int ERROR
Definition m2-mem.cpp:55
#define newarray_atomic(T, len)
Definition newdelete.hpp:91
volatile int x

References copy_complex_array(), ERROR, freemem(), newarray_atomic, x, and zgesv_().

Referenced by PathTracker::refine(), and PathTracker::track().