Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/examples/heron/README.md
ViewVC logotype

View of /tests/examples/heron/README.md

Parent Directory Parent Directory | Revision Log Revision Log

Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 9 months ago) by glk
File size: 1950 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
This program finds square roots of numval reals between minval and maxval
using Heron's method (aka the Babylonion method)

Assuming the directions at https://github.com/Diderot-Language/examples
this program can be compiled and run with:

	../../vis12/bin/diderotc --exec heron.diderot

The output stores four numbers for each value processed (by index along fast axis):
<ol start=0>
<li> the value whose square root was found
<li> the computed square root
<li> the number of iterations taken to compute it
<li> the error, relative to Diderot's sqrt() function
To see the values (one set of 4 numbers per line):

	unu save -f text -i vrie.nrrd

The command-line executables produced by Diderot have hest-generated
usage infomation; try:

	./heron --help

to see how to set the input values and output filename stem.  Note
that the input variables self-document their purpose with ("...")
annotations, which are in turn included in the generated `--help`
usage information.  So the declarations:

	input real minval ("min value to find root of") = 1;
	input real maxval ("max value to find root of") = 100;
	input int numval ("how many values to compute") = 100;
	input real eps ("relative error convergence test") = 0.000001;

become in the usage information:

	-minval <val> = min value to find root of (double); default: "1.000000"
	-maxval <val> = max value to find root of (double); default: "100.000000"
	-numval <int> = how many values to compute (long int); default: "100"
	   -eps <val> = relative error convergence test (double); default: "0.000001"

Try experimenting with different values for eps; if it is set too low
the algorithm may not converge.  Compiling with:

	../../vis12/bin/diderotc --double --exec heron.diderot

makes "reals" into doubles, instead of the default single-precision
floats, which permits higher-accuracy results.

ViewVC Help
Powered by ViewVC 1.0.0