|
|
|
@ -14,20 +14,15 @@ extern "C" { |
|
|
|
_MKL_DSS_HANDLE_t handle; |
|
|
|
dss_int error; |
|
|
|
|
|
|
|
dss_int opt = MKL_DSS_MSG_LVL_WARNING + MKL_DSS_TERM_LVL_ERROR + MKL_DSS_ZERO_BASED_INDEXING + MKL_DSS_AUTO_ORDER + MKL_DSS_SINGLE_PRECISION; |
|
|
|
if (systemType) opt += MKL_DSS_TRANSPOSE_SOLVE; // solve a transposed system, A'x = b
|
|
|
|
dss_int opt = MKL_DSS_MSG_LVL_WARNING + MKL_DSS_TERM_LVL_ERROR + MKL_DSS_ZERO_BASED_INDEXING + MKL_DSS_AUTO_ORDER; |
|
|
|
opt += systemType; |
|
|
|
|
|
|
|
// Initialize the solver
|
|
|
|
error = dss_create(handle, opt); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Define the non-zero structure of the matrix
|
|
|
|
dss_int sym = (matrixStructure == 0) |
|
|
|
? MKL_DSS_SYMMETRIC_STRUCTURE |
|
|
|
: (matrixStructure == 1) |
|
|
|
? MKL_DSS_SYMMETRIC |
|
|
|
: MKL_DSS_NON_SYMMETRIC; |
|
|
|
error = dss_define_structure(handle, sym, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
error = dss_define_structure(handle, matrixStructure, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Reorder the matrix
|
|
|
|
@ -35,10 +30,7 @@ extern "C" { |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Factor the matrix
|
|
|
|
dss_int type = (matrixType == 0) |
|
|
|
? MKL_DSS_POSITIVE_DEFINITE |
|
|
|
: MKL_DSS_INDEFINITE; |
|
|
|
error = dss_factor_real(handle, type, values); |
|
|
|
error = dss_factor_real(handle, matrixType, values); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Get the solution vector
|
|
|
|
@ -58,19 +50,14 @@ extern "C" { |
|
|
|
dss_int error; |
|
|
|
|
|
|
|
dss_int opt = MKL_DSS_MSG_LVL_WARNING + MKL_DSS_TERM_LVL_ERROR + MKL_DSS_ZERO_BASED_INDEXING + MKL_DSS_AUTO_ORDER; |
|
|
|
if (systemType) opt += MKL_DSS_TRANSPOSE_SOLVE; // solve a transposed system, A'x = b
|
|
|
|
opt += systemType; |
|
|
|
|
|
|
|
// Initialize the solver
|
|
|
|
error = dss_create(handle, opt); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Define the non-zero structure of the matrix
|
|
|
|
dss_int sym = (matrixStructure == 0) |
|
|
|
? MKL_DSS_SYMMETRIC_STRUCTURE |
|
|
|
: (matrixStructure == 1) |
|
|
|
? MKL_DSS_SYMMETRIC |
|
|
|
: MKL_DSS_NON_SYMMETRIC; |
|
|
|
error = dss_define_structure(handle, sym, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
error = dss_define_structure(handle, matrixStructure, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Reorder the matrix
|
|
|
|
@ -78,10 +65,7 @@ extern "C" { |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Factor the matrix
|
|
|
|
dss_int type = (matrixType == 0) |
|
|
|
? MKL_DSS_POSITIVE_DEFINITE |
|
|
|
: MKL_DSS_INDEFINITE; |
|
|
|
error = dss_factor_real(handle, type, values); |
|
|
|
error = dss_factor_real(handle, matrixType, values); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Get the solution vector
|
|
|
|
@ -100,21 +84,15 @@ extern "C" { |
|
|
|
_MKL_DSS_HANDLE_t handle; |
|
|
|
dss_int error; |
|
|
|
|
|
|
|
dss_int opt = MKL_DSS_MSG_LVL_WARNING + MKL_DSS_TERM_LVL_ERROR + MKL_DSS_ZERO_BASED_INDEXING + MKL_DSS_AUTO_ORDER + MKL_DSS_SINGLE_PRECISION; |
|
|
|
if (systemType == 1) opt += MKL_DSS_CONJUGATE_SOLVE; // solve a conjugate transposed system, A¢Óx = b
|
|
|
|
else if(systemType == 2) opt += MKL_DSS_TRANSPOSE_SOLVE; // solve a transposed system, A'x = b
|
|
|
|
dss_int opt = MKL_DSS_MSG_LVL_WARNING + MKL_DSS_TERM_LVL_ERROR + MKL_DSS_ZERO_BASED_INDEXING + MKL_DSS_AUTO_ORDER; |
|
|
|
opt += systemType; |
|
|
|
|
|
|
|
// Initialize the solver
|
|
|
|
error = dss_create(handle, opt); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Define the non-zero structure of the matrix
|
|
|
|
dss_int sym = (matrixStructure == 0) |
|
|
|
? MKL_DSS_SYMMETRIC_STRUCTURE_COMPLEX |
|
|
|
: (matrixStructure == 1) |
|
|
|
? MKL_DSS_SYMMETRIC_COMPLEX |
|
|
|
: MKL_DSS_NON_SYMMETRIC_COMPLEX; |
|
|
|
error = dss_define_structure(handle, sym, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
error = dss_define_structure(handle, matrixStructure, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Reorder the matrix
|
|
|
|
@ -122,14 +100,7 @@ extern "C" { |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Factor the matrix
|
|
|
|
dss_int type = (matrixType == 0) |
|
|
|
? MKL_DSS_POSITIVE_DEFINITE |
|
|
|
: (matrixType == 1) |
|
|
|
? MKL_DSS_INDEFINITE |
|
|
|
: (matrixType == 2) |
|
|
|
? MKL_DSS_HERMITIAN_POSITIVE_DEFINITE |
|
|
|
: MKL_DSS_HERMITIAN_INDEFINITE; |
|
|
|
error = dss_factor_complex(handle, type, values); |
|
|
|
error = dss_factor_complex(handle, matrixType, values); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Get the solution vector
|
|
|
|
@ -149,20 +120,14 @@ extern "C" { |
|
|
|
dss_int error; |
|
|
|
|
|
|
|
dss_int opt = MKL_DSS_MSG_LVL_WARNING + MKL_DSS_TERM_LVL_ERROR + MKL_DSS_ZERO_BASED_INDEXING + MKL_DSS_AUTO_ORDER; |
|
|
|
if (systemType == 1) opt += MKL_DSS_CONJUGATE_SOLVE; // solve a conjugate transposed system, A¢Óx = b
|
|
|
|
else if (systemType == 2) opt += MKL_DSS_TRANSPOSE_SOLVE; // solve a transposed system, A'x = b
|
|
|
|
opt += systemType; |
|
|
|
|
|
|
|
// Initialize the solver
|
|
|
|
error = dss_create(handle, opt); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Define the non-zero structure of the matrix
|
|
|
|
dss_int sym = (matrixStructure == 0) |
|
|
|
? MKL_DSS_SYMMETRIC_STRUCTURE_COMPLEX |
|
|
|
: (matrixStructure == 1) |
|
|
|
? MKL_DSS_SYMMETRIC_COMPLEX |
|
|
|
: MKL_DSS_NON_SYMMETRIC_COMPLEX; |
|
|
|
error = dss_define_structure(handle, sym, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
error = dss_define_structure(handle, matrixStructure, rowIdx, nRows, nCols, colPtr, nnz); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Reorder the matrix
|
|
|
|
@ -170,14 +135,7 @@ extern "C" { |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Factor the matrix
|
|
|
|
dss_int type = (matrixType == 0) |
|
|
|
? MKL_DSS_POSITIVE_DEFINITE |
|
|
|
: (matrixType == 1) |
|
|
|
? MKL_DSS_INDEFINITE |
|
|
|
: (matrixType == 2) |
|
|
|
? MKL_DSS_HERMITIAN_POSITIVE_DEFINITE |
|
|
|
: MKL_DSS_HERMITIAN_INDEFINITE; |
|
|
|
error = dss_factor_complex(handle, type, values); |
|
|
|
error = dss_factor_complex(handle, matrixType, values); |
|
|
|
if (error != MKL_DSS_SUCCESS) return error; |
|
|
|
|
|
|
|
// Get the solution vector
|
|
|
|
|