Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Eigen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
Eigen
Commits
95549007
Commit
95549007
authored
17 years ago
by
Benoit Jacob
Browse files
Options
Downloads
Patches
Plain Diff
* fix error in divergence test, now it is even faster
* add comments in render() in case anyone ever reads that :P
parent
a356ebd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demos/mandelbrot/mandelbrot.cpp
+7
-3
7 additions, 3 deletions
demos/mandelbrot/mandelbrot.cpp
with
7 additions
and
3 deletions
demos/mandelbrot/mandelbrot.cpp
+
7
−
3
View file @
95549007
...
...
@@ -51,10 +51,12 @@ template<typename Real> void MandelbrotThread::render(int img_width, int img_hei
Packet
pcr
,
pci
=
pci_start
,
pzr
,
pzi
=
pzi_start
,
pzr_buf
;
for
(
int
i
=
0
;
i
<
packetSize
;
i
++
)
pzr
[
i
]
=
pcr
[
i
]
=
start
.
x
()
+
(
x
+
i
)
*
step
.
x
();
// do the iterations. Every 4 iterations we check for divergence, in which case we can stop iterating.
// do the iterations. Every iters_before_test iterations we check for divergence,
// in which case we can stop iterating.
int
j
=
0
;
typedef
Eigen
::
Matrix
<
int
,
packetSize
,
1
>
Packeti
;
Packeti
pix_iter
=
Packeti
::
zero
(),
pix_dont_diverge
;
Packeti
pix_iter
=
Packeti
::
zero
(),
// number of iteration per pixel in the packet
pix_dont_diverge
;
// whether or not each pixel has already diverged
do
{
for
(
int
i
=
0
;
i
<
iters_before_test
/
4
;
i
++
)
// peel the inner loop by 4
...
...
@@ -67,7 +69,9 @@ template<typename Real> void MandelbrotThread::render(int img_width, int img_hei
}
pix_dont_diverge
=
(
pzr
.
cwiseAbs2
()
+
pzi
.
cwiseAbs2
())
.
eval
()
// temporary fix as what follows is not yet vectorized by Eigen
.
cwiseLessThan
(
Packet
::
constant
(
iters_before_test
))
.
cwiseLessThan
(
Packet
::
constant
(
4
))
// the 4 here is not a magic value, it's a math fact that if
// the square modulus is >4 then divergence is inevitable.
.
template
cast
<
int
>();
pix_iter
+=
iters_before_test
*
pix_dont_diverge
;
j
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment