Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Q: dtrnlsp_init for initializing the solver of a nonlinear least squares problem.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Audrius_S_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2013
08:15 AM

108 Views

Q: dtrnlsp_init for initializing the solver of a nonlinear least squares problem.

Hello All,

We're replacing our current solver for a non-linear least squares problem without constraints with the MKL version.

First tried implementing it in a simple problem: F(x) : n = 6 → m = 1

Followed the example in ex_nlsqp_c_c.htm.

However, dtrnlsp_init returns TR_INVALID_OPTION instead of TR_SUCCESS.

After going through the code, still puzzled as to why given that this seems to be straightforward.

Any insight would be much appreciated.

__ System Config___

OS: Windows 7 x64

IDE: MS VS 2010 C++

Compiler: Intel Composer XE 2013 C++

MKL: 11.0.5

___Code fragment___

// Intel MKL

#include <mkl.h>

#include <mkl_rci.h>

#include <mkl_types.h>

#include <mkl_service.h>

. . .

double MyClass::SimpleTestMemberFunction

( std::array<double,_6D>& rtParameter )

{

int byteAlignment = 64;

// 1: Initialization

_TRNSP_HANDLE_t handle;

MKL_INT n = 6; // x has 6 d.o.f.

MKL_INT m = 1; // f(x): scalar function

double* rtPrmtrMKL = NULL;

double epsMKL[6]; // 6 precision stop-criteria array [see MKL manual for definitions]

MKL_INT nMaxIter = 1000;

MKL_INT nMaxTrialIter = 100;

double stepBound = 0.0;

MKL_INT taskStatus;

rtPrmtrMKL = static_cast<double*>(MKL_malloc( static_cast<size_t>(n) * sizeof(double), byteAlignment));

if (rtPrmtrMKL == NULL)

{

std::cout << "rtPrmtrMKL: mkl_malloc memory allocation failure " << std::endl;

return -1.0;

}

// Input parameter initialization

for (int i = 0; i != n; i++)

rtPrmtrMKL* = rtParameter ;*

// Initialize precisions for stop-criteria

for (int i = 0; i != 6; i++)

epsMKL* = 1.e-05;*

// Initialize the nonlinear least squares solver

taskStatus = dtrnlsp_init

( &handle

, &n // Number of function variables

, &m // Dimension of function value

, rtPrmtrMKL // Solution vector: contains values x for f(x)

, epsMKL // Precisions for stop-criteria [see manual for details]

, &nMaxIter // Maximum number of iterations

, &nMaxTrialIter // Maximum number of iterations of calculation of trial-step

, &stepBound ); // Initial step bound

if (taskStatus != TR_SUCCESS)

{

if (taskStatus == TR_INVALID_OPTION)

{

std::cout << "dtrnlsp_init: error in the input parameters; taskStatus = TR_INVALID_OPTION " << TR_INVALID_OPTION << std::endl;

mkl_free_buffers();

mkl_free( rtPrmtrMKL);

return -1.0;

}

else

if (taskStatus == TR_OUT_OF_MEMORY)

{

std::cout << "dtrnlsp_init: memory error" << std::endl;

mkl_free_buffers();

mkl_free( rtPrmtrMKL);

return -1.0;

}

}

Etc.

}

Link Copied

4 Replies

Zhang_Z_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-20-2013
11:07 AM

108 Views

MKL's trust-region solver solves nonlinear least square problems without boundary constraints defined as:

Note that m is larger than or equal to n. In your code, n = 6 and m = 1. This is the problem.

Audrius_S_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-03-2013
02:33 PM

108 Views

Realized this after posting ;-)

Thank you for your prompt answer.

Yoon__JAEGOON

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-30-2018
09:09 AM

108 Views

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-31-2018
02:00 AM

108 Views

The problem as described by you is ill-posed.

Consider the following counterexample:

x^{2} + y^{2} = 9

There are two variables, x and y, and one "data" point. What criterion would you use to certify a candidate point (x, y) as a "solution"?

Any point on the circle with center at the origin and radius = 3 satisfies the equation. How then, would you pick just one such point as "the solution"?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.