Friday, May 29, 2020

Digest for comp.lang.c++@googlegroups.com - 6 updates in 2 topics

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 29 01:43PM -0700

On 5/27/2020 3:26 AM, Alf P. Steinbach wrote:
>> Right how its only a 2-ary tree. It can be extended to n-ary. The code
>> is down right crude and very basic for now.
 
> Oh look, an efficient integral power function:
[...]
 
:^)
 
Fwiw, here is an expensive root finding algorihtm for complex numbers:
__________________________
ct_complex
ct_root(
ct_complex const& z,
unsigned int r,
unsigned int b
) {
double angle_base = std::arg(z) / b;
double angle_step = CT_PI2 / b;
 
double length = std::abs(z);
 
double angle = angle_base + angle_step * r;
double radius = std::pow(length, 1.0 / b);
 
ct_complex root(
std::cos(angle) * radius,
std::sin(angle) * radius
);
 
return root;
}
__________________________
 
r is the root to find in the base b.
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 30 12:02AM +0200

On 29.05.2020 22:43, Chris M. Thomasson wrote:
> }
> __________________________
 
> r is the root to find in the base b.
 
You can replace the expensive `pow` call with a fastish integral power
as shown (the code you snipped).
 
You can reduce the number of expensive calls to `cos` and `sin`
 
* by recognizing special bases like 2, 3 and 4 (possibly you're only
using a very few bases, in which case this covers all of it!),
* for the more general use cases, by returning a root generator object
rather than directly a complex, where the generator object internally
retains the first non-1 b'th root of 1, and calculates the various angle
roots as powers of that, times root of norm.
 
For the last point the idea is that where code now calls ct_root
repeatedly to obtain all the various angle roots, with b calls to `pow`,
`cos` and `sin, it can instead call ct_root_gen with just 1 call to
`pow`, `cos` and `sin`, to get a generator which it then can call
repeatedly to more fastishly get the b roots.
 
 
- Alf
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 30 12:07AM +0200

On 30.05.2020 00:02, Alf P. Steinbach wrote:
 
>> r is the root to find in the base b.
 
> You can replace the expensive `pow` call with a fastish integral power
> as shown (the code you snipped).
 
Oh wait, that's bollocks. What was I thinking. But possibly/likely there
is a corresponding way to calculate real roots fastishly.
 
- - -
 
This however holds:
 
> `cos` and `sin, it can instead call ct_root_gen with just 1 call to
> `pow`, `cos` and `sin`, to get a generator which it then can call
> repeatedly to more fastishly get the b roots.
 
- Alf
"Öö Tiib" <ootiib@hot.ee>: May 29 12:20AM -0700

On Friday, 29 May 2020 02:02:07 UTC+3, Cholo Lennon wrote:
> WTL, I left MFC behind... well, due to MS winding ideas about GUI
> programming (hello new WinUI, OMG another framework again!) I left
> Windows GUI programming, but this is another story.
 
The core issue is that human operator is slow. Most time consuming
part is when user has to navigate back-and forth in forest of
inconveniently designed GUI for to get some common use-case covered.
 
GUI is often designed inconveniently because actual nuances of
end-user needs get often lost or initially misunderstood by
programmer. What is self-evident for one is unclear to other.
 
In C++ code the GUI is tree of data members. The data members
of classes can be tricky, time-consuming and error-prone to rearrange.
It really does not matter if such data member is made using
inheritance or CRTP of its base class. In script-based GUI that
is way simpler and so it wins.
 
Therefore the winner seems to be entirely text-parsing-based
run-time binding like HTML. That is way less efficient than both
CRTP of WTL or run-time polymorphic base classes of MFC whose
differences do not matter at all.
Paavo Helde <eesnimi@osa.pri.ee>: May 29 10:43AM +0300

29.05.2020 01:25 Mr Flibble kirjutas:
 
>> You are right in that MFC is not C++. It is a C++ library.
 
> I am sure it wouldn't be too hard to find some C++ non-conformance in
> the MFC "bag of shite" given how crap the M$ C++ compiler is.
 
I'm sure it is not too hard to find some C++ non-conformance in any
medium or large C++ project.
 
In MFC there are some functions like CWnd::GetSafeHwnd() whose
functionality depends on whether this==nullptr. Any application relying
on this is non-conforming. I don't know if MFC itself relies on such
things internally or not.
 
BTW, MSVC was crap 20 years ago. Nowadays it has become pretty decent.
"Miguel Giménez" <me@privacy.net>: May 29 11:17AM +0200

El 28/05/2020 a las 6:41, Heitber Andres Montilla Ramirez escribió:
> ld.exe____cannot find -lwxzlibd
 
> i tried to add those in the linker settings but don't work.
> how i may solve this problem i'm using codeblocks 17.12 and wxwidgets 3.0.4
 
Read this link:
 
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
 
and then post the results in forums.codeblocks.org
 
My bet is you are trying to use debug libraries while you only have
release ones.
 
--
Saludos
Miguel Giménez
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: