Linux kernel TICK_USEC calculation problem - linux-kernel

The calculation method of TICK_USEC in include/linux/jiffies.h is as follows #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ). I'm curious what USER_HZ/2 does? Can someone help me out?
I think USER_HZ/2 should have something unique, but I don't know

Related

Parameters for dlib::find_min_bobyqa

I'm working on the C++ version of Matt Zucker's Page dewarping. So far everything works fine, but I have a problem with optimization. In line 748 of Github repo Matt uses optimize function from Scipy. My C++ equivalent is find_min_bobyqa from dlib.net. The code is:
auto f = [&](const column_vector& ppts) { return objective( dstpoints, ppts, keypoint_index); };
dlib::find_min_bobyqa(f,
params,
2 * params.nr() + 1, // npt - number of interpolation points: x.size() + 2 <= npt && npt <= (x.size()+1)*(x.size()+2)/2
dlib::uniform_matrix<double>(params.nr(), 1, -2), // lower bound constraint
dlib::uniform_matrix<double>(params.nr(), 1, 2), // upper bound constraint
1, // initial trust region radius
1e-5, // stopping trust region radius
4000 // max number of objective function evaluations
);
In my concrete example params is a dlib::column_vector with double values and length = 189. Every element of params is less than 2.0 and greater than -2.0. Function objective() returns double value and "alone" it works properly because I get the same value as in the Python version. But after running fin_min_bobyqa function I usually get the message:
Terminate called after throwing an instance of 'dlib:bobyqa_failure', return from BOBYQA because the objective function has been called max_f_evals times.
I set max_f_evals to quite big value to see if it optimizes at all, but it doesn't. I did some tweaking with parameters but without good results. How should I set the parameters of find_min_bobyqa to get the right solution?
I am very interested in this issue as well. Zucker's work, with very minor tweaks, is ideal for straightening sheet music images, and I was looking for ways to implement it in a mobile platform when I came across your question.
My research so far suggests that BOBYQA is not the equivalent of Powell's method in scipy. BOBYQA is constrained, and the one in scipy is not.
See these links for more information, and a possible way to compile the right supporting library - I would try UOBYQA or NEWUOA.
https://github.com/jacobwilliams/PowellOpt
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#rdd2e1855725e-3
(See the Notes section)
EDIT: see C version here:
https://github.com/emmt/Algorithms/tree/master/newuoa
I wanted to post this as a comment, but I don't have enough points for that.
I am very interested in your progress. If you're willing, please keep me posted.
I finally solved this problem. I used PRAXIS library, because it doesn't need derivative information and is fast.
I modified the code a little to my needs and now it is faster around few seconds than original version written in Python.

Looking for or to create a logic of < or >

In AppInventor2 we drag logic down there is = , not = , and, or, but I can't seem to find the greater or less than logic. Can anyone enlighten me?
see the documentation of the math blocks in App Inventor 2

term does not evaluate to a function taking 1 arguments

Please have a look at the following OpenCV code
Mat *curent;
current = new Mat();
cv::Rect bRect = cv::boundingRect(Mat(*points).reshape(2));
Mat roi = *current(bRect);
Here, I am trying to get a ROI to the Mat called roi. But whenever I try to get execute the last line of the above code I get the error term does not evaluate to a function taking 1 arguments. I have followed the same technique of getting an ROI without pointers number of times before in C++ and they worked. I guess the issue is with pointer current ? current must be a pointer because local variable slowed the application in an unbelievable way.
So, how can I solve this issue and get the ROI ?
please, throw out those pointers!
you're going to wreck havoc on the internal Mat refcounts, produce undefined behaviour and memleaks
"local variable slowed the application in an unbelievable way."
really, you think, copying a 58 byte struct is the reason ? i just don't believe you.
well i'll give you a hint, anyway - the ( ) operator has a higher precedence than the * operator.

Please explain what this Syncsort code does?

The below code was in a proc which is included in my job under the DD name sort.controls.
This step was executed with the sort program, Syncsort. I can understand that the START in the below code indicates the starting position of the field used for sorting and LENGTH denotes the length of the field for sorting. But I can't understand what is ID TYPECODE=1. Can anyone please explain this?
ID TYPECODE=1,LRECL=00302,FORMAT=FB
CF1 START=00038,LENGTH=023
ID Type code 1 is system-specific. In my experience it normally means it's a disk file vs a cart or carddata or something but I'd have to know more about your environment.
LRECL is the defined length of the record for that file (302 bytes)
Format=FB means it is Fixed Block - the length is always 302 bytes and does not vary.
Hopefully that's helpful.

How do you print nicely in LEDA

How do you print 'nicely' in LEDA?
I am looking for the equivalent to
fixed
setprecision(3)
I have got a little further with this.
There is a difference between precision and output precision.
I can set LEDA's output precision with e.g bigfloat::set_output_precision(4);
but I still do not know what LEDA's equivalent to fixed is.
Also, I do not know what the latest LEDA of todouble is
I have tried mu.todouble() where mu is declared as a bigfloat, but I get a compiler error
A further answer is mu.to_double()

Resources