├── .appveyor.yml ├── .github └── workflows │ └── main.yml ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── COPYING.LESSER ├── COPYRIGHT ├── ChangeLog ├── ChangeLog.0 ├── ChangeLog.1 ├── ChangeLog.2 ├── INSTALL ├── LEGAL ├── LICENSE ├── NEWS ├── README-VS.NET.txt ├── README.md ├── benchmarks ├── CMakeLists.txt ├── acou3d.cpp ├── acou3db1.cpp ├── acou3db2.cpp ├── acou3db3.cpp ├── acou3db4.cpp ├── acou3df.f ├── acou3df2.f ├── acou3df90.f90 ├── acou3df902.f90 ├── acoustic.cpp ├── acousticf.f ├── acousticf2.f ├── acousticf90.f90 ├── acousticf902.f90 ├── arrdaxpy.cpp ├── arrdaxpyf.f ├── arrexpr1.cpp ├── arrexpr1.m ├── cfd.cpp ├── cfdf.f ├── cfortran.h ├── chunky.cpp ├── compiletime.cpp ├── ctime-results ├── ctime1.cpp ├── ctime1v.cpp ├── ctime2.cpp ├── ctime2v.cpp ├── ctime3.cpp ├── ctime3v.cpp ├── ctime4.cpp ├── ctime4v.cpp ├── ctime5.cpp ├── ctime5c.cpp ├── ctime5v.cpp ├── daxpy.cpp ├── daxpy2.cpp ├── daxpyf90-2.f90 ├── daxpyf90.f90 ├── dot.cpp ├── dot2.cpp ├── echof2-back.f ├── echotune.cpp ├── echotune.m ├── echotunef.f ├── fdaxpy.f ├── fidaxpy.f ├── floop1.cpp ├── floop10.cpp ├── floop10f.f ├── floop10f90.f90 ├── floop11.cpp ├── floop11f.f ├── floop11f90.f90 ├── floop12.cpp ├── floop12f.f ├── floop12f90.f90 ├── floop13.cpp ├── floop13f.f ├── floop13f90.f90 ├── floop14.cpp ├── floop14f.f ├── floop14f90.f90 ├── floop15.cpp ├── floop15f.f ├── floop15f90.f90 ├── floop16.cpp ├── floop16f.f ├── floop16f90.f90 ├── floop17.cpp ├── floop17f.f ├── floop17f90.f90 ├── floop18.cpp ├── floop18f.f ├── floop18f90.f90 ├── floop19.cpp ├── floop19f.f ├── floop19f90.f90 ├── floop1f.f ├── floop1f90.f90 ├── floop2.cpp ├── floop21.cpp ├── floop21f.f ├── floop21f90.f90 ├── floop22.cpp ├── floop22f.f ├── floop22f90.f90 ├── floop23.cpp ├── floop23f.f ├── floop23f90.f90 ├── floop24.cpp ├── floop24f.f ├── floop24f90.f90 ├── floop25.cpp ├── floop25f.f ├── floop25f90.f90 ├── floop2f.f ├── floop2f90.f90 ├── floop3.cpp ├── floop36.cpp ├── floop36f.f ├── floop36f90.f90 ├── floop3f.f ├── floop3f90.f90 ├── floop5.cpp ├── floop5f.f ├── floop5f90.f90 ├── floop6.cpp ├── floop6f.f ├── floop6f90.f90 ├── floop8.cpp ├── floop8f.f ├── floop8f90.f90 ├── floop9.cpp ├── floop9f.f ├── floop9f90.f90 ├── frek.m ├── haney.cpp ├── haneyf.f ├── hao-he-mark.cpp ├── hao-he.cpp ├── iter.cpp ├── kepler.cpp ├── loop1-bug.cpp ├── loop1.cpp ├── loop10.cpp ├── loop100.cpp ├── loop100f.f ├── loop100f90.f90 ├── loop10f.f ├── loop10f90.f90 ├── loop11.cpp ├── loop11f.f ├── loop11f90.f90 ├── loop12.cpp ├── loop12f.f ├── loop12f90.f90 ├── loop13.cpp ├── loop13f.f ├── loop13f90.f90 ├── loop14.cpp ├── loop14f.f ├── loop14f90.f90 ├── loop15.cpp ├── loop15f.f ├── loop15f90.f90 ├── loop16.cpp ├── loop16f.f ├── loop16f90.f90 ├── loop17.cpp ├── loop17f.f ├── loop17f90.f90 ├── loop18.cpp ├── loop18f.f ├── loop18f90.f90 ├── loop19.cpp ├── loop19f.f ├── loop19f90.f90 ├── loop1f.f ├── loop1f90.f90 ├── loop2.cpp ├── loop21.cpp ├── loop21f.f ├── loop21f90.f90 ├── loop22.cpp ├── loop22f.f ├── loop22f90.f90 ├── loop23.cpp ├── loop23f.f ├── loop23f90.f90 ├── loop24.cpp ├── loop24f.f ├── loop24f90.f90 ├── loop25.cpp ├── loop25f.f ├── loop25f90.f90 ├── loop2f.f ├── loop2f90.f90 ├── loop3.cpp ├── loop36.cpp ├── loop36f.f ├── loop36f90.f90 ├── loop3f.f ├── loop3f90.f90 ├── loop4.cpp ├── loop4f.f ├── loop4f90.f90 ├── loop5.cpp ├── loop5f.f ├── loop5f90.f90 ├── loop6.cpp ├── loop6f.f ├── loop6f90.f90 ├── loop8.cpp ├── loop8f.f ├── loop8f90.f90 ├── loop9.cpp ├── loop9f.f ├── loop9f90.f90 ├── loops.data ├── loopstruct.cpp ├── looptest.cpp ├── makelogo.cpp ├── makeloops.cpp ├── plot_benchmarks.m.in ├── qcd.cpp ├── qcd.txt ├── qcdf.f ├── quinlan.cpp ├── stencil.cpp ├── stencilf.f ├── stencilf2.f ├── stencilf90.f90 ├── stenciln.cpp ├── tiny3.cpp └── tinydaxpy.cpp ├── blitz ├── CMakeLists.txt ├── README ├── array-impl.h ├── array.cc ├── array.h ├── array │ ├── CMakeLists.txt │ ├── asexpr.cc │ ├── asexpr.h │ ├── cartesian.h │ ├── cgsolve.h │ ├── complex.cc │ ├── convolve.cc │ ├── convolve.h │ ├── cycle.cc │ ├── domain.h │ ├── et.h │ ├── expr.cc │ ├── expr.h │ ├── fastiter.h │ ├── funcs.h │ ├── functorExpr.h │ ├── geometry.h │ ├── indirect.h │ ├── interlace.cc │ ├── io.cc │ ├── iter.h │ ├── map.h │ ├── methods.cc │ ├── misc.cc │ ├── multi.h │ ├── newet-macros.h │ ├── newet.h │ ├── ops.cc │ ├── ops.h │ ├── reduce.cc │ ├── reduce.h │ ├── resize.cc │ ├── shape.h │ ├── slice.h │ ├── slicing.cc │ ├── stencil-et-macros.h │ ├── stencil-et.h │ ├── stencilops.h │ ├── stencils.cc │ ├── stencils.h │ ├── storage.h │ ├── where.h │ └── zip.h ├── bench.cc ├── bench.h ├── benchext.cc ├── benchext.h ├── blitz.h ├── bounds.h ├── bzconfig.h ├── bzdebug.h ├── compiler.h ├── config.cmake.h.in ├── constpointerstack.h ├── et-forward.h ├── etbase.h ├── funcs.h ├── generate │ ├── CMakeLists.txt │ ├── arroperands.h │ ├── arroptuple.h │ ├── bzfstream.h │ ├── genarrbops.cpp │ ├── genarruops.cpp │ ├── genmatbops.cpp │ ├── genmathfunc.cpp │ ├── genmatuops.cpp │ ├── genpromote.cpp │ ├── genstencils.py │ ├── genvecbfn.cpp │ ├── genvecbops.cpp │ ├── genvecuops.cpp │ ├── genvecwhere.cpp │ ├── makeloops.py │ ├── operands.h │ ├── operands2.h │ ├── optuple.h │ └── optuple2.h ├── globeval.cc ├── indexexpr.h ├── indexmap-forward.h ├── levicivita.h ├── limits-hack.h ├── listinit.h ├── memblock.cc ├── memblock.h ├── meta │ ├── CMakeLists.txt │ ├── dot.h │ ├── matassign.h │ ├── matmat.h │ ├── matvec.h │ ├── metaprog.h │ ├── product.h │ ├── sum.h │ └── vecassign.h ├── minmax.h ├── numinquire.h ├── numtrait.h ├── ops.h ├── prettyprint.h ├── promote.h ├── range.cc ├── range.h ├── ranks.h ├── reduce.h ├── shapecheck.h ├── simdtypes.h ├── tau.h ├── timer.h ├── tinymat2.cc ├── tinymat2.h ├── tinymat2io.cc ├── tinyvec.cc ├── tinyvec2.cc ├── tinyvec2.h ├── tinyvec2io.cc ├── tm2fastiter.h ├── tmevaluate.h ├── traversal.cc ├── traversal.h ├── tuning.h ├── tv2assign.h ├── tv2fastiter.h ├── tvcross.h ├── tvecglobs.h ├── tvevaluate.h ├── types.h ├── update.h ├── vector2.h └── wrap-climits.h ├── cmake ├── BlitzConfigFileName.cmake ├── CheckCXXFeatures.cmake ├── CreatePkgConfig.cmake ├── GenerateConfigFile.cmake ├── UnitTests.cmake ├── Win32Compat.cmake ├── XXXConfig.cmake.in ├── XXXConfigVersion.cmake.in ├── blitzConfig.cmake.in └── cxx_tests │ ├── alignment_directive_gcc.cpp │ ├── alignment_directive_win.cpp │ ├── bool.cpp │ ├── compile_stdcxx_0x.cpp │ ├── compiler_vendor.cpp │ ├── complex_math_in_namespace_std.cpp │ ├── const_cast.cpp │ ├── cppflags_std_lang.cpp │ ├── cxxflags_std_lang.cpp │ ├── default_template_parameters.cpp │ ├── dtor_after_atexit.cpp │ ├── dynamic_cast.cpp │ ├── enum_computations.cpp │ ├── enum_computations_with_cast.cpp │ ├── exceptions.cpp │ ├── explicit.cpp │ ├── explicit_instantiations.cpp │ ├── explicit_template_function_qualification.cpp │ ├── extern_template.cpp │ ├── full_specialization_syntax.cpp │ ├── function_nontype_parameters.cpp │ ├── gnucxx_hashmap.cpp │ ├── have_climits.cpp │ ├── have_complex.cpp │ ├── have_complex_fcns.cpp │ ├── have_complex_math1.cpp │ ├── have_complex_math2.cpp │ ├── have_empty_iostream.cpp │ ├── have_ext_hash_map.cpp │ ├── have_ext_hash_set.cpp │ ├── have_ext_slist.cpp │ ├── have_freeze_sstream.cpp │ ├── have_ieee_math.cpp │ ├── have_long_long_for_iostream.cpp │ ├── have_numeric_limits.cpp │ ├── have_rusage.cpp │ ├── have_sstream.cpp │ ├── have_std.cpp │ ├── have_stl.cpp │ ├── have_string_push_back.cpp │ ├── have_system_v_math.cpp │ ├── have_valarray.cpp │ ├── have_vector_at.cpp │ ├── header_pre_stdcxx.cpp │ ├── header_stdcxx_0x.cpp │ ├── header_stdcxx_98.cpp │ ├── header_stdcxx_tr1.cpp │ ├── header_tr1_unordered_map.cpp │ ├── header_tr1_unordered_set.cpp │ ├── header_unordered_map.cpp │ ├── header_unordered_set.cpp │ ├── isnan_in_namespace_std.cpp │ ├── isnormal_in_namespace_std.cpp │ ├── ldflags_std_lang.cpp │ ├── math_absint_in_namespace_std.cpp │ ├── math_fn_in_namespace_std.cpp │ ├── member_constants.cpp │ ├── member_templates.cpp │ ├── member_templates_outside_class.cpp │ ├── mutable.cpp │ ├── namespace_std.cpp │ ├── nceg_restrict.cpp │ ├── new_for_scoping.cpp │ ├── old_for_scoping.cpp │ ├── partial_ordering.cpp │ ├── partial_specialization.cpp │ ├── reinterpret_cast.cpp │ ├── restrict_egcs.cpp │ ├── rtti.cpp │ ├── static_cast.cpp │ ├── stlport_hashmap.cpp │ ├── template_keyword_qualifier.cpp │ ├── template_qualified_base_class.cpp │ ├── template_qualified_return_type.cpp │ ├── template_scoped_argument_matching.cpp │ ├── templates.cpp │ ├── templates_as_template_arguments.cpp │ ├── type_promotion.cpp │ ├── typename.cpp │ ├── use_numtrait.cpp │ └── verbose_terminate_handler.cpp ├── compiler ├── LEGAL ├── README ├── bool.cpp ├── bzconfig ├── climits.cpp ├── cmthscop.cpp ├── complex.cpp ├── compmath.cpp ├── constcst.cpp ├── cstd.cpp ├── default.cpp ├── dynamic.cpp ├── elabbase.cpp ├── elabret.cpp ├── enumcmp2.cpp ├── enumcomp.cpp ├── except.cpp ├── explicit.cpp ├── fullspec.cpp ├── getruse.cpp ├── ieeemath.cpp ├── instant.cpp ├── mathscop.cpp ├── membcnst.cpp ├── membtmp2.cpp ├── membtmpl.cpp ├── mutable.cpp ├── namespac.cpp ├── nontype.cpp ├── numlimit.cpp ├── numtrait.cpp ├── oldfor.cpp ├── partial.cpp ├── porder.cpp ├── promote.cpp ├── reinterp.cpp ├── restric2.cpp ├── restrict.cpp ├── rtti.cpp ├── statcast.cpp ├── std.cpp ├── stl.cpp ├── sysvmath.cpp ├── tempkey.cpp ├── template.cpp ├── tempqmt.cpp ├── tempqual.cpp ├── temptemp.cpp ├── typename.cpp ├── vac.icc └── valarray.cpp ├── doc ├── CMakeLists.txt ├── about.texi ├── arrays-ctors.texi ├── arrays-debug.texi ├── arrays-expr.texi ├── arrays-globals.texi ├── arrays-indirect.texi ├── arrays-intro.texi ├── arrays-io.texi ├── arrays-members.texi ├── arrays-multi.texi ├── arrays-slicing.texi ├── arrays-stencils.texi ├── arrays-storage.texi ├── arrays-types.texi ├── arrays-usertype.texi ├── blitz.gif ├── blitz.texi ├── blitztiny.jpg ├── compiling.texi ├── constants.texi ├── copyright.texi ├── download.texi ├── doxygen │ ├── CMakeLists.txt │ └── Doxyfile.in ├── examples │ ├── CMakeLists.txt │ ├── cast.cpp │ ├── debug.cpp │ ├── dump.cpp │ ├── fixed-class.cpp │ ├── fixed-point.h │ ├── fixed.cpp │ ├── io.cpp │ ├── io.data │ ├── makefile.example │ ├── outer.cpp │ ├── output.cpp │ ├── range.cpp │ ├── simple.cpp │ ├── slicing.cpp │ ├── storage.cpp │ ├── strideslice.cpp │ └── xor.cpp ├── faq.texi ├── help.texi ├── indirect.eps ├── indirect.fig ├── indirect.gif ├── indirect.pdf ├── indirect.txt ├── install.texi ├── legal.texi ├── makedatestring ├── numinquire.texi ├── parallel.texi ├── platforms.texi ├── random.texi ├── sinsoid.eps ├── sinsoid.gif ├── sinsoid.pdf ├── sinsoid.txt ├── slice.eps ├── slice.fig ├── slice.gif ├── slice.pdf ├── slice.txt ├── stamp-vti ├── stencils │ ├── CMakeLists.txt │ ├── ParseArguments.cmake │ └── dump-stencil.cpp ├── strideslice.eps ├── strideslice.fig ├── strideslice.gif ├── strideslice.pdf ├── strideslice.txt ├── tau.texi ├── tensor1.eps ├── tensor1.fig ├── tensor1.gif ├── tensor1.pdf ├── tensor1.txt ├── tinymatrix.texi ├── tinyvector.texi ├── tuning.texi └── version.texi ├── examples ├── CMakeLists.txt ├── array.cpp ├── cartesian.cpp ├── cast.cpp ├── cfd.cpp ├── complex-test.cpp ├── convolve.cpp ├── curldiv.cpp ├── deriv.cpp ├── diff.cpp ├── erf.cpp ├── fixed.cpp ├── indirect.cpp ├── io.cpp ├── iter.cpp ├── matmult.cpp ├── nested.cpp ├── numinquire.cpp ├── outer.cpp ├── pauli.cpp ├── pick.cpp ├── polymorph.cpp ├── prettyprint.cpp ├── profile.cpp ├── qcd.cpp ├── rand2.cpp ├── random.cpp ├── rangexpr.cpp ├── reduce.cpp ├── simple.cpp ├── slicing.cpp ├── stencil.cpp ├── stencil2.cpp ├── stencil3.cpp ├── stencil4.f ├── stencilet.cpp ├── storage.cpp ├── tiny.cpp ├── tiny2.cpp ├── tiny3.cpp ├── transform.cpp ├── useret.cpp ├── where.cpp └── whitt.cpp ├── linalg ├── V.txt ├── Z.txt ├── gmres.cpp ├── gmres.h └── myIterative.py ├── manual ├── Frames.html ├── Index-epilogue.html ├── Index-prologue.html ├── README ├── TOCINDEX.html ├── _Index.html ├── arrays-ctors.yo ├── arrays-debug.yo ├── arrays-expr.yo ├── arrays-globals.yo ├── arrays-indirect.yo ├── arrays-intro.yo ├── arrays-io.yo ├── arrays-members.yo ├── arrays-multi.yo ├── arrays-slicing.yo ├── arrays-stencils.yo ├── arrays-storage.yo ├── arrays-types.yo ├── arrays-usertype.yo ├── blitz.gif ├── blitz.html ├── blitz.ps ├── blitz.yo ├── blitz01.html ├── blitz02.html ├── blitz03.html ├── blitz04.html ├── blitz05.html ├── blitz06.html ├── blitz07.html ├── blitz08.html ├── blitz09.html ├── blitz10.html ├── blitzmacros.yo ├── blitztiny.jpg ├── classref.html ├── compiling.yo ├── constants.yo ├── download.yo ├── examples │ ├── cast.cpp │ ├── debug.cpp │ ├── dump.cpp │ ├── fixed.cpp │ ├── outer.cpp │ ├── outer.log │ ├── output.cpp │ ├── output.log │ ├── range.cpp │ ├── simple.cpp │ ├── simple.log │ ├── slicing.cpp │ ├── storage.cpp │ ├── storage.log │ ├── strideslice.cpp │ └── xor.cpp ├── faq.yo ├── help.yo ├── index.html ├── index.m4 ├── indirect.eps ├── indirect.fig ├── indirect.gif ├── install.yo ├── legal.yo ├── makeHTMLIndex.cpp ├── makedatestring ├── makeindex ├── numinquire.yo ├── parallel.yo ├── platforms.yo ├── preview ├── proc2e.sty ├── random.yo ├── range.html ├── sinsoid.eps ├── sinsoid.gif ├── slice.eps ├── slice.fig ├── slice.gif ├── stencils │ ├── Laplacian2D.yo │ ├── Laplacian2D4.yo │ ├── backward11.yo │ ├── backward12.yo │ ├── backward21.yo │ ├── backward22.yo │ ├── backward31.yo │ ├── backward32.yo │ ├── backward41.yo │ ├── backward42.yo │ ├── central12.yo │ ├── central14.yo │ ├── central22.yo │ ├── central24.yo │ ├── central32.yo │ ├── central34.yo │ ├── central42.yo │ ├── central44.yo │ ├── dump-stencil.cpp │ ├── dump1D │ ├── dumpdiffs │ ├── dumpst │ ├── forward11.yo │ ├── forward12.yo │ ├── forward21.yo │ ├── forward22.yo │ ├── forward31.yo │ ├── forward32.yo │ ├── forward41.yo │ └── forward42.yo ├── strideslice.eps ├── strideslice.fig ├── strideslice.gif ├── tau.yo ├── tensor1.eps ├── tensor1.fig ├── tensor1.gif ├── tinymatrix.yo ├── tinyvector.yo ├── tuning.yo ├── update └── vector.html ├── random ├── CMakeLists.txt ├── F.h ├── beta.h ├── chisquare.h ├── default.h ├── discrete-uniform.h ├── exponential.h ├── gamma.h ├── mt.h ├── mtparam.cc ├── normal.h └── uniform.h ├── src ├── CMakeLists.txt └── globals.cpp ├── testsuite ├── 64bit.cpp ├── Adnene-Ben-Abdallah-1.cpp ├── Adnene-Ben-Abdallah-2.cpp ├── CMakeLists.txt ├── Josef-Wagenhuber.cpp ├── Olaf-Ronneberger-1.cpp ├── Ulisses-Mello-1.cpp ├── alignment.cpp ├── arrayinitialize.cpp ├── arrayresize.cpp ├── bitwise.cpp ├── cast.cpp ├── chris-jeffery-1.cpp ├── chris-jeffery-2.cpp ├── chris-jeffery-3.cpp ├── complex-test.cpp ├── constarray.cpp ├── contiguous.cpp ├── copy.cpp ├── ctors.cpp ├── declfunc.cpp ├── derrick-bass-1.cpp ├── derrick-bass-3.cpp ├── exprctor.cpp ├── expression-slicing.cpp ├── extract.cpp ├── free.cpp ├── gary-huber-1.cpp ├── indexexpr-base.cpp ├── initialize.cpp ├── int-math-func.cpp ├── interlace.cpp ├── iter.cpp ├── levicivita.cpp ├── loop1.cpp ├── matthias-troyer-1.cpp ├── matthias-troyer-2.cpp ├── mattias-lindstroem-1.cpp ├── member_function.cpp ├── minmax.cpp ├── minsumpow.cpp ├── module1.cpp ├── module2.cpp ├── multicomponent-2.cpp ├── multicomponent.cpp ├── newet.cpp ├── patrik-jonsson-1.cpp ├── peter-bienstman-1.cpp ├── peter-bienstman-2.cpp ├── peter-bienstman-3.cpp ├── peter-bienstman-4.cpp ├── peter-bienstman-5.cpp ├── peter-nordlund-1.cpp ├── peter-nordlund-2.cpp ├── peter-nordlund-3.cpp ├── preexisting.cpp ├── promote.cpp ├── pthread.cpp ├── qcd.cpp ├── reduce.cpp ├── reindex.cpp ├── reverse.cpp ├── safeToReturn.cpp ├── serialize.cpp ├── shape.cpp ├── shapecheck.cpp ├── slice-iterators.cpp ├── stencil-et.cpp ├── stencil-extent.cpp ├── storage.cpp ├── strided-domain.cpp ├── stub.cpp ├── testsuite.h ├── theodore-papadopoulo-1.cpp ├── tinymat.cpp ├── tinyvec.cpp ├── transpose.cpp ├── troyer-genilloud.cpp ├── tvinitialize.cpp ├── update.cpp ├── vectorization.cpp ├── weakref.cpp ├── wei-ku-1.cpp ├── where.cpp └── zeek-1.cpp └── travis-ci └── check-wiki-examples.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Blitz was originally written by Todd Veldhuizen 2 | -------------------------------------------------------------------------------- /LEGAL: -------------------------------------------------------------------------------- 1 | The Blitz++ library is licensed under the Lesser GPL version 3 license, 2 | the BSD license, and the more permissive Perl Artistic License version 2.0. 3 | Please use Blitz++ under the license that best suits the needs of your project. 4 | The licenses are detailed in COPYING and COPYING.LESSER (LGPLv3), COPYRIGHT 5 | (BSD), and LICENSE (PAL 2.0), respectively. The Perl Artistic License is 6 | probably more appropriate for commercial use, since it lacks the "viral" 7 | properties of the LGPL. 8 | 9 | 10 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 2 | ** Blitz-0.10 3 | 4 | Released June 27, 2012 5 | 6 | This is an AS-IS snapshot release of the current state of the blitz mercurial 7 | source code development repository. Besides numerous bug fixes since the 8 | Blitz-0.9 release back in 2005, development work has been done in an effort 9 | to improve performance, 64-bit compatibility, and thread safety, and to take 10 | advantage of SIMD instructions by utilizing careful data alignment. Most of 11 | these upgrades are not well documented as of yet, and are only apparent via 12 | some new configure script options. 13 | 14 | -------------------------------------------------------------------------------- /README-VS.NET.txt: -------------------------------------------------------------------------------- 1 | The Blitz configuration file and Microsoft Visual Studio solution files 2 | can be generated with CMake. 3 | -------------------------------------------------------------------------------- /benchmarks/acou3db1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | void setupInitialConditions(Array& P1, Array& P2, 6 | Array& P3, Array& c, int N); 7 | 8 | float acoustic3D_BlitzRaw(int N, int niters) 9 | { 10 | // Allocate the arrays as a group. Blitz++ will interlace them in 11 | // memory, improving data locality. 12 | 13 | Array P1(N,N,N), P2(N,N,N), P3(N,N,N), c(N,N,N); 14 | Range I(1,N-2), J(1,N-2), K(1,N-2); 15 | 16 | setupInitialConditions(P1, P2, P3, c, N); 17 | 18 | for (int iter=0; iter < niters; ++iter) 19 | { 20 | P3(I,J,K) = (2-6*c(I,J,K)) * P2(I,J,K) 21 | + c(I,J,K)*(P2(I-1,J,K) + P2(I+1,J,K) + P2(I,J-1,K) + P2(I,J+1,K) 22 | + P2(I,J,K-1) + P2(I,J,K+1)) - P1(I,J,K); 23 | 24 | P1 = P2; 25 | P2 = P3; 26 | } 27 | 28 | return P1(N/2,N/2,N/2); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /benchmarks/acou3db3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | void setupInitialConditions(Array& P1, Array& P2, 6 | Array& P3, Array& c, int N); 7 | 8 | float acoustic3D_BlitzCycled(int N, int niters) 9 | { 10 | Array P1(N,N,N), P2(N,N,N), P3(N,N,N), c(N,N,N); 11 | Range I(1,N-2), J(1,N-2), K(1,N-2); 12 | 13 | setupInitialConditions(P1, P2, P3, c, N); 14 | 15 | for (int iter=0; iter < niters; ++iter) 16 | { 17 | P3(I,J,K) = (2-6*c(I,J,K)) * P2(I,J,K) 18 | + c(I,J,K)*(P2(I-1,J,K) + P2(I+1,J,K) + P2(I,J-1,K) + P2(I,J+1,K) 19 | + P2(I,J,K-1) + P2(I,J,K+1)) - P1(I,J,K); 20 | 21 | cycleArrays(P1, P2, P3); 22 | } 23 | 24 | return P1(N/2,N/2,N/2); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /benchmarks/acou3db4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | void setupInitialConditions(Array& P1, Array& P2, 7 | Array& P3, Array& c, int N); 8 | 9 | BZ_DECLARE_STENCIL4(acoustic3D, P1, P2, P3, c) 10 | P3 = 2 * P2 + c * Laplacian3D_stencilop(P2) - P1; 11 | BZ_END_STENCIL 12 | 13 | float acoustic3D_BlitzStencil(int N, int niters) 14 | { 15 | Array P1, P2, P3, c; 16 | allocateArrays(shape(N,N,N), P1, P2, P3, c); 17 | 18 | setupInitialConditions(P1, P2, P3, c, N); 19 | 20 | for (int iter=0; iter < niters; ++iter) 21 | { 22 | applyStencil(acoustic3D(), P1, P2, P3, c); 23 | cycleArrays(P1, P2, P3); 24 | } 25 | 26 | return P1(N/2,N/2,N/2); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /benchmarks/arrdaxpyf.f: -------------------------------------------------------------------------------- 1 | subroutine arrdaxpyf(A, B, N, c1) 2 | integer N, iters 3 | double precision A(N,N,N), B(N,N,N) 4 | double precision c1 5 | double precision c2 6 | c2 = - c1 7 | 8 | do k=2,N-1 9 | do j=2,N-1 10 | do i=2,N-1 11 | A(i,j,k) = A(i,j,k) + c1 * B(i,j,k); 12 | enddo 13 | enddo 14 | enddo 15 | 16 | do k=2,N-1 17 | do j=2,N-1 18 | do i=2,N-1 19 | A(i,j,k) = A(i,j,k) + c2 * B(i,j,k); 20 | enddo 21 | enddo 22 | enddo 23 | 24 | return 25 | end 26 | 27 | -------------------------------------------------------------------------------- /benchmarks/compiletime.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/benchmarks/compiletime.cpp -------------------------------------------------------------------------------- /benchmarks/ctime1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /benchmarks/ctime1v.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /benchmarks/ctime2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | void foo() 10 | { 11 | const int N = 10; 12 | Array A(N), B(N), C(N), D(N), E(N); 13 | A = B*C + D*E; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /benchmarks/ctime2v.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | void foo() 10 | { 11 | const int N = 10; 12 | valarray A(N), B(N), C(N), D(N), E(N); 13 | A = B*C + D*E; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /benchmarks/ctime3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | void foo() 10 | { 11 | const int N = 10; 12 | Array A(N), B(N), C(N), D(N), E(N); 13 | A = B*C + D*E; 14 | A = B+C + D*cos(E); 15 | A = B*sin(C) + D*sin(E); 16 | B = C + D; 17 | A = A+B+C+D; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /benchmarks/ctime3v.cpp: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__GNUC__) && (__GNUC__ < 3) 3 | #ifdef BZ_HAVE_STD 4 | #include 5 | #else 6 | #include 7 | #endif 8 | inline float cos(float x) { return static_cast(cos(x)); } 9 | inline float sin(float x) { return static_cast(sin(x)); } 10 | inline float tan(float x) { return static_cast(tan(x)); } 11 | inline float log(float x) { return static_cast(log(x)); } 12 | inline float exp(float x) { return static_cast(exp(x)); } 13 | #endif 14 | #include 15 | 16 | using namespace std; 17 | 18 | int main() 19 | { 20 | } 21 | 22 | void foo() 23 | { 24 | const int N = 10; 25 | valarray A(N), B(N), C(N), D(N), E(N); 26 | A = B*C + D*E; 27 | A = B+C + D*cos(E); 28 | A = B*sin(C) + D*sin(E); 29 | B = C + D; 30 | A = A+B+C+D; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /benchmarks/ctime4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | void foo() 10 | { 11 | const int N = 10; 12 | Array A(N), B(N), C(N), D(N), E(N); 13 | A = B*C + D*E; 14 | A = B+C + D*cos(E); 15 | A = B*sin(C) + D*sin(E); 16 | B = C + D; 17 | A = A+B+C+D; 18 | A = B*pow2(C) + D*E; 19 | A = B-C + log(D)*cos(E); 20 | A = B*sin(C) + tan(D)/E; 21 | B = C - D; 22 | A = A+B*C+D; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /benchmarks/ctime5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | } 8 | 9 | void foo() 10 | { 11 | const int N = 10; 12 | Array A(N), B(N), C(N), D(N), E(N); 13 | A = B*C + D*E; 14 | A = B+C + D*cos(E); 15 | A = B*sin(C) + D*sin(E); 16 | B = C + D; 17 | A = A+B+C+D; 18 | A = B*C*C + D*E; 19 | A = B-C + log(D)*cos(E); 20 | A = B*sin(C) + tan(D)/E; 21 | B = C - D; 22 | A = A+B*C+D; 23 | C = A+B+C+D+E; 24 | E = (A+B)*(C-D); 25 | D = A/B*C/D; 26 | B = (A*B) + (A/B); 27 | D = sin(A) + sin(E); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /benchmarks/daxpyf90-2.f90: -------------------------------------------------------------------------------- 1 | ! Fortran 90 DAXPY using arrays 2 | SUBROUTINE f90daxpy(a, x, y, n, iters) 3 | IMPLICIT NONE 4 | INTEGER, INTENT( IN ) :: n, iters 5 | DOUBLE PRECISION, DIMENSION (n) :: x, y 6 | DOUBLE PRECISION, INTENT( IN ) :: a 7 | DOUBLE PRECISION :: b 8 | 9 | b = - a 10 | 11 | DO i=1,iters 12 | y = y + a * y 13 | y = y + b * y 14 | END DO 15 | END SUBROUTINE 16 | -------------------------------------------------------------------------------- /benchmarks/daxpyf90.f90: -------------------------------------------------------------------------------- 1 | SUBROUTINE f90daxpy(a, x, y, n, iters) 2 | INTEGER n, iters 3 | DOUBLE PRECISION, DIMENSION (n) :: x, y 4 | DOUBLE PRECISION a, b 5 | 6 | b = - a 7 | 8 | DO i=1,iters 9 | y = y + a * x 10 | y = y + b * x 11 | END DO 12 | END SUBROUTINE 13 | -------------------------------------------------------------------------------- /benchmarks/fidaxpy.f: -------------------------------------------------------------------------------- 1 | subroutine fidaxpy(a, x, y, n, iters) 2 | 3 | integer i 4 | double precision x(n), y(n), a 5 | double precision b 6 | b = - a 7 | 8 | do 2000 j = 1, iters 9 | do 1000 i = 1, n 10 | y(i) = y(i) + a * x(i) 11 | 1000 continue 12 | 13 | do 3000 i = 1, n 14 | y(i) = y(i) + b * x(i) 15 | 3000 continue 16 | 2000 continue 17 | 18 | return 19 | end 20 | 21 | subroutine fidaxpyo(a, x, y, n, iters) 22 | 23 | double precision x(n), y(n), a 24 | 25 | return 26 | end 27 | 28 | -------------------------------------------------------------------------------- /benchmarks/floop10f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop10_F77(N, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), u 5 | 6 | DO i=1,N 7 | x(i) = u+a(i)+b(i)+c(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop10_F77Overhead(N, x, a, b, c, u) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop10f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop10_F90(N, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), u 5 | 6 | x = u+a+b+c 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop10_F90Overhead(N, x, a, b, c, u) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop11f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop11_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i)+c(i)+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop11_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop11f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop11_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = a+b+c+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop11_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop12f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop12_F77(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | DO i=1,N 7 | y(i) = u+a(i); x(i) = a(i)+b(i)+c(i)+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop12_F77Overhead(N, y, x, a, b, c, d, u) 14 | INTEGER i, N 15 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop12f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop12_F90(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | y = u+a; x = a+b+c+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop12_F90Overhead(N, y, x, a, b, c, d, u) 12 | INTEGER i, N 13 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop13f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop13_F77(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i)+c(i)+d(i); y(i) = u+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop13_F77Overhead(N, y, x, a, b, c, d, u) 14 | INTEGER i, N 15 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop13f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop13_F90(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | x = a+b+c+d; y = u+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop13_F90Overhead(N, y, x, a, b, c, d, u) 12 | INTEGER i, N 13 | REAL*4 y(N), x(N), a(N), b(N), c(N), d(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop14f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop14_F77(N, y, x, a, b) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i); y(i) = a(i)-b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop14_F77Overhead(N, y, x, a, b) 14 | INTEGER i, N 15 | REAL*4 y(N), x(N), a(N), b(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop14f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop14_F90(N, y, x, a, b) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N) 5 | 6 | x = a+b; y = a-b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop14_F90Overhead(N, y, x, a, b) 12 | INTEGER i, N 13 | REAL*4 y(N), x(N), a(N), b(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop15f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop15_F77(N, x, a, b, c) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N) 5 | 6 | DO i=1,N 7 | x(i) = c(i) + a(i)*b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop15_F77Overhead(N, x, a, b, c) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop15f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop15_F90(N, x, a, b, c) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N) 5 | 6 | x = c + a*b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop15_F90Overhead(N, x, a, b, c) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop16f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop16_F77(N, y, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), c(N), u 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i)+c(i); y(i) = x(i)+c(i)+u; 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop16_F77Overhead(N, y, x, a, b, c, u) 14 | INTEGER i, N 15 | REAL*4 y(N), x(N), a(N), b(N), c(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop16f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop16_F90(N, y, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), c(N), u 5 | 6 | x = a+b+c; y = x+c+u 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop16_F90Overhead(N, y, x, a, b, c, u) 12 | INTEGER i, N 13 | REAL*4 y(N), x(N), a(N), b(N), c(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop17f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop17_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = (a(i)+b(i))*(c(i)+d(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop17_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop17f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop17_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = (a+b)*(c+d) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop17_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop18f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop18_F77(N, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), u, v 5 | 6 | DO i=1,N 7 | x(i) = (u+a(i))*(v+b(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop18_F77Overhead(N, x, a, b, u, v) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), u, v 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop18f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop18_F90(N, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), u, v 5 | 6 | x = (u+a)*(v+b) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop18_F90Overhead(N, x, a, b, u, v) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), u, v 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop19f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop19_F77(N, y, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), u, v 5 | 6 | DO i=1,N 7 | x(i) = u*a(i); y(i) = v*b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop19_F77Overhead(N, y, x, a, b, u, v) 14 | INTEGER i, N 15 | REAL*4 y(N), x(N), a(N), b(N), u, v 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop19f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop19_F90(N, y, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*4 y(N), x(N), a(N), b(N), u, v 5 | 6 | x = u*a; y = v*b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop19_F90Overhead(N, y, x, a, b, u, v) 12 | INTEGER i, N 13 | REAL*4 y(N), x(N), a(N), b(N), u, v 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop1f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop1_F77(N, x, y) 3 | INTEGER i, N 4 | REAL*4 x(N), y(N) 5 | 6 | DO i=1,N 7 | x(i) = sqrt(y(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop1_F77Overhead(N, x, y) 14 | INTEGER i, N 15 | REAL*4 x(N), y(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop1f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop1_F90(N, x, y) 3 | INTEGER i, N 4 | REAL*4 x(N), y(N) 5 | 6 | x = sqrt(y) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop1_F90Overhead(N, x, y) 12 | INTEGER i, N 13 | REAL*4 x(N), y(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop21f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop21_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*b(i) + c(i)*d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop21_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop21f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop21_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = a*b + c*d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop21_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop22f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop22_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = x(i) + a(i)*b(i) + c(i)*d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop22_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop22f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop22_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = x + a*b + c*d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop22_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop23f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop23_F77(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*b(i) + c(i)*d(i); y(i) = b(i)+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop23_F77Overhead(N, x, a, b, c, d, y) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop23f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop23_F90(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | x = a*b + c*d; y = b+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop23_F90Overhead(N, x, a, b, c, d, y) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop24f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop24_F77(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*c(i) - b(i)*c(i); y(i) = a(i)*d(i) + b(i)+c(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop24_F77Overhead(N, x, a, b, c, d, y) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop24f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop24_F90(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | x = a*c - b*c; y = a*d + b+c 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop24_F90Overhead(N, x, a, b, c, d, y) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), d(N), y(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop25f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop25_F77(N, x, a, b, c, y, u, v, w) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), y(N), u, v, w 5 | 6 | DO i=1,N 7 | x(i) = u*b(i); y(i) = v*b(i) + w*a(i) + u*c(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop25_F77Overhead(N, x, a, b, c, y, u, v, w) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N), c(N), y(N), u, v, w 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop25f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop25_F90(N, x, a, b, c, y, u, v, w) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N), c(N), y(N), u, v, w 5 | 6 | x = u*b; y = v*b + w*a + u*c 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop25_F90Overhead(N, x, a, b, c, y, u, v, w) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N), c(N), y(N), u, v, w 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop2f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop2_F77(N, x, y, u) 3 | INTEGER i, N 4 | REAL*4 x(N), y(N), u 5 | 6 | DO i=1,N 7 | x(i) = y(i)/u; 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop2_F77Overhead(N, x, y, u) 14 | INTEGER i, N 15 | REAL*4 x(N), y(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop2f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop2_F90(N, x, y, u) 3 | INTEGER i, N 4 | REAL*4 x(N), y(N), u 5 | 6 | x = y/u 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop2_F90Overhead(N, x, y, u) 12 | INTEGER i, N 13 | REAL*4 x(N), y(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop36f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop36_F77(N, x, e) 3 | INTEGER i, N 4 | REAL*4 x(N), e(N) 5 | 6 | DO i=1,N 7 | x(i) = exp(e(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop36_F77Overhead(N, x, e) 14 | INTEGER i, N 15 | REAL*4 x(N), e(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop36f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop36_F90(N, x, e) 3 | INTEGER i, N 4 | REAL*4 x(N), e(N) 5 | 6 | x = exp(e) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop36_F90Overhead(N, x, e) 12 | INTEGER i, N 13 | REAL*4 x(N), e(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop3f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop3_F77(N, x, y, a) 3 | INTEGER i, N 4 | REAL*4 x(N), y(N), a 5 | 6 | DO i=1,N 7 | y(i) = y(i) + a*x(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop3_F77Overhead(N, x, y, a) 14 | INTEGER i, N 15 | REAL*4 x(N), y(N), a 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop3f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop3_F90(N, x, y, a) 3 | INTEGER i, N 4 | REAL*4 x(N), y(N), a 5 | 6 | y = y + a*x 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop3_F90Overhead(N, x, y, a) 12 | INTEGER i, N 13 | REAL*4 x(N), y(N), a 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop5f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop5_F77(N, x, a, b) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop5_F77Overhead(N, x, a, b) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop5f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop5_F90(N, x, a, b) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N) 5 | 6 | x = a+b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop5_F90Overhead(N, x, a, b) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop6f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop6_F77(N, x, a, b) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop6_F77Overhead(N, x, a, b) 14 | INTEGER i, N 15 | REAL*4 x(N), a(N), b(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop6f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop6_F90(N, x, a, b) 3 | INTEGER i, N 4 | REAL*4 x(N), a(N), b(N) 5 | 6 | x = a*b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop6_F90Overhead(N, x, a, b) 12 | INTEGER i, N 13 | REAL*4 x(N), a(N), b(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop8f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop8_F77(N, a, x, u) 3 | INTEGER i, N 4 | REAL*4 a(N), x(N), u 5 | 6 | DO i=1,N 7 | x(i) = u/a(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop8_F77Overhead(N, a, x, u) 14 | INTEGER i, N 15 | REAL*4 a(N), x(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop8f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop8_F90(N, a, x, u) 3 | INTEGER i, N 4 | REAL*4 a(N), x(N), u 5 | 6 | x = u/a 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop8_F90Overhead(N, a, x, u) 12 | INTEGER i, N 13 | REAL*4 a(N), x(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/floop9f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop9_F77(N, a, x) 3 | INTEGER i, N 4 | REAL*4 a(N), x(N) 5 | 6 | DO i=1,N 7 | x(i) = x(i)+a(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE floop9_F77Overhead(N, a, x) 14 | INTEGER i, N 15 | REAL*4 a(N), x(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/floop9f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE floop9_F90(N, a, x) 3 | INTEGER i, N 4 | REAL*4 a(N), x(N) 5 | 6 | x = x+a 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE floop9_F90Overhead(N, a, x) 12 | INTEGER i, N 13 | REAL*4 a(N), x(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/frek.m: -------------------------------------------------------------------------------- 1 | function frek(Mf) 2 | A = zeros(1,4); 3 | A = max(Mf); 4 | A./A(1,3) 5 | A = Mf(19,:); 6 | A./A(1,3) 7 | 8 | -------------------------------------------------------------------------------- /benchmarks/iter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | using namespace blitz; 7 | 8 | typedef Array Image; 9 | Image A(512,512,512); 10 | Timer timer; 11 | 12 | A = 0.0; 13 | timer.start(); 14 | for (unsigned j=0;j<10;++j) { 15 | for (Image::iterator i=A.begin(),end=A.end();i!=end;++i) { 16 | const TinyVector pos = i.position(); 17 | *i += pos(0)+pos(1)+pos(2); 18 | } 19 | } 20 | timer.stop(); 21 | double flops = 10.0*512*512*512*2; 22 | double seconds = timer.elapsed(); 23 | 24 | double timePerOp = seconds / flops; 25 | 26 | cout << "ops = " << flops << endl 27 | << "seconds = " << seconds << endl; 28 | 29 | double Mflops = flops / seconds / 1.0e+6; 30 | cout << "Mflops = " << Mflops << endl; 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /benchmarks/loop1-bug.cpp: -------------------------------------------------------------------------------- 1 | // In KAI C++ 3.2, restrict causes problems for copy propagation. 2 | // Temporary fix: disable restrict 3 | 4 | #define BZ_DISABLE_RESTRICT 5 | 6 | #include 7 | 8 | using namespace blitz; 9 | 10 | template void sink(T&) { } 11 | 12 | void foo(int N) 13 | { 14 | Vector x(N); 15 | Vector y(N); 16 | 17 | x=sqrt(y); 18 | 19 | sink(x); 20 | sink(y); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /benchmarks/loop100f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop100_F77(N, a, b, c, d, x, u, v, w, z) 3 | INTEGER i, N 4 | REAL*8 a(N), b(N), c(N), d(N), x(N), u, v, w, z 5 | 6 | DO i=1,N 7 | x(i)=(1.0-c(i)*c(i))/((4*w)*sin(1.0+c(i)*c(i)-2*v*c(i)))*a(i 8 | !)*b(i)*u*exp(-z*d(i)); 9 | END DO 10 | RETURN 11 | END 12 | 13 | 14 | SUBROUTINE loop100_F77Overhead(N, a, b, c, d, x, u, v, w, z) 15 | INTEGER i, N 16 | REAL*8 a(N), b(N), c(N), d(N), x(N), u, v, w, z 17 | RETURN 18 | END 19 | -------------------------------------------------------------------------------- /benchmarks/loop100f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop100_F90(N, a, b, c, d, x, u, v, w, z) 3 | INTEGER i, N 4 | REAL*8 a(N), b(N), c(N), d(N), x(N), u, v, w, z 5 | 6 | x=(1.0-c*c)/((4*w)*sin(1.0+c*c-2*v*c))*a*b*u*exp(-z*d) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop100_F90Overhead(N, a, b, c, d, x, u, v, w, z) 12 | INTEGER i, N 13 | REAL*8 a(N), b(N), c(N), d(N), x(N), u, v, w, z 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop10f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop10_F77(N, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), u 5 | 6 | DO i=1,N 7 | x(i) = u+a(i)+b(i)+c(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop10_F77Overhead(N, x, a, b, c, u) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop10f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop10_F90(N, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), u 5 | 6 | x = u+a+b+c 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop10_F90Overhead(N, x, a, b, c, u) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop11f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop11_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i)+c(i)+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop11_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop11f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop11_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = a+b+c+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop11_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop12f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop12_F77(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | DO i=1,N 7 | y(i) = u+a(i); x(i) = a(i)+b(i)+c(i)+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop12_F77Overhead(N, y, x, a, b, c, d, u) 14 | INTEGER i, N 15 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop12f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop12_F90(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | y = u+a; x = a+b+c+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop12_F90Overhead(N, y, x, a, b, c, d, u) 12 | INTEGER i, N 13 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop13f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop13_F77(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i)+c(i)+d(i); y(i) = u+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop13_F77Overhead(N, y, x, a, b, c, d, u) 14 | INTEGER i, N 15 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop13f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop13_F90(N, y, x, a, b, c, d, u) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 5 | 6 | x = a+b+c+d; y = u+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop13_F90Overhead(N, y, x, a, b, c, d, u) 12 | INTEGER i, N 13 | REAL*8 y(N), x(N), a(N), b(N), c(N), d(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop14f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop14_F77(N, y, x, a, b) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i); y(i) = a(i)-b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop14_F77Overhead(N, y, x, a, b) 14 | INTEGER i, N 15 | REAL*8 y(N), x(N), a(N), b(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop14f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop14_F90(N, y, x, a, b) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N) 5 | 6 | x = a+b; y = a-b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop14_F90Overhead(N, y, x, a, b) 12 | INTEGER i, N 13 | REAL*8 y(N), x(N), a(N), b(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop15f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop15_F77(N, x, a, b, c) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N) 5 | 6 | DO i=1,N 7 | x(i) = c(i) + a(i)*b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop15_F77Overhead(N, x, a, b, c) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop15f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop15_F90(N, x, a, b, c) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N) 5 | 6 | x = c + a*b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop15_F90Overhead(N, x, a, b, c) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop16f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop16_F77(N, y, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), c(N), u 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i)+c(i); y(i) = x(i)+c(i)+u; 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop16_F77Overhead(N, y, x, a, b, c, u) 14 | INTEGER i, N 15 | REAL*8 y(N), x(N), a(N), b(N), c(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop16f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop16_F90(N, y, x, a, b, c, u) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), c(N), u 5 | 6 | x = a+b+c; y = x+c+u 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop16_F90Overhead(N, y, x, a, b, c, u) 12 | INTEGER i, N 13 | REAL*8 y(N), x(N), a(N), b(N), c(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop17f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop17_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = (a(i)+b(i))*(c(i)+d(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop17_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop17f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop17_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = (a+b)*(c+d) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop17_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop18f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop18_F77(N, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), u, v 5 | 6 | DO i=1,N 7 | x(i) = (u+a(i))*(v+b(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop18_F77Overhead(N, x, a, b, u, v) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), u, v 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop18f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop18_F90(N, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), u, v 5 | 6 | x = (u+a)*(v+b) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop18_F90Overhead(N, x, a, b, u, v) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), u, v 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop19f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop19_F77(N, y, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), u, v 5 | 6 | DO i=1,N 7 | x(i) = u*a(i); y(i) = v*b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop19_F77Overhead(N, y, x, a, b, u, v) 14 | INTEGER i, N 15 | REAL*8 y(N), x(N), a(N), b(N), u, v 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop19f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop19_F90(N, y, x, a, b, u, v) 3 | INTEGER i, N 4 | REAL*8 y(N), x(N), a(N), b(N), u, v 5 | 6 | x = u*a; y = v*b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop19_F90Overhead(N, y, x, a, b, u, v) 12 | INTEGER i, N 13 | REAL*8 y(N), x(N), a(N), b(N), u, v 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop1f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop1_F77(N, x, y) 3 | INTEGER i, N 4 | REAL*8 x(N), y(N) 5 | 6 | DO i=1,N 7 | x(i) = sqrt(y(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop1_F77Overhead(N, x, y) 14 | INTEGER i, N 15 | REAL*8 x(N), y(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop1f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop1_F90(N, x, y) 3 | INTEGER i, N 4 | REAL*8 x(N), y(N) 5 | 6 | x = sqrt(y) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop1_F90Overhead(N, x, y) 12 | INTEGER i, N 13 | REAL*8 x(N), y(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop21f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop21_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*b(i) + c(i)*d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop21_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop21f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop21_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = a*b + c*d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop21_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop22f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop22_F77(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | DO i=1,N 7 | x(i) = x(i) + a(i)*b(i) + c(i)*d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop22_F77Overhead(N, x, a, b, c, d) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), d(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop22f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop22_F90(N, x, a, b, c, d) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N) 5 | 6 | x = x + a*b + c*d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop22_F90Overhead(N, x, a, b, c, d) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), d(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop23f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop23_F77(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*b(i) + c(i)*d(i); y(i) = b(i)+d(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop23_F77Overhead(N, x, a, b, c, d, y) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop23f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop23_F90(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | x = a*b + c*d; y = b+d 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop23_F90Overhead(N, x, a, b, c, d, y) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop24f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop24_F77(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*c(i) - b(i)*c(i); y(i) = a(i)*d(i) + b(i)+c(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop24_F77Overhead(N, x, a, b, c, d, y) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop24f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop24_F90(N, x, a, b, c, d, y) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 5 | 6 | x = a*c - b*c; y = a*d + b+c 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop24_F90Overhead(N, x, a, b, c, d, y) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), d(N), y(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop25f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop25_F77(N, x, a, b, c, y, u, v, w) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), y(N), u, v, w 5 | 6 | DO i=1,N 7 | x(i) = u*b(i); y(i) = v*b(i) + w*a(i) + u*c(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop25_F77Overhead(N, x, a, b, c, y, u, v, w) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N), c(N), y(N), u, v, w 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop25f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop25_F90(N, x, a, b, c, y, u, v, w) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N), c(N), y(N), u, v, w 5 | 6 | x = u*b; y = v*b + w*a + u*c 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop25_F90Overhead(N, x, a, b, c, y, u, v, w) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N), c(N), y(N), u, v, w 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop2f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop2_F77(N, x, y, u) 3 | INTEGER i, N 4 | REAL*8 x(N), y(N), u 5 | 6 | DO i=1,N 7 | x(i) = y(i)/u; 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop2_F77Overhead(N, x, y, u) 14 | INTEGER i, N 15 | REAL*8 x(N), y(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop2f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop2_F90(N, x, y, u) 3 | INTEGER i, N 4 | REAL*8 x(N), y(N), u 5 | 6 | x = y/u 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop2_F90Overhead(N, x, y, u) 12 | INTEGER i, N 13 | REAL*8 x(N), y(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop36f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop36_F77(N, x, e) 3 | INTEGER i, N 4 | REAL*8 x(N), e(N) 5 | 6 | DO i=1,N 7 | x(i) = exp(e(i)); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop36_F77Overhead(N, x, e) 14 | INTEGER i, N 15 | REAL*8 x(N), e(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop36f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop36_F90(N, x, e) 3 | INTEGER i, N 4 | REAL*8 x(N), e(N) 5 | 6 | x = exp(e) 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop36_F90Overhead(N, x, e) 12 | INTEGER i, N 13 | REAL*8 x(N), e(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop3f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop3_F77(N, x, y, a) 3 | INTEGER i, N 4 | REAL*8 x(N), y(N), a 5 | 6 | DO i=1,N 7 | y(i) = y(i) + a*x(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop3_F77Overhead(N, x, y, a) 14 | INTEGER i, N 15 | REAL*8 x(N), y(N), a 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop3f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop3_F90(N, x, y, a) 3 | INTEGER i, N 4 | REAL*8 x(N), y(N), a 5 | 6 | y = y + a*x 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop3_F90Overhead(N, x, y, a) 12 | INTEGER i, N 13 | REAL*8 x(N), y(N), a 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop4f.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE loop4_F77(niters, N, x, a, b) 2 | INTEGER i, iter, niters, N 3 | REAL*8 x(N), a(N), b(N) 4 | 5 | DO iter=1,niters 6 | DO i=1,N 7 | x(i)=a(i)+b(i) 8 | END DO 9 | END DO 10 | 11 | RETURN 12 | END 13 | -------------------------------------------------------------------------------- /benchmarks/loop4f90.f90: -------------------------------------------------------------------------------- 1 | SUBROUTINE loop4_F90(niters, N, x, a, b) 2 | INTEGER i, iter, niters, N 3 | REAL*8 x(N), a(N), b(N) 4 | 5 | DO iter=1,niters 6 | x=a+b 7 | END DO 8 | 9 | RETURN 10 | END 11 | -------------------------------------------------------------------------------- /benchmarks/loop5f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop5_F77(N, x, a, b) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)+b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop5_F77Overhead(N, x, a, b) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop5f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop5_F90(N, x, a, b) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N) 5 | 6 | x = a+b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop5_F90Overhead(N, x, a, b) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop6f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop6_F77(N, x, a, b) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N) 5 | 6 | DO i=1,N 7 | x(i) = a(i)*b(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop6_F77Overhead(N, x, a, b) 14 | INTEGER i, N 15 | REAL*8 x(N), a(N), b(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop6f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop6_F90(N, x, a, b) 3 | INTEGER i, N 4 | REAL*8 x(N), a(N), b(N) 5 | 6 | x = a*b 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop6_F90Overhead(N, x, a, b) 12 | INTEGER i, N 13 | REAL*8 x(N), a(N), b(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop8f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop8_F77(N, a, x, u) 3 | INTEGER i, N 4 | REAL*8 a(N), x(N), u 5 | 6 | DO i=1,N 7 | x(i) = u/a(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop8_F77Overhead(N, a, x, u) 14 | INTEGER i, N 15 | REAL*8 a(N), x(N), u 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop8f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop8_F90(N, a, x, u) 3 | INTEGER i, N 4 | REAL*8 a(N), x(N), u 5 | 6 | x = u/a 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop8_F90Overhead(N, a, x, u) 12 | INTEGER i, N 13 | REAL*8 a(N), x(N), u 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/loop9f.f: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop9_F77(N, a, x) 3 | INTEGER i, N 4 | REAL*8 a(N), x(N) 5 | 6 | DO i=1,N 7 | x(i) = x(i)+a(i); 8 | END DO 9 | RETURN 10 | END 11 | 12 | 13 | SUBROUTINE loop9_F77Overhead(N, a, x) 14 | INTEGER i, N 15 | REAL*8 a(N), x(N) 16 | RETURN 17 | END 18 | -------------------------------------------------------------------------------- /benchmarks/loop9f90.f90: -------------------------------------------------------------------------------- 1 | 2 | SUBROUTINE loop9_F90(N, a, x) 3 | INTEGER i, N 4 | REAL*8 a(N), x(N) 5 | 6 | x = x+a 7 | RETURN 8 | END 9 | 10 | 11 | SUBROUTINE loop9_F90Overhead(N, a, x) 12 | INTEGER i, N 13 | REAL*8 a(N), x(N) 14 | 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /benchmarks/qcd.txt: -------------------------------------------------------------------------------- 1 | 2 | The most expensive routines in terms of CPU time were a family of routines 3 | that multiplied a 2-spinors by SU(3) gauge elements: The core of these 4 | routines is basically the same as the following code: 5 | 6 | COMPLEX M(V,3,3) res(V,3,2), src(V,3,2) 7 | DO spin=1,2 8 | DO col=1,3 9 | DO site=1,V 10 | res(site,col,spin)= 11 | M(site,col,1) * src(site,1,spin) 12 | + M(site,col,2) * src(site,2,spin) 13 | + M(site,col,3) * src(site,3,spin) 14 | END DO 15 | END DO 16 | END DO 17 | 18 | http://www.epcc.ed.ac.uk/t3d/documents/techreports/EPCC-TR96-03/EPCC-TR96-03.book_1.html 19 | 20 | -------------------------------------------------------------------------------- /benchmarks/quinlan.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | template 6 | void sink(T&) { } 7 | 8 | void foo() 9 | { 10 | Vector A(100), B(100); 11 | 12 | A = B + B; 13 | sink(A); 14 | sink(B); 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /benchmarks/stencilf.f: -------------------------------------------------------------------------------- 1 | subroutine stencilf(A, B, N, iters) 2 | integer N, iters 3 | double precision A(N,N,N), B(N,N,N) 4 | integer i,j,k,z 5 | double precision c 6 | c = 1 / 7. 7 | 8 | do z=1,iters 9 | 10 | do k=2,N-1 11 | do j=2,N-1 12 | do i=2,N-1 13 | A(i,j,k) = c * (B(i,j,k) + B(i+1,j,k) + B(i-1,j,k) 14 | . + B(i,j+1,k) + B(i,j-1,k) + B(i,j,k+1) + B(i,j,k-1)) 15 | enddo 16 | enddo 17 | enddo 18 | 19 | do k=2,N-1 20 | do j=2,N-1 21 | do i=2,N-1 22 | B(i,j,k) = c * (A(i,j,k) + A(i+1,j,k) + A(i-1,j,k) 23 | . + A(i,j+1,k) + A(i,j-1,k) + A(i,j,k+1) + A(i,j,k-1)) 24 | enddo 25 | enddo 26 | enddo 27 | 28 | enddo 29 | 30 | return 31 | end 32 | 33 | -------------------------------------------------------------------------------- /benchmarks/stencilf90.f90: -------------------------------------------------------------------------------- 1 | SUBROUTINE stencilf90(A, B, n, iters) 2 | IMPLICIT NONE 3 | INTEGER, INTENT( IN ) :: n, iters 4 | DOUBLE PRECISION, DIMENSION (n,n,n) :: A, B 5 | DOUBLE PRECISION :: c 6 | INTEGER :: count 7 | 8 | c = 1 / 7. 9 | 10 | DO count=1,iters 11 | A(2:N-1,2:N-1,2:N-1) = c * (B(2:N-1,2:N-1,2:N-1) + B(3:N,2:N-1,2:N-1) & 12 | + B(1:N-2,2:N-1,2:N-1) + B(2:N-1,3:N,2:N-1) + B(2:N-1,1:N-2,2:N-1) & 13 | + B(2:N-1,2:N-1,3:N) + B(2:N-1,2:N-1,1:N-2)) 14 | 15 | B(2:N-1,2:N-1,2:N-1) = c * (A(2:N-1,2:N-1,2:N-1) + A(3:N,2:N-1,2:N-1) & 16 | + A(1:N-2,2:N-1,2:N-1) + A(2:N-1,3:N,2:N-1) + A(2:N-1,1:N-2,2:N-1) & 17 | + A(2:N-1,2:N-1,3:N) + A(2:N-1,2:N-1,1:N-2)) 18 | END DO 19 | END SUBROUTINE 20 | -------------------------------------------------------------------------------- /blitz/array/expr.cc: -------------------------------------------------------------------------------- 1 | #ifndef BZ_EXPR_CC 2 | #define BZ_EXPR_CC 3 | 4 | #include 5 | 6 | namespace blitz { 7 | 8 | template 9 | inline RectDomain<12> 10 | _bz_ArrayExprConstant::domain() const 11 | { 12 | TinyVector lb(lbound(0)), ub(ubound(0)); 13 | return RectDomain<12>(lb,ub); 14 | } 15 | 16 | } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /blitz/constpointerstack.h: -------------------------------------------------------------------------------- 1 | #ifndef BZ_POINTERSTACK_H 2 | #define BZ_POINTERSTACK_H 3 | 4 | #include 5 | 6 | namespace blitz { 7 | 8 | // helper class ConstPointerStack 9 | template 10 | class ConstPointerStack { 11 | public: 12 | typedef P_numtype T_numtype; 13 | 14 | void operator=(const ConstPointerStack& rhs) 15 | { 16 | for (int i=0; i 6 | #include 7 | 8 | namespace blitz { 9 | 10 | 11 | inline Range::T_numtype Range::operator[](int i) const 12 | { 13 | return first_ + i * stride_; 14 | } 15 | 16 | inline RectDomain Range::domain() const 17 | { 18 | return RectDomain(TinyVector(0), 19 | TinyVector(ubound(0))); 20 | } 21 | 22 | inline bool Range::assertInRange(const T_index& BZ_DEBUG_PARAM(index)) const 23 | { 24 | BZPRECHECK((index[0]<=ubound(0)) && (index[0]>=0), 25 | "Range index out of range: " << index[0] 26 | << endl << "Lower bounds: 0" << endl 27 | << "Length: " << length() << endl); 28 | return true; 29 | } 30 | 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /blitz/wrap-climits.h: -------------------------------------------------------------------------------- 1 | #ifndef BZ_WRAP_CLIMITS_H 2 | #define BZ_WRAP_CLIMITS_H 3 | 4 | #ifdef BZ_HAVE_CLIMITS 5 | #include 6 | #else 7 | #include 8 | #endif 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /cmake/Win32Compat.cmake: -------------------------------------------------------------------------------- 1 | # ============================== 2 | # = Fix DLL search pb on WIN32 = 3 | # ============================== 4 | 5 | IF (WIN32) 6 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src") 7 | 8 | # These are obsolete as per cmake 2.6 9 | 10 | SET(LIBRARY_OUTPUT_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") 11 | SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") 12 | ENDIF() 13 | -------------------------------------------------------------------------------- /cmake/XXXConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@PACKAGE_VERSION@") 2 | 3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 4 | 5 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 6 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 7 | else() 8 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 9 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 10 | set(PACKAGE_VERSION_EXACT TRUE) 11 | endif() 12 | endif() 13 | -------------------------------------------------------------------------------- /cmake/blitzConfig.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | 3 | @PACKAGE_INIT@ 4 | 5 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 6 | check_required_components("@PROJECT_NAME@") 7 | -------------------------------------------------------------------------------- /cmake/cxx_tests/alignment_directive_gcc.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | int __attribute__ ((aligned (16))) var; 3 | var=0; 4 | } 5 | -------------------------------------------------------------------------------- /cmake/cxx_tests/alignment_directive_win.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | __declspec(align(16)) int var; 3 | var=0; 4 | } 5 | -------------------------------------------------------------------------------- /cmake/cxx_tests/compiler_vendor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/cmake/cxx_tests/compiler_vendor.cpp -------------------------------------------------------------------------------- /cmake/cxx_tests/const_cast.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports const_cast<>. 4 | // In sync with AC_CXX_CONST_CAST (2008-04-12) 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | int main() { 17 | int x = 0; 18 | const int& y = x; 19 | int& z = const_cast(y); 20 | return z; 21 | } 22 | -------------------------------------------------------------------------------- /cmake/cxx_tests/cppflags_std_lang.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/cmake/cxx_tests/cppflags_std_lang.cpp -------------------------------------------------------------------------------- /cmake/cxx_tests/cxxflags_std_lang.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/cmake/cxx_tests/cxxflags_std_lang.cpp -------------------------------------------------------------------------------- /cmake/cxx_tests/default_template_parameters.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports default template parameters. 4 | // In sync with AC_CXX_DEFAULT_TEMPLATE_PARAMETERS (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | template 17 | class A { 18 | public: 19 | int f() {return 0;} 20 | }; 21 | 22 | int main() { 23 | A a; 24 | return a.f(); 25 | } 26 | -------------------------------------------------------------------------------- /cmake/cxx_tests/exceptions.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports exceptions handling (try, throw and catch), 4 | // In sync with AC_CXX_EXCEPTIONS (2008-04-12). 5 | // 6 | // Copyright (c) 2009 Theo Papadopoulo 7 | // 8 | // ORIGINAL COPYLEFT 9 | // 10 | // Copyright (c) 2008 Todd Veldhuizen 11 | // Copyright (c) 2008 Luc Maisonobe 12 | // 13 | // Copying and distribution of this file, with or without modification, are 14 | // permitted in any medium without royalty provided the copyright notice 15 | // and this notice are preserved. 16 | 17 | int main() { 18 | try { throw 1; } catch (int i) { return i; } 19 | } 20 | -------------------------------------------------------------------------------- /cmake/cxx_tests/explicit.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler can be asked to prevent using implicitly one argument 4 | // constructors as converting constructors with the explicit keyword. 5 | // In sync with AC_CXX_EXPLICIT (2008-04-12) 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Todd Veldhuizen 11 | // Copyright (c) 2008 Luc Maisonobe 12 | // 13 | // Copying and distribution of this file, with or without modification, are 14 | // permitted in any medium without royalty provided the copyright notice 15 | // and this notice are preserved. 16 | 17 | class A{ 18 | public: 19 | explicit A(double){} 20 | }; 21 | 22 | int main() { 23 | double c = 5.0; 24 | A x(c); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /cmake/cxx_tests/explicit_instantiations.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports explicit instanciations syntax, define 4 | // HAVE_INSTANTIATIONS. 5 | // In sync with AC_CXX_EXPLICIT_INSTANTIATIONS (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Todd Veldhuizen 11 | // Copyright (c) 2008 Luc Maisonobe 12 | // 13 | // Copying and distribution of this file, with or without modification, are 14 | // permitted in any medium without royalty provided the copyright notice 15 | // and this notice are preserved. 16 | 17 | template class A { T t; }; 18 | template class A; 19 | 20 | int main() { } 21 | -------------------------------------------------------------------------------- /cmake/cxx_tests/extern_template.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test whether the C++ compiler supports "extern template". 4 | // In sync with AC_CXX_EXTERN_TEMPLATE (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Patrick Mauritz 10 | // 11 | // Copying and distribution of this file, with or without modification, are 12 | // permitted in any medium without royalty provided the copyright notice 13 | // and this notice are preserved. 14 | 15 | template void foo(T); extern template void foo(int); 16 | 17 | int main() { } 18 | -------------------------------------------------------------------------------- /cmake/cxx_tests/full_specialization_syntax.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler recognizes the full specialization syntax. 4 | // In sync with AC_CXX_FULL_SPECIALIZATION_SYNTAX (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | template class A { public : int f () const { return 1; } }; 17 | template<> class A { public: int f () const { return 0; } }; 18 | 19 | int main() { 20 | A a; 21 | return a.f(); 22 | } 23 | -------------------------------------------------------------------------------- /cmake/cxx_tests/function_nontype_parameters.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the compiler supports function templates with non-type parameters. 4 | // In sync with AC_CXX_FUNCTION_NONTYPE_PARAMETERS (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | template class A {}; 17 | template int f(const A& x) { return 0; } 18 | 19 | int main() { 20 | A z; 21 | return f(z); 22 | } 23 | -------------------------------------------------------------------------------- /cmake/cxx_tests/gnucxx_hashmap.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test for the presence of GCC's hashmap STL extension. 4 | // In sync with AC_CXX_GNUCXX_HASHMAP (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Patrick Mauritz 10 | // 11 | // Copying and distribution of this file, with or without modification, are 12 | // permitted in any medium without royalty provided the copyright notice 13 | // and this notice are preserved. 14 | 15 | #include 16 | using __gnu_cxx::hash_map; 17 | 18 | int main() { } 19 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_climits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int i = INT_MIN; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_complex.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler has complex. 4 | // In sync with AC_CXX_HAVE_COMPLEX (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | 18 | using namespace std; 19 | 20 | int main() { 21 | complex a; 22 | complex b; 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_complex_fcns.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | complex x(1.0, 1.0); 6 | real(x); imag(x); abs(x); arg(x); norm(x); conj(x); polar(1.0,1.0); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_numeric_limits.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler has numeric_limits. 4 | // In sync with AC_CXX_HAVE_NUMERIC_LIMITS (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | using namespace std; 18 | 19 | int main() { 20 | double e = numeric_limits::epsilon(); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_rusage.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | struct rusage resUsage; 5 | getrusage(RUSAGE_SELF, &resUsage); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_sstream.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ library has a working stringstream. 4 | // In sync with AC_CXX_HAVE_SSTREAM (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Ben Stanley 10 | // 11 | // Copying and distribution of this file, with or without modification, are 12 | // permitted in any medium without royalty provided the copyright notice 13 | // and this notice are preserved. 14 | 15 | //AC_CACHE_CHECK(whether the compiler has stringstream, 16 | 17 | #include 18 | using namespace std; 19 | 20 | int main() { 21 | stringstream message; 22 | message << "Hello"; 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_std.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports ISO C++ standard library 4 | // (i.e., can include the files iostream, map, iomanip and cmath). 5 | // In sync with AC_CXX_HAVE_STD (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Todd Veldhuizen 11 | // Copyright (c) 2008 Luc Maisonobe 12 | // 13 | // Copying and distribution of this file, with or without modification, are 14 | // permitted in any medium without royalty provided the copyright notice 15 | // and this notice are preserved. 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | using namespace std; 22 | 23 | int main() { return 0; } 24 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_stl.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports the Standard Template 4 | // Library. 5 | // In sync with AC_CXX_HAVE_STL (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Todd Veldhuizen 11 | // Copyright (c) 2008 Luc Maisonobe 12 | // 13 | // Copying and distribution of this file, with or without modification, are 14 | // permitted in any medium without royalty provided the copyright notice 15 | // and this notice are preserved. 16 | 17 | #include 18 | #include 19 | using namespace std; 20 | 21 | int main() { 22 | list x; 23 | x.push_back(5); 24 | list::iterator iter = x.begin(); 25 | if (iter!=x.end()) ++iter; 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_string_push_back.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the implementation of the C++ library provides the method 4 | // std::string::push_back (char), define HAVE_STRING_PUSH_BACK. 5 | // In sync with AC_CXX_HAVE_STRING_PUSH_BACK (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Jan Langer 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | using namespace std; 18 | 19 | int main() { 20 | string message; 21 | message.push_back('a'); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_valarray.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler has valarray. 4 | // In sync with AC_CXX_HAVE_VALARRAY (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | using namespace std; 18 | 19 | int main() { 20 | valarray x(100); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /cmake/cxx_tests/have_vector_at.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the implementation of the C++ library 4 | // provides the method std::vector::at(std::size_t). 5 | // In sync with AC_CXX_HAVE_VECTOR_AT (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Jan Langer 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | using namespace std; 18 | 19 | int main() { 20 | vector v(1); 21 | message.at(0); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /cmake/cxx_tests/header_tr1_unordered_map.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Check whether the TR1 include exists and define 4 | // HAVE_TR1_UNORDERED_MAP if it does. 5 | // In sync with AC_CXX_HEADER_TR1_UNORDERED_MAP (2008-04-17). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Benjamin Kosnik 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | 18 | inf main() { 19 | using std::tr1::unordered_map; 20 | } 21 | -------------------------------------------------------------------------------- /cmake/cxx_tests/header_tr1_unordered_set.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Check whether the TR1 include exists and define 4 | // HAVE_TR1_UNORDERED_SET if it does. 5 | // In sync with AC_CXX_HEADER_TR1_UNORDERED_SET (2008-04-17). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Benjamin Kosnik 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include ; 17 | 18 | inf main() { 19 | using std::tr1::unordered_set; 20 | } 21 | -------------------------------------------------------------------------------- /cmake/cxx_tests/header_unordered_map.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Check whether the C++ include exists and define 4 | // HAVE_UNORDERED_MAP if it does. 5 | // In sync with AC_CXX_HEADER_UNORDERED_MAP (2008-04-17). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Benjamin Kosnik 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include ; 17 | 18 | int main() { 19 | using std::unordered_map; 20 | } 21 | -------------------------------------------------------------------------------- /cmake/cxx_tests/header_unordered_set.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Check whether the C++ include exists and define 4 | // HAVE_UNORDERED_SET if it does. 5 | // In sync with AC_CXX_HEADER_UNORDERED_SET (2008-04-17). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Benjamin Kosnik 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include ; 17 | 18 | int main() { 19 | using std::unordered_set; 20 | } 21 | -------------------------------------------------------------------------------- /cmake/cxx_tests/isnan_in_namespace_std.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the isnan function is provided by the cmath header file in std:: 4 | // namespace, define HAVE_ISNAN_IN_NAMESPACE_STD. 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2011 Theo Papadopoulo 9 | // 10 | // Copying and distribution of this file, with or without modification, are 11 | // permitted in any medium without royalty provided the copyright notice 12 | // and this notice are preserved. 13 | 14 | #include 15 | 16 | namespace S { 17 | bool isnan(const float x) { return std::isnan(x); } 18 | } 19 | 20 | int main() { 21 | using namespace S; 22 | float x = 1.0; 23 | S::isnan(x); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /cmake/cxx_tests/isnormal_in_namespace_std.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the isnormal function is provided by the cmath header file in std:: 4 | // namespace, define HAVE_ISNORMAL_IN_NAMESPACE_STD. 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2011 Theo Papadopoulo 9 | // 10 | // Copying and distribution of this file, with or without modification, are 11 | // permitted in any medium without royalty provided the copyright notice 12 | // and this notice are preserved. 13 | 14 | #include 15 | 16 | namespace S { 17 | bool isnormal(const double x) { return std::isnormal(x); } 18 | } 19 | 20 | int main() { 21 | double d = 3.0; 22 | const bool res = S::isnormal(d); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /cmake/cxx_tests/ldflags_std_lang.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/cmake/cxx_tests/ldflags_std_lang.cpp -------------------------------------------------------------------------------- /cmake/cxx_tests/math_absint_in_namespace_std.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int i = std::abs(1); 5 | long j = std::labs(1L); 6 | long k = std::abs(1L); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /cmake/cxx_tests/math_fn_in_namespace_std.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace blitz { 4 | double pow(double x, double y) { return std::pow(x,y); } 5 | } 6 | 7 | int main() { 8 | using namespace blitz; 9 | double x = 1.0, y = 1.0; 10 | blitz::pow(x,y); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /cmake/cxx_tests/member_constants.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports member constants, define HAVE_MEMBER_CONSTANTS. 4 | // In sync with AC_CXX_MEMBER_CONSTANTS (2008-04-12) 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | class C {public: static const int i = 0;}; 17 | const int C::i; 18 | 19 | int main() { 20 | return C::i; 21 | } 22 | -------------------------------------------------------------------------------- /cmake/cxx_tests/member_templates.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler supports member templates. 4 | // In sync with AC_CXX_MEMBER_TEMPLATES (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2008 Todd Veldhuizen 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | template class A { 17 | public: 18 | template A operator=(const A& z) { return A(); } 19 | }; 20 | 21 | int main() { 22 | A x; 23 | A y; 24 | x = y; 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /cmake/cxx_tests/mutable.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the C++ compiler allows modifying class data members flagged with the 4 | // mutable keyword even in const objects (for example in the body of a const member function). 5 | // In sync with AC_CXX_MUTABLE (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Todd Veldhuizen 11 | // Copyright (c) 2008 Luc Maisonobe 12 | // 13 | // Copying and distribution of this file, with or without modification, are 14 | // permitted in any medium without royalty provided the copyright notice 15 | // and this notice are preserved. 16 | 17 | class A { 18 | mutable int i; 19 | public: 20 | int f (int n) const { i = n; return i; } 21 | }; 22 | 23 | int main() { 24 | A a; 25 | return a.f(1); 26 | } 27 | -------------------------------------------------------------------------------- /cmake/cxx_tests/namespace_std.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the compiler supports namespace std, define HAVE_NAMESPACE_STD. 4 | // In sync with AC_CXX_NAMESPACE_STD (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2008 Todd Veldhuizen 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include 17 | std::istream& is = std::cin; 18 | 19 | int main() { } 20 | -------------------------------------------------------------------------------- /cmake/cxx_tests/restrict_egcs.cpp: -------------------------------------------------------------------------------- 1 | void add(int length,double* __restrict__ a,const double* __restrict__ b,const double* __restrict__ c) { 2 | for (int i=0;i 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // 11 | // Copying and distribution of this file, with or without modification, are 12 | // permitted in any medium without royalty provided the copyright notice 13 | // and this notice are preserved. 14 | 15 | #include 16 | using std::hash_map; 17 | 18 | int main() { } 19 | -------------------------------------------------------------------------------- /cmake/cxx_tests/templates.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the compiler supports basic templates. 4 | // In sync with AC_CXX_TEMPLATES (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2008 Todd Veldhuizen 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | template class A { 17 | public: 18 | A() { } 19 | }; 20 | 21 | template void f(const A&) { } 22 | 23 | int main() { 24 | A d; 25 | A i; 26 | f(d); 27 | f(i); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /cmake/cxx_tests/type_promotion.cpp: -------------------------------------------------------------------------------- 1 | #ifndef HAVE_TYPENAME 2 | #define typename 3 | #endif 4 | 5 | template struct vec3 { T data_[3]; }; 6 | template struct promote_trait { typedef T1 T_promote; }; 7 | template <> struct promote_trait { typedef double T_promote; }; 8 | 9 | template vec3::T_promote> 10 | operator+(const vec3& a, const vec3& b) { 11 | vec3::T_promote> c; 12 | c.data_[0] = a.data_[0] + b.data_[0]; 13 | c.data_[1] = a.data_[1] + b.data_[1]; 14 | c.data_[2] = a.data_[2] + b.data_[2]; 15 | return c; 16 | } 17 | 18 | int main() { 19 | vec3 a,b; 20 | vec3 c,d,e; 21 | b=a+a; 22 | d=c+c; 23 | e=b+d; 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /cmake/cxx_tests/typename.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // whether the compiler recognizes typename the C++ compiler recognizes the typename keyword. 4 | // In sync with AC_CXX_TYPENAME (2008-04-12). 5 | // 6 | // COPYLEFT 7 | // 8 | // Copyright (c) 2009 Theo Papadopoulo 9 | // Copyright (c) 2008 Todd Veldhuizen 10 | // Copyright (c) 2008 Luc Maisonobe 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | template 17 | class X { 18 | public: 19 | X(){} 20 | }; 21 | 22 | int main() { 23 | X z; 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /cmake/cxx_tests/verbose_terminate_handler.cpp: -------------------------------------------------------------------------------- 1 | // DESCRIPTION 2 | // 3 | // Test to check whether the compiler does have the verbose terminate handler, define 4 | // HAVE_VERBOSE_TERMINATE_HANDLER. 5 | // In sync with AC_CXX_VERBOSE_TERMINATE_HANDLER (2008-04-12). 6 | // 7 | // COPYLEFT 8 | // 9 | // Copyright (c) 2009 Theo Papadopoulo 10 | // Copyright (c) 2008 Lapo Luchini 11 | // 12 | // Copying and distribution of this file, with or without modification, are 13 | // permitted in any medium without royalty provided the copyright notice 14 | // and this notice are preserved. 15 | 16 | #include ; 17 | 18 | int main() { 19 | std::set_terminate(__gnu_cxx::__verbose_terminate_handler); 20 | } 21 | -------------------------------------------------------------------------------- /compiler/LEGAL: -------------------------------------------------------------------------------- 1 | This compiler test suite is (C) 1997 Todd Veldhuizen. Permission is 2 | granted to use this test suite for non-commercial purposes only. This 3 | suite may be redistributed so long as no fee is charged, and all the 4 | files in the original distribution are included intact. 5 | 6 | If you wish to use this suite for a commercial project (i.e. testing 7 | ISO/ANSI C++ standard compliance for a compiler), please contact me 8 | for licensing information at . 9 | -------------------------------------------------------------------------------- /compiler/README: -------------------------------------------------------------------------------- 1 | Blitz++ Compiler Feature Tests 2 | 3 | http://monet.uwaterloo.ca/blitz/compilers/ 4 | 5 | August 1997 6 | 7 | This tar file (bzconfig.tar.gz) contains a set of small programs to 8 | test your compiler's support of new C++ language features. Some of 9 | these features are necessary for the Blitz++ library; others aren't. 10 | 11 | Run the script bzconfig by invoking bash (or sh) on it: 12 | bash ./bzconfig 13 | 14 | After asking a few questions about invoking your compiler, the script 15 | will compile and run a series of small C++ programs. The results of 16 | the tests are written to a file config.h. 17 | 18 | * If you have problems getting the script to work, try setting 19 | "verbose=1" or "set -x" at the beginning of the script file. 20 | 21 | Thanks, 22 | Todd 23 | -------------------------------------------------------------------------------- /compiler/bool.cpp: -------------------------------------------------------------------------------- 1 | // bool treated as distinct type 2 | // BZ_BOOL 3 | 4 | int foo(int x) 5 | { 6 | return 1; 7 | } 8 | 9 | int foo(char x) 10 | { 11 | return 1; 12 | } 13 | 14 | int foo(bool x) 15 | { 16 | return 0; 17 | } 18 | 19 | int main() 20 | { 21 | bool c = true; 22 | return foo(c); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /compiler/climits.cpp: -------------------------------------------------------------------------------- 1 | // has the header? 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | int i = INT_MIN; 8 | return 0; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /compiler/cmthscop.cpp: -------------------------------------------------------------------------------- 1 | // Where are those pesky math functions? 2 | // BZ_COMPLEX_MATH_IN_NAMESPACE_STD 3 | 4 | #include 5 | 6 | namespace blitz { 7 | using namespace std; 8 | 9 | complex pow(complex x, complex y) 10 | { return std::pow(x,y); } 11 | }; 12 | 13 | int main() 14 | { 15 | using namespace blitz; 16 | complex x = 1.0, y = 1.0; 17 | blitz::pow(x,y); 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /compiler/complex.cpp: -------------------------------------------------------------------------------- 1 | // complex class 2 | 3 | #include 4 | 5 | #ifndef BZ_NO_NAMESPACES 6 | using namespace std; 7 | #endif 8 | 9 | int main() 10 | { 11 | complex a; 12 | complex b; 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /compiler/compmath.cpp: -------------------------------------------------------------------------------- 1 | // BZ_HAVE_COMPLEX_MATH1 2 | // Complex math functions, as per 26.2.7 of the Jan'96 draft standard 3 | #include 4 | 5 | #ifndef BZ_NO_NAMESPACES 6 | using namespace std; 7 | #endif 8 | 9 | int main() 10 | { 11 | complex x(1.0, 1.0), y(1.0, 1.0); 12 | 13 | real(x); 14 | imag(x); 15 | abs(x); 16 | arg(x); 17 | norm(x); 18 | conj(x); 19 | polar(1.0,1.0); 20 | 21 | cos(x); 22 | cosh(x); 23 | exp(x); 24 | log(x); 25 | log10(x); 26 | pow(x,1); 27 | pow(x,double(2.0)); 28 | pow(x, y); 29 | pow(double(2.0), x); 30 | sin(x); 31 | sinh(x); 32 | sqrt(x); 33 | tan(x); 34 | tanh(x); 35 | 36 | return 0; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /compiler/constcst.cpp: -------------------------------------------------------------------------------- 1 | // const_cast 2 | 3 | 4 | int main() 5 | { 6 | int x = 0; 7 | const int& y = x; 8 | 9 | int& z = const_cast(y); 10 | z = 3; 11 | if (x == 3) 12 | return 0; 13 | 14 | return 1; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /compiler/cstd.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | return 0; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /compiler/default.cpp: -------------------------------------------------------------------------------- 1 | // Default template parameters 2 | // BZ_DEFAULT_TEMPLATE_PARAMETERS 3 | 4 | template 5 | class foo { 6 | public: 7 | int bar() const 8 | { return 0; } 9 | }; 10 | 11 | int main() 12 | { 13 | foo z; 14 | return z.bar(); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /compiler/dynamic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class Dog { 4 | public: 5 | Dog() { } 6 | virtual void fetch() = 0; 7 | }; 8 | 9 | class Dalmation : public Dog { 10 | public: 11 | Dalmation() { } 12 | virtual void fetch(); 13 | }; 14 | 15 | void Dalmation::fetch() 16 | { 17 | } 18 | 19 | int main() 20 | { 21 | Dalmation cairo; 22 | Dog& doggie = cairo; 23 | 24 | if (dynamic_cast(&doggie)) 25 | { 26 | return 0; 27 | } 28 | 29 | return 1; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /compiler/elabbase.cpp: -------------------------------------------------------------------------------- 1 | #ifdef BZ_NO_TYPENAME 2 | #define typename 3 | #endif 4 | 5 | 6 | // Template-qualified base class specifier 7 | // BZ_TEMPLATE_QUALIFIED_BASE_CLASS 8 | 9 | class base1 { 10 | public: 11 | int bar() const 12 | { return 1; } 13 | }; 14 | 15 | class base2 { 16 | public: 17 | int bar() const 18 | { return 0; } 19 | }; 20 | 21 | template 22 | struct base_trait { 23 | typedef base1 base; 24 | }; 25 | 26 | template<> 27 | struct base_trait { 28 | typedef base2 base; 29 | }; 30 | 31 | template 32 | class weird : public base_trait::base { 33 | public: 34 | typedef typename base_trait::base base; 35 | 36 | int zowee() const 37 | { return this->bar(); } 38 | }; 39 | 40 | int main() 41 | { 42 | weird z; 43 | return z.zowee(); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /compiler/elabret.cpp: -------------------------------------------------------------------------------- 1 | #ifdef BZ_NO_TYPENAME 2 | #define typename 3 | #endif 4 | 5 | 6 | // Template-qualified return type, necessary for type promotion on vectors 7 | // BZ_TEMPLATE_QUALIFIED_RETURN_TYPE 8 | 9 | template 10 | struct promote_trait { 11 | typedef X T; 12 | }; 13 | 14 | 15 | template<>struct promote_trait { 16 | typedef float T; 17 | }; 18 | 19 | template 20 | class Vector { 21 | public: 22 | Vector() { } 23 | }; 24 | 25 | template 26 | Vector::T> operator+(const Vector&, 27 | const Vector&) 28 | { 29 | return Vector::T>(); 30 | } 31 | 32 | int main() 33 | { 34 | Vector x; 35 | Vector y; 36 | Vector z = x + y; 37 | return 0; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /compiler/enumcmp2.cpp: -------------------------------------------------------------------------------- 1 | // BZ_ENUM_COMPUTATIONS_WITH_CAST 2 | 3 | struct foo { 4 | enum { a = 5, b = 7, c = 2 }; 5 | }; 6 | 7 | struct bar { 8 | enum { a = 1, b = 6, c = 9 }; 9 | }; 10 | 11 | template 12 | struct Z { 13 | enum { a = ((int)T1::a > (int)T2::a) ? (int)T1::a : (int)T2::b, 14 | b = (int)T1::b + (int)T2::b, 15 | c = ((int)T1::c * (int)T2::c + (int)T2::a + (int)T1::a) 16 | }; 17 | }; 18 | 19 | int main() 20 | { 21 | if (((int)Z::a == 5) && ((int)Z::b == 13) 22 | && ((int)Z::c == 24)) 23 | return 0; 24 | else 25 | return 1; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /compiler/enumcomp.cpp: -------------------------------------------------------------------------------- 1 | // BZ_ENUM_COMPUTATIONS 2 | 3 | struct foo { 4 | enum { a = 5, b = 7, c = 2 }; 5 | }; 6 | 7 | struct bar { 8 | enum { a = 1, b = 6, c = 9 }; 9 | }; 10 | 11 | template 12 | struct Z { 13 | enum { a = (T1::a > T2::a) ? T1::a : T2::b, 14 | b = T1::b + T2::b, 15 | c = (T1::c * T2::c + T2::a + T1::a) 16 | }; 17 | }; 18 | 19 | int main() 20 | { 21 | if (((int)Z::a == 5) && ((int)Z::b == 13) 22 | && ((int)Z::c == 24)) 23 | return 0; 24 | else 25 | return 1; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /compiler/except.cpp: -------------------------------------------------------------------------------- 1 | // Exceptions 2 | // BZ_EXCEPTIONS 3 | 4 | #include 5 | 6 | class foo { }; 7 | 8 | int divide(int a, int b) 9 | { 10 | if (b == 0) 11 | throw foo(); 12 | 13 | return a / b; 14 | } 15 | 16 | int main() 17 | { 18 | try { 19 | divide(5,0); 20 | } 21 | catch(foo x) { 22 | return 0; 23 | } 24 | 25 | return 1; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /compiler/explicit.cpp: -------------------------------------------------------------------------------- 1 | // 'explicit' keyword 2 | // BZ_EXPLICIT 3 | 4 | class vector { 5 | public: 6 | explicit vector(double) 7 | { } 8 | }; 9 | 10 | int main() 11 | { 12 | double c = 5.0; 13 | vector x(c); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /compiler/fullspec.cpp: -------------------------------------------------------------------------------- 1 | // Special syntax for full specialization 2 | 3 | template 4 | class foo { 5 | public: 6 | int bar() const 7 | { return 1; } 8 | }; 9 | 10 | template<> 11 | class foo { 12 | public: 13 | int bar() const 14 | { return 0; } 15 | }; 16 | 17 | int main() 18 | { 19 | foo z; 20 | return z.bar(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /compiler/getruse.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | struct rusage resUsage; 6 | getrusage(RUSAGE_SELF, &resUsage); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /compiler/instant.cpp: -------------------------------------------------------------------------------- 1 | // Explicit template instantiation 2 | // BZ_EXPLICIT_TEMPLATE_INSTANTIATION 3 | 4 | template 5 | class Vector { 6 | public: 7 | Vector() { } 8 | }; 9 | 10 | template class Vector; 11 | 12 | int main() 13 | { 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /compiler/mathscop.cpp: -------------------------------------------------------------------------------- 1 | // Where are those pesky math functions? 2 | // BZ_MATH_FN_IN_NAMESPACE_STD 3 | 4 | #include 5 | 6 | namespace blitz { 7 | double pow(double x, double y) 8 | { return std::pow(x,y); } 9 | }; 10 | 11 | int main() 12 | { 13 | using namespace blitz; 14 | double x = 1.0, y = 1.0; 15 | blitz::pow(x,y); 16 | return 0; 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /compiler/membcnst.cpp: -------------------------------------------------------------------------------- 1 | // Member constants 2 | 3 | class Foo { 4 | public: 5 | static const int value = 0; 6 | }; 7 | 8 | const int Foo::value; 9 | 10 | int main() 11 | { 12 | return Foo::value; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /compiler/membtmp2.cpp: -------------------------------------------------------------------------------- 1 | // Test member function templates #2: declaration of member templates outside 2 | // the class. 3 | // BZ_MEMBER_TEMPLATES_OUTSIDE_CLASS 4 | 5 | template 6 | class Foo { 7 | 8 | public: 9 | template 10 | Foo operator=(const Foo& z); 11 | }; 12 | 13 | template template 14 | Foo Foo::operator=(const Foo& z) 15 | { 16 | return Foo(); 17 | } 18 | 19 | int main() 20 | { 21 | Foo x; 22 | Foo y; 23 | x = y; 24 | 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /compiler/membtmpl.cpp: -------------------------------------------------------------------------------- 1 | // Test member function templates 2 | // BZ_MEMBER_TEMPLATES 3 | 4 | template 5 | class Foo { 6 | 7 | public: 8 | template 9 | Foo operator=(const Foo&); 10 | }; 11 | 12 | template template 13 | Foo Foo::operator=(const Foo& z) 14 | { 15 | return Foo(); 16 | } 17 | 18 | int main() 19 | { 20 | Foo x; 21 | Foo y; 22 | x = y; 23 | 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /compiler/mutable.cpp: -------------------------------------------------------------------------------- 1 | // 'mutable' keyword 2 | // BZ_MUTABLE 3 | 4 | class num { 5 | 6 | public: 7 | num(int z) 8 | { 9 | x_ = z; 10 | numReads_ = 0; 11 | } 12 | 13 | void set(int z) 14 | { x_ = z; } 15 | 16 | int get() const 17 | { 18 | ++numReads_; 19 | return x_; 20 | } 21 | 22 | private: 23 | int x_; 24 | mutable int numReads_; 25 | }; 26 | 27 | int main() 28 | { 29 | num q(4); 30 | q.set(5); 31 | int k = q.get(); 32 | q.get(); 33 | return 0; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /compiler/namespac.cpp: -------------------------------------------------------------------------------- 1 | // BZ_NAMESPACES 2 | 3 | namespace computers { 4 | 5 | class keyboard { 6 | public: 7 | int getkey() const; 8 | }; 9 | 10 | int keyboard::getkey() const 11 | { 12 | return 0; 13 | } 14 | 15 | } 16 | 17 | namespace music { 18 | 19 | class keyboard { 20 | public: 21 | void playNote(int note); 22 | }; 23 | 24 | } 25 | 26 | namespace music { 27 | 28 | void keyboard::playNote(int note) 29 | { 30 | } 31 | 32 | namespace foo { 33 | template void Xeg(T) { } 34 | } 35 | 36 | } 37 | 38 | using namespace computers; 39 | 40 | int main() 41 | { 42 | keyboard x; 43 | int z = x.getkey(); 44 | 45 | music::keyboard y; 46 | y.playNote(z); 47 | 48 | using namespace music::foo; 49 | Xeg(z); 50 | 51 | return 0; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /compiler/nontype.cpp: -------------------------------------------------------------------------------- 1 | // Test function templates with non-type parameters 2 | // BZ_FUNCTION_NONTYPE_PARAMETERS 3 | 4 | template 5 | class Foo { 6 | }; 7 | 8 | template 9 | void showFoo(const Foo& x) 10 | { 11 | } 12 | 13 | int main() 14 | { 15 | Foo z; 16 | showFoo(z); 17 | return 0; 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /compiler/numlimit.cpp: -------------------------------------------------------------------------------- 1 | // numeric_limits class 2 | 3 | #include 4 | 5 | #ifndef BZ_NO_NAMESPACES 6 | using namespace std; 7 | #endif 8 | 9 | int main() 10 | { 11 | double e = numeric_limits::epsilon(); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /compiler/numtrait.cpp: -------------------------------------------------------------------------------- 1 | #ifdef BZ_NO_TYPENAME 2 | #define typename 3 | #endif 4 | 5 | 6 | // BZ_USE_NUMTRAIT 7 | 8 | template 9 | class SumType { 10 | public: 11 | typedef T_numtype T_sumtype; 12 | }; 13 | 14 | template<> 15 | class SumType { 16 | public: 17 | typedef int T_sumtype; 18 | }; 19 | 20 | template 21 | class Vector { 22 | }; 23 | 24 | template 25 | Vector::T_sumtype> 26 | sum(Vector) 27 | { 28 | return Vector::T_sumtype>(); 29 | } 30 | 31 | int main() 32 | { 33 | Vector x; 34 | sum(x); 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /compiler/oldfor.cpp: -------------------------------------------------------------------------------- 1 | // Old 'for' scoping rules 2 | 3 | int main() 4 | { 5 | long z = 0; 6 | 7 | for (int i=0; i < 10; ++i) 8 | { 9 | z = z + i; 10 | } 11 | 12 | z = i; 13 | 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /compiler/partial.cpp: -------------------------------------------------------------------------------- 1 | // Partial specialization 2 | // BZ_PARTIAL_SPECIALIZATION 3 | 4 | template 5 | class foo { 6 | public: 7 | enum bar { z = 0 }; 8 | }; 9 | 10 | template 11 | class foo { 12 | public: 13 | enum bar { z = 1 }; 14 | }; 15 | 16 | template 17 | class foo { 18 | public: 19 | enum bar { z = 2 }; 20 | }; 21 | 22 | int main() 23 | { 24 | if ((foo::z == 0) && (foo::z == 1) 25 | && (foo::z == 2)) 26 | return 0; 27 | else 28 | return 1; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /compiler/porder.cpp: -------------------------------------------------------------------------------- 1 | // Partial ordering of member templates 2 | // BZ_PARTIAL_ORDERING 3 | 4 | template 5 | struct I { 6 | }; 7 | 8 | template 9 | struct A { 10 | 11 | int r; 12 | 13 | template 14 | void operator()(T1, T2) 15 | { r = 0; } 16 | 17 | template 18 | void operator()(I, I) 19 | { r = 1; } 20 | }; 21 | 22 | int main() 23 | { 24 | A x; 25 | I<0> a; 26 | I<1> b; 27 | 28 | x(a,b); 29 | if (x.r != 1) 30 | return 1; 31 | 32 | x(float(), double()); 33 | if (x.r != 0) 34 | return 1; 35 | 36 | return 0; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /compiler/promote.cpp: -------------------------------------------------------------------------------- 1 | #ifndef HAVE_TYPENAME 2 | #define typename 3 | #endif 4 | 5 | template 6 | struct vec3 { T data_[3]; }; 7 | 8 | template 9 | struct promote_trait { typedef T1 T_promote; }; 10 | template <> 11 | struct promote_trait { typedef double T_promote; }; 12 | 13 | template 14 | vec3::T_promote> 15 | operator+(const vec3& a, const vec3& b) { 16 | vec3::T_promote> c; 17 | c.data_[0] = a.data_[0] + b.data_[0]; 18 | c.data_[1] = a.data_[1] + b.data_[1]; 19 | c.data_[2] = a.data_[2] + b.data_[2]; 20 | return c; 21 | } 22 | 23 | int main() { 24 | vec3 a,b; 25 | vec3 c,d,e; 26 | b=a+a; 27 | d=c+c; 28 | e=b+d; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /compiler/reinterp.cpp: -------------------------------------------------------------------------------- 1 | // Reinterpret cast 2 | 3 | #include 4 | 5 | class Dog { 6 | public: 7 | Dog() { } 8 | virtual void fetch() = 0; 9 | }; 10 | 11 | class Dalmation : public Dog { 12 | public: 13 | Dalmation() { } 14 | virtual void fetch(); 15 | }; 16 | 17 | void Dalmation::fetch() 18 | { 19 | } 20 | 21 | class Unrelated { 22 | public: 23 | Unrelated() { } 24 | 25 | }; 26 | 27 | void foo(Unrelated&) 28 | { } 29 | 30 | int main() 31 | { 32 | Dalmation cairo; 33 | Dog& dog = cairo; 34 | Unrelated& eek = reinterpret_cast(dog); 35 | foo(eek); 36 | return 0; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /compiler/restric2.cpp: -------------------------------------------------------------------------------- 1 | // egcs support for restrict, but as "__restrict__" 2 | // BZ_NCEG_RESTRIC2 3 | 4 | void add(int length, double * __restrict__ a, const double * __restrict__ b, 5 | const double * __restrict__ c) 6 | { 7 | for (int i=0; i < length; ++i) 8 | a[i] = b[i] + c[i]; 9 | } 10 | 11 | int main() 12 | { 13 | double a[10], b[10], c[10]; 14 | for (int i=0; i < 10; ++i) 15 | { 16 | a[i] = 0.; 17 | b[i] = 0.; 18 | c[i] = 0.; 19 | } 20 | 21 | add(10,a,b,c); 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /compiler/restrict.cpp: -------------------------------------------------------------------------------- 1 | // Numerical C Extensions Group (NCEG) keyword 'restrict' 2 | // BZ_NCEG_RESTRICT 3 | 4 | void add(int length, double * restrict a, const double * restrict b, 5 | const double * restrict c) 6 | { 7 | for (int i=0; i < length; ++i) 8 | a[i] = b[i] + c[i]; 9 | } 10 | 11 | int main() 12 | { 13 | double a[10], b[10], c[10]; 14 | for (int i=0; i < 10; ++i) 15 | { 16 | a[i] = 0.; 17 | b[i] = 0.; 18 | c[i] = 0.; 19 | } 20 | 21 | add(10,a,b,c); 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /compiler/rtti.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class Dog { 4 | public: 5 | Dog() { } 6 | virtual void fetch() = 0; 7 | }; 8 | 9 | class Dalmation : public Dog { 10 | public: 11 | Dalmation() { } 12 | virtual void fetch(); 13 | }; 14 | 15 | void Dalmation::fetch() 16 | { 17 | } 18 | 19 | int main() 20 | { 21 | Dalmation z; 22 | Dog* y = &z; 23 | 24 | if (typeid(*y) == typeid(Dalmation)) 25 | { 26 | return 0; 27 | } 28 | 29 | return 1; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /compiler/statcast.cpp: -------------------------------------------------------------------------------- 1 | // static_cast 2 | 3 | #include 4 | 5 | class Dog { 6 | public: 7 | Dog() { } 8 | virtual void fetch() = 0; 9 | }; 10 | 11 | class Dalmation : public Dog { 12 | public: 13 | Dalmation() { } 14 | virtual void fetch(); 15 | }; 16 | 17 | void Dalmation::fetch() 18 | { 19 | } 20 | 21 | void foo(Dalmation&) 22 | { } 23 | 24 | int main() 25 | { 26 | Dalmation cairo; 27 | Dog& dog = cairo; 28 | 29 | Dalmation& spotted = static_cast(dog); 30 | foo(spotted); 31 | 32 | return 0; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /compiler/std.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #ifndef BZ_NO_NAMESPACES 6 | using namespace std; 7 | #endif 8 | 9 | int main() 10 | { 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /compiler/stl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef BZ_NO_NAMESPACES 5 | using namespace std; 6 | #endif 7 | 8 | int main() 9 | { 10 | list x; 11 | x.push_back(5); 12 | x.push_back(10); 13 | 14 | int sum = 0; 15 | 16 | for (list::iterator iter = x.begin(); 17 | iter != x.end(); ++iter) 18 | { 19 | sum += *iter; 20 | } 21 | 22 | if (sum != 15) 23 | return 1; 24 | 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /compiler/sysvmath.cpp: -------------------------------------------------------------------------------- 1 | // BZ_HAVE_SYSTEM_V_MATH 2 | 3 | #ifndef _ALL_SOURCE 4 | #define _ALL_SOURCE 5 | #endif 6 | 7 | #ifndef _XOPEN_SOURCE 8 | #define _XOPEN_SOURCE 9 | #endif 10 | 11 | #ifndef _XOPEN_SOURCE_EXTENDED 12 | #define _XOPEN_SOURCE_EXTENDED 1 13 | #endif 14 | 15 | #include 16 | 17 | int main() 18 | { 19 | double x = 1.0; 20 | double y = 1.0; 21 | 22 | _class(x); 23 | itrunc(x); 24 | nearest(x); 25 | rsqrt(x); 26 | uitrunc(x); 27 | 28 | copysign(x,y); 29 | drem(x,y); 30 | hypot(x,y); 31 | nextafter(x,y); 32 | remainder(x,y); 33 | scalb(x,y); 34 | unordered(x,y); 35 | 36 | return 0; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /compiler/tempkey.cpp: -------------------------------------------------------------------------------- 1 | // 'template' keyword qualifier 2 | // BZ_TEMPLATE_KEYWORD_QUALIFIER 3 | 4 | class Foo { 5 | public: 6 | Foo() { }; 7 | template static T convert() { return T(); } 8 | }; 9 | 10 | template 11 | double f() { 12 | return Foo::template convert(); 13 | } 14 | 15 | int main() 16 | { 17 | double z = f(); 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /compiler/template.cpp: -------------------------------------------------------------------------------- 1 | // Basic templates 2 | 3 | template 4 | class Vector { 5 | public: 6 | Vector() { } 7 | }; 8 | 9 | template 10 | void foo(const Vector& ) 11 | { } 12 | 13 | int main() 14 | { 15 | Vector x; 16 | Vector z; 17 | foo(x); 18 | foo(z); 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /compiler/tempqmt.cpp: -------------------------------------------------------------------------------- 1 | #ifdef BZ_NO_TYPENAME 2 | #define typename 3 | #endif 4 | 5 | // BZ_TEMPLATE_SCOPED_ARGUMENT_MATCHING 6 | template 7 | class A { 8 | public: 9 | typedef X W; 10 | }; 11 | 12 | template 13 | class B { 14 | 15 | }; 16 | 17 | template 18 | void operator+(B d1, typename Y::W d2) 19 | { 20 | } 21 | 22 | int main() 23 | { 24 | B > z; 25 | z + 0.5f; // match +(B>, A::W) 26 | // +(B>, float) ...? 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /compiler/tempqual.cpp: -------------------------------------------------------------------------------- 1 | // Explicit template function qualification 2 | // BZ_EXPLICIT_TEMPLATE_FUNCTION_QUALIFICATION 3 | 4 | template 5 | class Vector { 6 | public: 7 | Vector() { } 8 | }; 9 | 10 | 11 | template 12 | Vector to(const Vector&) 13 | { 14 | return Vector(); 15 | } 16 | 17 | int main() 18 | { 19 | Vector x; 20 | Vector y = to(x); 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /compiler/temptemp.cpp: -------------------------------------------------------------------------------- 1 | // Templates as template arguments 2 | // BZ_TEMPLATES_AS_TEMPLATE_ARGUMENTS 3 | 4 | template 5 | class allocator { 6 | public: 7 | allocator() { }; 8 | }; 9 | 10 | template class T_alloc> 11 | class foo { 12 | public: 13 | foo() { } 14 | 15 | private: 16 | T_alloc alloc_; 17 | }; 18 | 19 | int main() 20 | { 21 | foo x; 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /compiler/typename.cpp: -------------------------------------------------------------------------------- 1 | template 2 | class X { 3 | public: 4 | X() { } 5 | }; 6 | 7 | int main() 8 | { 9 | X z; 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /compiler/vac.icc: -------------------------------------------------------------------------------- 1 | option 2 | link(debug) 3 | { 4 | target "bzjunk" 5 | { 6 | source type(cpp) "bzjunk.cpp" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /compiler/valarray.cpp: -------------------------------------------------------------------------------- 1 | // valarray class 2 | 3 | #include 4 | 5 | #ifndef BZ_NO_NAMESPACES 6 | using namespace std; 7 | #endif 8 | 9 | int main() 10 | { 11 | valarray x(100); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /doc/about.texi: -------------------------------------------------------------------------------- 1 | 2 | @node about, platforms, , Introduction 3 | @section About this document 4 | 5 | To use the Blitz++ library, you will need a compiler with near-ISO/ANSI C++ 6 | syntax support (see the following section for possible compilers). 7 | Information on what platforms are supported is available from 8 | @uref{http://oonumerics.org/blitz/platforms/}. To download Blitz++, please 9 | go to the download page at @uref{http://oonumerics.org/blitz/download/}. 10 | 11 | If you need to do something that Blitz++ doesn't support, see a possible 12 | improvement, or notice an error in the documentation, please send a note to 13 | one of the Blitz++ mailing lists (described later). 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/arrays-types.texi: -------------------------------------------------------------------------------- 1 | 2 | @node Array types, Array ctors, Array intro, Arrays 3 | @section Public types 4 | 5 | The @code{Array} class declares these public types: 6 | 7 | @itemize @bullet 8 | 9 | @item @code{T_numtype} is the element type stored in the array. For 10 | example, the type @code{Array::T_numtype} would be @code{double}. 11 | 12 | @item @code{T_index} is a vector index into the array. The class 13 | @code{TinyVector} is used for this purpose. 14 | 15 | @item @code{T_array} is the array type itself 16 | (@code{Array}) 17 | 18 | @item @code{T_iterator} is an iterator type. NB: this iterator is not 19 | yet fully implemented, and is NOT STL compatible at the present time. 20 | 21 | @end itemize 22 | 23 | -------------------------------------------------------------------------------- /doc/blitz.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/blitz.gif -------------------------------------------------------------------------------- /doc/blitztiny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/blitztiny.jpg -------------------------------------------------------------------------------- /doc/constants.texi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/constants.texi -------------------------------------------------------------------------------- /doc/copyright.texi: -------------------------------------------------------------------------------- 1 | 2 | 3 | The Blitz++ library is licensed under both the GPL and the more permissive 4 | ``Blitz++ Artistic License''. Take your pick. They are detailed in GPL 5 | and LICENSE, respectively. The artistic license is more appropriate for 6 | commercial use, since it lacks the ``viral'' properties of the GPL. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | Copyright @copyright{} 1996--2003 Free Software Foundation, Inc. 14 | 15 | -------------------------------------------------------------------------------- /doc/download.texi: -------------------------------------------------------------------------------- 1 | 2 | @node download, install, platforms, Introduction 3 | @section How to download Blitz++ 4 | 5 | The Blitz++ project is now being served via SourceForge. 6 | To download the Blitz++ library, go to the blitz project web page, at 7 | @uref{http://sourceforge.net/projects/blitz}. 8 | 9 | More information about supported platforms and C++ compilers is available 10 | in this document or on the official Blitz++ home page, at 11 | @uref{http://oonumerics.org/blitz}. 12 | 13 | -------------------------------------------------------------------------------- /doc/examples/cast.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A(4), B(4); 9 | Array C(4); 10 | 11 | A = 1, 2, 3, 5; 12 | B = 2, 2, 2, 7; 13 | 14 | C = A / B; 15 | cout << C << endl; 16 | 17 | #ifdef BZ_NEW_EXPRESSION_TEMPLATES 18 | C = A / cast(B); 19 | #else 20 | C = A / cast(B, float()); 21 | #endif 22 | cout << C << endl; 23 | 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /doc/examples/debug.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array, 2> Z(4,4); 8 | 9 | Z = complex(0.0, 1.0); 10 | 11 | Z(4,4) = complex(1.0, 0.0); 12 | 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /doc/examples/dump.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(3,7,8,2,FortranArray<4>()); 8 | A.dumpStructureInformation(cerr); 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /doc/examples/fixed.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include // FixedPoint class 3 | 4 | int main() 5 | { 6 | // Create an array using the FixedPoint class: 7 | 8 | Array A(4,4), B(4,4); 9 | 10 | A = 0.5, 0.3, 0.8, 0.2, 11 | 0.1, 0.3, 0.2, 0.9, 12 | 0.0, 1.0, 0.7, 0.4, 13 | 0.2, 0.3, 0.8, 0.4; 14 | 15 | B = A + 0.05; 16 | 17 | cout << "B = " << B << endl; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /doc/examples/io.data: -------------------------------------------------------------------------------- 1 | (0,2) x (0,3) x (0,4) 2 | [ 111 211 311 411 511 3 | 121 221 321 421 521 4 | 131 231 331 431 531 5 | 141 241 341 441 541 6 | 112 212 312 412 512 7 | 122 222 322 422 522 8 | 132 232 332 432 532 9 | 142 242 342 442 542 10 | 113 213 313 413 513 11 | 123 223 323 423 523 12 | 133 233 333 433 533 13 | 143 243 343 443 543 ] 14 | 15 | (0,2) x (0,3) 16 | [ 11 21 31 41 17 | 12 22 32 42 18 | 13 23 33 43 ] 19 | 20 | (0,3) 21 | [ 1 2 3 4 ] 22 | 23 | -------------------------------------------------------------------------------- /doc/examples/makefile.example: -------------------------------------------------------------------------------- 1 | # Path where Blitz++ is installed 2 | BZDIR = /usr/local/blitz 3 | 4 | CXX = g++ 5 | 6 | # Flags for optimized executables 7 | # CXXFLAGS = -O2 -I$(BZDIR) -ftemplate-depth-30 8 | 9 | # Flags for debugging 10 | CXXFLAGS = -ftemplate-depth-30 -g -DBZ_DEBUG -I$(BZDIR) 11 | 12 | LDFLAGS = 13 | LIBS = -L$(BZDIR)/lib -lblitz -lm 14 | 15 | TARGETS = myprogram1 myprogram2 16 | 17 | .SUFFIXES: .o .cpp 18 | 19 | .cpp.o: 20 | $(CXX) $(CXXFLAGS) -c $*.cpp 21 | 22 | $(TARGETS): 23 | $(CXX) $(LDFLAGS) $@@.o -o $@@ $(LIBS) 24 | 25 | all: 26 | $(TARGETS) 27 | 28 | myprogram1: myprogram1.o 29 | myprogram2: myprogram2.o 30 | 31 | clean: 32 | -rm -f *.o $(TARGETS) 33 | -------------------------------------------------------------------------------- /doc/examples/outer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array x(4), y(4); 8 | Array A(4,4); 9 | 10 | x = 1, 2, 3, 4; 11 | y = 1, 0, 0, 1; 12 | 13 | firstIndex i; 14 | secondIndex j; 15 | 16 | A = x(i) * y(j); 17 | 18 | cout << A << endl; 19 | 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /doc/examples/output.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(4,5,FortranArray<2>()); 8 | firstIndex i; 9 | secondIndex j; 10 | A = 10*i + j; 11 | 12 | cout << "A = " << A << endl; 13 | 14 | Array B(20); 15 | B = exp(-i/100.); 16 | 17 | cout << "B = " << endl << B << endl; 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /doc/examples/range.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(7); 8 | A = 0, 1, 2, 3, 4, 5, 6; 9 | 10 | cout << A(Range::all()) << endl // [ 0 1 2 3 4 5 6 ] 11 | << A(Range(3,5)) << endl // [ 3 4 5 ] 12 | << A(Range(3,toEnd)) << endl // [ 3 4 5 6 ] 13 | << A(Range(fromStart,3)) << endl // [ 0 1 2 3 ] 14 | << A(Range(1,5,2)) << endl // [ 1 3 5 ] 15 | << A(Range(5,1,-2)) << endl // [ 5 3 1 ] 16 | << A(Range(fromStart,toEnd,2)) << endl; // [ 0 2 4 6 ] 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /doc/examples/simple.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(3,3), B(3,3), C(3,3); 8 | 9 | A = 1, 0, 0, 10 | 2, 2, 2, 11 | 1, 0, 0; 12 | 13 | B = 0, 0, 7, 14 | 0, 8, 0, 15 | 9, 9, 9; 16 | 17 | C = A + B; 18 | 19 | cout << "A = " << A << endl 20 | << "B = " << B << endl 21 | << "C = " << C << endl; 22 | 23 | return 0; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /doc/examples/slicing.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(6,6), B(3,3); 8 | 9 | // Set the upper left quadrant of A to 5 10 | A(Range(0,2), Range(0,2)) = 5; 11 | 12 | // Set the upper right quadrant of A to an identity matrix 13 | B = 1, 0, 0, 14 | 0, 1, 0, 15 | 0, 0, 1; 16 | A(Range(0,2), Range(3,5)) = B; 17 | 18 | // Set the fourth row to 1 19 | A(3, Range::all()) = 1; 20 | 21 | // Set the last two rows to 0 22 | A(Range(4, toEnd), Range::all()) = 0; 23 | 24 | // Set the bottom right element to 8 25 | A(5,5) = 8; 26 | 27 | cout << "A = " << A << endl; 28 | 29 | return 0; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /doc/examples/strideslice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(8,8); 8 | A = 0; 9 | 10 | Array B = A(Range(1,7,3), Range(1,5,2)); 11 | B = 1; 12 | 13 | cout << "A = " << A << endl; 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /doc/examples/xor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(4), B(4), C(4); 8 | A = 0, 1, 2, 3; 9 | B = 0, 1, 0, 3; 10 | C = A ^ B; 11 | cout << C << endl; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /doc/indirect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/indirect.gif -------------------------------------------------------------------------------- /doc/indirect.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/indirect.pdf -------------------------------------------------------------------------------- /doc/indirect.txt: -------------------------------------------------------------------------------- 1 | [picture] 2 | -------------------------------------------------------------------------------- /doc/legal.texi: -------------------------------------------------------------------------------- 1 | 2 | @node legal, help, compiling, Introduction 3 | @section Licensing terms 4 | 5 | @include copyright.texi 6 | -------------------------------------------------------------------------------- /doc/makedatestring: -------------------------------------------------------------------------------- 1 | echo "(" `date +"%B %d, %Y"` ")" 2 | 3 | -------------------------------------------------------------------------------- /doc/sinsoid.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/sinsoid.gif -------------------------------------------------------------------------------- /doc/sinsoid.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/sinsoid.pdf -------------------------------------------------------------------------------- /doc/sinsoid.txt: -------------------------------------------------------------------------------- 1 | [image] 2 | -------------------------------------------------------------------------------- /doc/slice.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/slice.gif -------------------------------------------------------------------------------- /doc/slice.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/slice.pdf -------------------------------------------------------------------------------- /doc/slice.txt: -------------------------------------------------------------------------------- 1 | [image] 2 | -------------------------------------------------------------------------------- /doc/stamp-vti: -------------------------------------------------------------------------------- 1 | @set UPDATED 27 June 2012 2 | @set UPDATED-MONTH June 2012 3 | @set EDITION 0.10 4 | @set VERSION 0.10 5 | -------------------------------------------------------------------------------- /doc/strideslice.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/strideslice.gif -------------------------------------------------------------------------------- /doc/strideslice.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/strideslice.pdf -------------------------------------------------------------------------------- /doc/strideslice.txt: -------------------------------------------------------------------------------- 1 | [image] 2 | -------------------------------------------------------------------------------- /doc/tau.texi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/tau.texi -------------------------------------------------------------------------------- /doc/tensor1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/tensor1.gif -------------------------------------------------------------------------------- /doc/tensor1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/tensor1.pdf -------------------------------------------------------------------------------- /doc/tensor1.txt: -------------------------------------------------------------------------------- 1 | [image] 2 | -------------------------------------------------------------------------------- /doc/tinymatrix.texi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/tinymatrix.texi -------------------------------------------------------------------------------- /doc/tuning.texi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/doc/tuning.texi -------------------------------------------------------------------------------- /doc/version.texi: -------------------------------------------------------------------------------- 1 | @set UPDATED 27 June 2012 2 | @set UPDATED-MONTH June 2012 3 | @set EDITION 0.10 4 | @set VERSION 0.10 5 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Old examples that have been removed... Add then again ? 2 | # cfd curldiv diff erf indirect pauli pick profile qcd rangexpr stencil3 stencil stencilet tiny2 tiny3 transform) 3 | 4 | add_custom_target(examples) 5 | 6 | set(ALL_EXAMPLES 7 | array cartesian cast complex-test convolve deriv fixed 8 | io iter matmult nested numinquire outer polymorph prettyprint 9 | rand2 random reduce simple slicing stencil2 10 | storage tiny useret where whitt) 11 | 12 | TESTS(examples ${ALL_EXAMPLES}) 13 | 14 | add_custom_target(check-examples 15 | DEPENDS blitz examples 16 | COMMAND ${CMAKE_BUILD_TOOL} test) 17 | 18 | set(EXAMPLES) 19 | foreach (example ${ALL_EXAMPLES}) 20 | list(APPEND EXAMPLES ${example}.cpp) 21 | endforeach() 22 | 23 | install(FILES ${EXAMPLES} DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) 24 | -------------------------------------------------------------------------------- /examples/cartesian.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | list index1; 10 | index1.push_back(5); 11 | index1.push_back(7); 12 | index1.push_back(9); 13 | 14 | list index2; 15 | index2.push_back(1); 16 | index2.push_back(2); 17 | index2.push_back(4); 18 | index2.push_back(7); 19 | 20 | CartesianProduct,list,2> indexSet(index1,index2); 21 | typedef CartesianProduct,list,2>::iterator T_iterator; 22 | 23 | T_iterator iter = indexSet.begin(), end = indexSet.end(); 24 | for (; iter != end; ++iter) 25 | cout << *iter << endl; 26 | 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/cast.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * cast.cpp Illustration of the cast() function 3 | *****************************************************************************/ 4 | 5 | #include 6 | 7 | using namespace blitz; 8 | 9 | int main() 10 | { 11 | Array A(4), B(4); 12 | Array C(4); 13 | 14 | A = 1, 2, 3, 5; 15 | B = 2, 2, 2, 7; 16 | 17 | C = A / B; 18 | cout << C << endl; 19 | 20 | #ifdef BZ_NEW_EXPRESSION_TEMPLATES 21 | C = A / cast(B); 22 | #else 23 | C = A / cast(B, float()); 24 | #endif 25 | cout << C << endl; 26 | 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/convolve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array B(Range(-2,+2)); 9 | Array C(Range(10,15)); 10 | 11 | B = 1, 0, 2, 5, 3; 12 | C = 10, 2, 4, 1, 7, 2; 13 | 14 | Array A = convolve(B,C); 15 | 16 | cout << "A has domain " << A.lbound(0) << "..." << A.ubound(0) << endl 17 | << A << endl; 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /examples/iter.cpp: -------------------------------------------------------------------------------- 1 | // Example of using Array::iterator 2 | 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | // Create a 4x4 array and fill it with some numbers 10 | 11 | Array A(4,4); 12 | A = tensor::i * 10 + tensor::j; 13 | cout << "A = " << A << endl; 14 | 15 | 16 | // Use an iterator to list the array elements 17 | 18 | Array::iterator iter = A.begin(), end = A.end(); 19 | 20 | while (iter != end) 21 | { 22 | cout << iter.position() << '\t' << (*iter) << endl; 23 | ++iter; 24 | } 25 | 26 | return 0; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /examples/nested.cpp: -------------------------------------------------------------------------------- 1 | // Nested heterogeneous arrays 2 | 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | Array,1> A(3); 10 | 11 | A(0).resize(3); 12 | A(0) = 0, 1, 2; 13 | 14 | A(1).resize(5); 15 | A(1) = 5, 7, 18, 2, 1; 16 | 17 | using namespace blitz::tensor; 18 | 19 | A(2).resize(4); 20 | A(2) = pow2(i+1); 21 | 22 | cout << "A = " << A << endl; 23 | 24 | // A = [ [ 0 1 2 ] [ 5 7 18 2 1 ] [ 1 4 9 16 ] ] 25 | 26 | return 0; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /examples/outer.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * outer.cpp Blitz++ outer product (tensor notation) example 3 | * $Id$ 4 | *****************************************************************************/ 5 | 6 | #include 7 | 8 | using namespace blitz; 9 | 10 | int main() 11 | { 12 | Array x(4), y(4); 13 | Array A(4,4); 14 | 15 | x = 1, 2, 3, 4; 16 | y = 1, 0, 0, 1; 17 | 18 | firstIndex i; 19 | secondIndex j; 20 | 21 | A = x(i) * y(j); 22 | 23 | cout << A << endl; 24 | 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /examples/pauli.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | template void sink(T&) { } 7 | 8 | int main() 9 | { 10 | TinyMatrix,4,4> gamma1, gamma3; 11 | TinyVector,4> Psi; 12 | 13 | complex i(0,1); 14 | 15 | gamma1 = 0, i, 0, 0, 16 | i, 0, 0, 0, 17 | 0, 0, 0, -i, 18 | 0, 0, -i, 0; 19 | 20 | gamma3 = 0, 1, 0, 0, 21 | -1, 0, 0, 0, 22 | 0, 0, 0, 1, 23 | 0, 0, -1, 0; 24 | 25 | sink(Psi); 26 | 27 | TinyVector,4> tmp, result; 28 | tmp = product(gamma3,Psi); 29 | result = product(gamma1,tmp); 30 | 31 | sink(result); 32 | return 0; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /examples/polymorph.cpp: -------------------------------------------------------------------------------- 1 | // Polymorphic arrays example 2 | 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | class Material { 8 | public: 9 | virtual double density() const = 0; 10 | }; 11 | 12 | class Air { 13 | public: 14 | virtual double density() const { return 0.291; } 15 | }; 16 | 17 | class Water { 18 | public: 19 | virtual double density() const { return 0.335; } 20 | }; 21 | 22 | int main() 23 | { 24 | Array A(4); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /examples/prettyprint.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(4,4), B(4,4); 8 | Array C(4,4); 9 | 10 | prettyPrintFormat f1; 11 | prettyPrintFormat f2(true); 12 | 13 | string s1, s2, s3, s4; 14 | 15 | (A+B).prettyPrint(s1,f1); 16 | cout << s1 << endl; 17 | (A+B).prettyPrint(s2,f2); 18 | cout << s2 << endl; 19 | (A+B+C).prettyPrint(s3,f1); 20 | cout << s3 << endl; 21 | (A+5*C).prettyPrint(s4,f1); 22 | cout << s4 << endl; 23 | { 24 | prettyPrintFormat f2(true); 25 | string s5; 26 | (A+5*C+cos(B)*A+A+pow2(B)+C).prettyPrint(s5,f2); 27 | cout << s5 << endl; 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /examples/profile.cpp: -------------------------------------------------------------------------------- 1 | #define BZ_TAU_PROFILING 2 | 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | TAU_PROFILE("main()", "int ()", TAU_DEFAULT); 10 | 11 | const int N = 32; 12 | 13 | Array A(N,N), B(N,N), C(N,N), D(N,N), E(N,N); 14 | A = 5.0; 15 | B = 0.0; 16 | C = 0.0; 17 | 18 | for (int i=0; i < 20; ++i) 19 | { 20 | D = A + B + C; 21 | D /= sum(pow2(D)); 22 | A = B * cos(D) + C * sin(D); 23 | B += exp(-D); 24 | 25 | float x = sum(A); 26 | float y = sum(A+B); 27 | float z = sum(sqr(A)+sqr(B)); 28 | C = x*A+y*B+z*C; 29 | 30 | D = exp(-sqr(A)-sqr(B)); 31 | E = A + B + C + D; 32 | float q = min(A); 33 | float r = max(B); 34 | } 35 | 36 | return 0; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/rangexpr.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * rangexpr.cpp Blitz++ range expression example 3 | *****************************************************************************/ 4 | 5 | #include 6 | 7 | using namespace blitz; 8 | 9 | #ifndef M_PI 10 | #define M_PI 3.14159265358979323846 11 | #endif 12 | 13 | int main() 14 | { 15 | Vector x = cos(Range(0,7) * (2.0 * M_PI / 8)); 16 | 17 | cout << x << endl; 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /examples/simple.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * simple.cpp Some simple array operations 3 | *****************************************************************************/ 4 | 5 | #include 6 | 7 | using namespace blitz; 8 | 9 | int main() 10 | { 11 | Array x(100); 12 | x = tensor::i; // x = [ 0, 1, 2, ..., 99 ] 13 | 14 | Array z(x + 150); 15 | Array v(z + x * 2); 16 | 17 | cout << v << endl; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /examples/stencilet.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A(Range(-7,7),Range(-7,7)), B(Range(-7,7),Range(-7,7)); 9 | A = 0.0; 10 | A(0,0) = 1; 11 | B = 0.0; 12 | 13 | Range I(-5,5), J(-5,5); 14 | 15 | Array Ai = A(I,J), Bi = B(I,J); 16 | 17 | Bi = Laplacian2D4n(Ai) * 0.1; 18 | 19 | cout << Bi << endl; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /examples/tiny2.cpp: -------------------------------------------------------------------------------- 1 | #define BZ_DISABLE_KCC_COPY_PROPAGATION_KLUDGE 2 | 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | typedef TinyVector vec; 8 | 9 | inline void reflect(vec& reflection, const vec& incident, 10 | const vec& surfaceNormal) 11 | { 12 | // The surface normal must be unit length to use this equation. 13 | 14 | reflection = incident - 2 * dot(incident,surfaceNormal) * surfaceNormal; 15 | } 16 | 17 | template 18 | void optimizationSink(T&); 19 | 20 | void foo(TinyVector& x) 21 | { 22 | TinyVector y, z; 23 | 24 | y = 1.00, 0.40, -1.00; 25 | z = 0.31, 0.20, 0.93; 26 | 27 | reflect(x, y, z); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/tiny3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | template 7 | void optimizationSink(T&); 8 | 9 | void foo() 10 | { 11 | TinyMatrix A; 12 | TinyVector b, c; 13 | 14 | optimizationSink(A); 15 | optimizationSink(b); 16 | 17 | c = product(A,b); 18 | 19 | optimizationSink(c); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /examples/whitt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | class Base { 6 | public: 7 | virtual void multiply(Array& array) const=0; 8 | }; 9 | 10 | class Derived1 : public Base { 11 | public: 12 | Derived1(){} 13 | void multiply(Array& array) const {array*=1;} 14 | }; 15 | 16 | class Derived2 : public Base { 17 | public: 18 | Derived2(){} 19 | void multiply(Array& array) const {array*=2;} 20 | }; 21 | 22 | Array& operator*=(Array& array, const Derived1& object) { 23 | object.multiply(array); 24 | return array; 25 | } 26 | 27 | int main() 28 | { 29 | Array array(5); 30 | array=1; 31 | 32 | Derived1 derived1; 33 | 34 | array*=derived1; 35 | } 36 | -------------------------------------------------------------------------------- /manual/Frames.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Blitz++ User's Guide 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | <H2> 13 | Frame Alert</H2> 14 | 15 | <P> 16 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 17 | <BR> 18 | Link to <A HREF="overview-summary.html">Non-frame version.</A> 19 | 20 | 21 | -------------------------------------------------------------------------------- /manual/Index-epilogue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /manual/Index-prologue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Table of Contents

7 |
8 | 9 |

Index

10 | 11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /manual/README: -------------------------------------------------------------------------------- 1 | The .yo files that were previously contained in this directory have been 2 | replaced by the .texi files in the doc subdirectory and are now obsolete. 3 | Please consult the doc subdirectory for current blitz documentation. 4 | 5 | Julian C. Cummings 6 | 09-17-04 7 | -------------------------------------------------------------------------------- /manual/arrays-types.yo: -------------------------------------------------------------------------------- 1 | The tt(Array) class declares these public types: 2 | 3 | startit() 4 | 5 | it() tt(T_numtype) is the element type stored in the array. For example, 6 | the type tt(Array::T_numtype) would be tt(double). 7 | 8 | it() tt(T_index) is a vector index into the array. The class 9 | tt(TinyVector) is used for this purpose. 10 | 11 | it() tt(T_array) is the array type itself (tt(Array)) 12 | 13 | it() tt(T_iterator) is an iterator type. NB: this iterator is 14 | not yet fully implemented, and is NOT STL compatible at the 15 | present time. 16 | 17 | endit() 18 | 19 | -------------------------------------------------------------------------------- /manual/blitz.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/blitz.gif -------------------------------------------------------------------------------- /manual/blitztiny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/blitztiny.jpg -------------------------------------------------------------------------------- /manual/classref.html: -------------------------------------------------------------------------------- 1 | 2 | Blitz++ Class Reference 3 | 4 | 5 | 6 |
7 | 8 |

Blitz++ Class Reference

9 | 10 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /manual/constants.yo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/constants.yo -------------------------------------------------------------------------------- /manual/download.yo: -------------------------------------------------------------------------------- 1 | 2 | bzindex(downloading) 3 | 4 | To download the Blitz++ library, go to the Blitz++ 5 | download page, at 6 | url(http://oonumerics.org/blitz/download/)(http://oonumerics.org/blitz/download/) 7 | 8 | But please read the section on supported platforms and compilers 9 | first. 10 | 11 | -------------------------------------------------------------------------------- /manual/examples/cast.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef BZ_NAMESPACES 4 | using namespace blitz; 5 | #endif 6 | 7 | int main() 8 | { 9 | Array A(4), B(4); 10 | Array C(4); 11 | 12 | A = 1, 2, 3, 5; 13 | B = 2, 2, 2, 7; 14 | 15 | C = A / B; 16 | cout << C << endl; 17 | 18 | #ifdef BZ_NEW_EXPRESSION_TEMPLATES 19 | C = A / cast(B); 20 | #else 21 | C = A / cast(B, float()); 22 | #endif 23 | cout << C << endl; 24 | 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /manual/examples/debug.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array, 2> Z(4,4); 8 | 9 | Z = complex(0.0, 1.0); 10 | 11 | Z(4,4) = complex(1.0, 0.0); 12 | 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /manual/examples/dump.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(3,7,8,2,FortranArray<4>()); 8 | A.dumpStructureInformation(cerr); 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /manual/examples/outer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array x(4), y(4); 8 | Array A(4,4); 9 | 10 | x = 1, 2, 3, 4; 11 | y = 1, 0, 0, 1; 12 | 13 | firstIndex i; 14 | secondIndex j; 15 | 16 | A = x(i) * y(j); 17 | 18 | cout << A << endl; 19 | 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /manual/examples/outer.log: -------------------------------------------------------------------------------- 1 | 4 x 4 2 | 1 0 0 1 3 | 2 0 0 2 4 | 3 0 0 3 5 | 4 0 0 4 6 | 7 | -------------------------------------------------------------------------------- /manual/examples/output.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(4,5,FortranArray<2>()); 8 | firstIndex i; 9 | secondIndex j; 10 | A = 10*i + j; 11 | 12 | cout << "A = " << A << endl; 13 | 14 | Array B(20); 15 | B = exp(-i/100.); 16 | 17 | cout << "B = " << endl << B << endl; 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /manual/examples/output.log: -------------------------------------------------------------------------------- 1 | A = 4 x 5 2 | 11 12 13 14 15 3 | 21 22 23 24 25 4 | 31 32 33 34 35 5 | 41 42 43 44 45 6 | 7 | B = 8 | [ 1 0.99005 0.980199 0.970446 0.960789 0.951229 0.941765 9 | 0.932394 0.923116 0.913931 0.904837 0.895834 0.88692 0.878095 10 | 0.869358 0.860708 0.852144 0.843665 0.83527 0.826959 ] 11 | -------------------------------------------------------------------------------- /manual/examples/range.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(7); 8 | A = 0, 1, 2, 3, 4, 5, 6, 7; 9 | 10 | cout << A(Range::all()) << endl // [ 0 1 2 3 4 5 6 ] 11 | << A(Range(3,5)) << endl // [ 3 4 5 ] 12 | << A(Range(3,toEnd)) << endl // [ 3 4 5 6 ] 13 | << A(Range(fromStart,3)) << endl // [ 0 1 2 3 ] 14 | << A(Range(1,5,2)) << endl // [ 1 3 5 ] 15 | << A(Range(5,1,-2)) << endl // [ 5 3 1 ] 16 | << A(Range(fromStart,toEnd,2)) << endl; // [ 0 2 4 6 ] 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /manual/examples/simple.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(3,3), B(3,3), C(3,3); 8 | 9 | A = 1, 0, 0, 10 | 2, 2, 2, 11 | 1, 0, 0; 12 | 13 | B = 0, 0, 7, 14 | 0, 8, 0, 15 | 9, 9, 9; 16 | 17 | C = A + B; 18 | 19 | cout << "A = " << A << endl 20 | << "B = " << B << endl 21 | << "C = " << C << endl; 22 | 23 | return 0; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /manual/examples/simple.log: -------------------------------------------------------------------------------- 1 | (output from simple.cpp) 2 | 3 | -------------------------------------------------------------------------------- /manual/examples/slicing.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(6,6), B(3,3); 8 | 9 | // Set the upper left quadrant of A to 5 10 | A(Range(0,2), Range(0,2)) = 5; 11 | 12 | // Set the upper right quadrant of A to an identity matrix 13 | B = 1, 0, 0, 14 | 0, 1, 0, 15 | 0, 0, 1; 16 | A(Range(0,2), Range(3,5)) = B; 17 | 18 | // Set the fourth row to 1 19 | A(3, Range::all()) = 1; 20 | 21 | // Set the last two rows to 0 22 | A(Range(4, Range::toEnd), Range::all()) = 0; 23 | 24 | // Set the bottom right element to 8 25 | A(5,5) = 8; 26 | 27 | cout << "A = " << A << endl; 28 | 29 | return 0; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /manual/examples/storage.log: -------------------------------------------------------------------------------- 1 | A = 3 x 3 2 | 1 2 3 3 | 4 5 6 4 | 7 8 9 5 | 6 | B = 3 x 3 7 | 1 2 3 8 | 4 5 6 9 | 7 8 9 10 | 11 | C = 3 x 3 12 | 1 2 3 13 | 4 5 6 14 | 7 8 9 15 | 16 | D = 3 x 3 17 | 3 6 9 18 | 12 15 18 19 | 21 24 27 20 | 21 | -------------------------------------------------------------------------------- /manual/examples/strideslice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(8,8); 8 | A = 0; 9 | 10 | Array B = A(Range(1,7,3), Range(1,5,2)); 11 | B = 1; 12 | 13 | cout << "A = " << A << endl; 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /manual/examples/xor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(4), B(4), C(4); 8 | A = 0, 1, 2, 3; 9 | B = 0, 1, 0, 3; 10 | C = A ^ B; 11 | cout << C << endl; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /manual/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Blitz++ User's Guide 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | <H2> 13 | Frame Alert</H2> 14 | 15 | <P> 16 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 17 | <BR> 18 | Link to <A HREF="overview-summary.html">Non-frame version.</A> 19 | 20 | 21 | -------------------------------------------------------------------------------- /manual/indirect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/indirect.gif -------------------------------------------------------------------------------- /manual/legal.yo: -------------------------------------------------------------------------------- 1 | 2 | bzindex(license terms) 3 | 4 | The Blitz++ library is licensed under both the GPL and the more permissive 5 | "Blitz++ Artistic License". Take your pick. They are detailed in GPL 6 | and LICENSE, respectively. The artistic license is more appropriate for 7 | commercial use, since it lacks the "viral" properties of the GPL. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | -------------------------------------------------------------------------------- /manual/makedatestring: -------------------------------------------------------------------------------- 1 | echo "(" `date +"%B %d, %Y"` ")" 2 | 3 | -------------------------------------------------------------------------------- /manual/makeindex: -------------------------------------------------------------------------------- 1 | if ! test -x ./makeHTMLIndex; then 2 | g++ makeHTMLIndex.cpp -o makeHTMLIndex 3 | fi 4 | 5 | ./makeHTMLIndex blitz*.html 6 | sort -f " $2 "
" }' >Index.html 7 | for f in *.new; do mv $f `basename $f .new`; done 8 | cat Index-prologue.html Index.html Index-epilogue.html >INDEX.html 9 | chmod go+r INDEX.html 10 | 11 | -------------------------------------------------------------------------------- /manual/preview: -------------------------------------------------------------------------------- 1 | rm -f $1.tex $1.latex 2 | yodl2tex -l2 $1 3 | # mv $1.latex $1.tex 4 | latex $1 5 | makeindex $1.idx 6 | latex $1 7 | dvips -f $1.dvi >$1.ps 8 | # ghostview $1.ps 9 | 10 | -------------------------------------------------------------------------------- /manual/range.html: -------------------------------------------------------------------------------- 1 | 2 | Blitz++ Class Reference: Range 3 | 4 | 5 |

Blitz++ Class Reference: Range

6 | 7 | An object of type Range represents an ordered set of uniformly 8 | spaced integers. Range objects can be used to initialize 9 | vectors, to refer to subvectors, or as operands in a vector 10 | expression. Here are some examples: 11 | 12 |
13 | Vector<double> x = Range(0,6);         // x = [ 0 1 2 3 4 5 6 ]
14 | cout << x(Range::all()) << endl              // [ 0 1 2 3 4 5 6 ]
15 |      << x(Range(3,5))   << endl              // [ 3 4 5 ]
16 |      << x(Range(3,Range::toEnd))  << endl    // [ 3 4 5 6 ]
17 |      << x(Range(Range::fromStart,3)) << endl // [ 0 1 2 3 ]
18 |      << x(Range(1,5,2)) << endl;             // [ 1 3 5 ]
19 | 
20 | 
21 | 
22 | 


--------------------------------------------------------------------------------
/manual/sinsoid.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/sinsoid.gif


--------------------------------------------------------------------------------
/manual/slice.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/slice.gif


--------------------------------------------------------------------------------
/manual/stencils/Laplacian2D.yo:
--------------------------------------------------------------------------------
 1 | htmlcommand(
 2 | 
 3 | 
 4 | 
 5 | 
 6 | 
-101
-11
01-41
11
) 7 | latexcommand( 8 | \begin{tabular}{r|rrr} 9 | & -1 & 0 & 1 \\ \hline 10 | -1 & & 1 & \\ 11 | 0 & 1 & {\bf -4} & 1 \\ 12 | 1 & & 1 & 13 | \end{tabular} 14 | ) 15 | -------------------------------------------------------------------------------- /manual/stencils/backward11.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-10
-11
) 5 | latexcommand( 6 | \begin{tabular}{r|rr} 7 | & -1 & 0 \\ \hline 8 | & -1 & {\bf 1} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward12.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-10
1-43
) 5 | latexcommand( 6 | \begin{tabular}{r|rrr} 7 | & -2 & -1 & 0 \\ \hline 8 | & 1 & -4 & {\bf 3} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward21.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-10
1-21
) 5 | latexcommand( 6 | \begin{tabular}{r|rrr} 7 | & -2 & -1 & 0 \\ \hline 8 | & 1 & -2 & {\bf 1} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward22.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-3-2-10
-14-52
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrr} 7 | & -3 & -2 & -1 & 0 \\ \hline 8 | & -1 & 4 & -5 & {\bf 2} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward31.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-3-2-10
-13-31
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrr} 7 | & -3 & -2 & -1 & 0 \\ \hline 8 | & -1 & 3 & -3 & {\bf 1} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward32.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-4-3-2-10
3-1424-185
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -4 & -3 & -2 & -1 & 0 \\ \hline 8 | & 3 & -14 & 24 & -18 & {\bf 5} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward41.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-4-3-2-10
1-46-41
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -4 & -3 & -2 & -1 & 0 \\ \hline 8 | & 1 & -4 & 6 & -4 & {\bf 1} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/backward42.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-5-4-3-2-10
-211-2426-143
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrrr} 7 | & -5 & -4 & -3 & -2 & -1 & 0 \\ \hline 8 | & -2 & 11 & -24 & 26 & -14 & {\bf 3} 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central12.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-101
-11
) 5 | latexcommand( 6 | \begin{tabular}{r|rrr} 7 | & -1 & 0 & 1 \\ \hline 8 | & -1 & & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central14.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-1012
1-88-1
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -2 & -1 & 0 & 1 & 2 \\ \hline 8 | & 1 & -8 & & 8 & -1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central22.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-101
1-21
) 5 | latexcommand( 6 | \begin{tabular}{r|rrr} 7 | & -1 & 0 & 1 \\ \hline 8 | & 1 & {\bf -2} & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central24.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-1012
-116-3016-1
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -2 & -1 & 0 & 1 & 2 \\ \hline 8 | & -1 & 16 & {\bf -30} & 16 & -1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central32.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-1012
-12-21
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -2 & -1 & 0 & 1 & 2 \\ \hline 8 | & -1 & 2 & & -2 & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central34.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-1012
-813-138
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -2 & -1 & 0 & 1 & 2 \\ \hline 8 | & -8 & 13 & & -13 & 8 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central42.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-1012
1-46-41
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -2 & -1 & 0 & 1 & 2 \\ \hline 8 | & 1 & -4 & {\bf 6} & -4 & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/central44.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
-2-1012
12-3956-3912
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & -2 & -1 & 0 & 1 & 2 \\ \hline 8 | & 12 & -39 & {\bf 56} & -39 & 12 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/dump1D: -------------------------------------------------------------------------------- 1 | echo $1 2 | dumpst "$1(A,1)" $1 3 | -------------------------------------------------------------------------------- /manual/stencils/dumpdiffs: -------------------------------------------------------------------------------- 1 | dump1D central12 2 | dump1D central22 3 | dump1D central32 4 | dump1D central42 5 | dump1D central14 6 | dump1D central24 7 | dump1D central34 8 | dump1D central44 9 | dump1D forward11 10 | dump1D forward21 11 | dump1D forward31 12 | dump1D forward41 13 | dump1D forward12 14 | dump1D forward22 15 | dump1D forward32 16 | dump1D forward42 17 | dump1D backward11 18 | dump1D backward21 19 | dump1D backward31 20 | dump1D backward41 21 | dump1D backward12 22 | dump1D backward22 23 | dump1D backward32 24 | dump1D backward42 25 | 26 | -------------------------------------------------------------------------------- /manual/stencils/dumpst: -------------------------------------------------------------------------------- 1 | g++ -g -I./../.. -ftemplate-depth-30 -DBZ_DEBUG -Dstenciltoapply=$1 -o dump-stencil dump-stencil.cpp -L../../lib -lblitz -lm 2 | ./dump-stencil >$2.yo 3 | 4 | -------------------------------------------------------------------------------- /manual/stencils/forward11.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
01
-11
) 5 | latexcommand( 6 | \begin{tabular}{r|rr} 7 | & 0 & 1 \\ \hline 8 | & {\bf -1} & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward12.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
012
-34-1
) 5 | latexcommand( 6 | \begin{tabular}{r|rrr} 7 | & 0 & 1 & 2 \\ \hline 8 | & {\bf -3} & 4 & -1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward21.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
012
1-21
) 5 | latexcommand( 6 | \begin{tabular}{r|rrr} 7 | & 0 & 1 & 2 \\ \hline 8 | & {\bf 1} & -2 & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward22.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
0123
2-54-1
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrr} 7 | & 0 & 1 & 2 & 3 \\ \hline 8 | & {\bf 2} & -5 & 4 & -1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward31.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
0123
-13-31
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrr} 7 | & 0 & 1 & 2 & 3 \\ \hline 8 | & {\bf -1} & 3 & -3 & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward32.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
01234
-518-2414-3
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & 0 & 1 & 2 & 3 & 4 \\ \hline 8 | & {\bf -5} & 18 & -24 & 14 & -3 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward41.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
01234
1-46-41
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrr} 7 | & 0 & 1 & 2 & 3 & 4 \\ \hline 8 | & {\bf 1} & -4 & 6 & -4 & 1 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/stencils/forward42.yo: -------------------------------------------------------------------------------- 1 | htmlcommand( 2 | 3 | 4 |
012345
3-1426-2411-2
) 5 | latexcommand( 6 | \begin{tabular}{r|rrrrrr} 7 | & 0 & 1 & 2 & 3 & 4 & 5 \\ \hline 8 | & {\bf 3} & -14 & 26 & -24 & 11 & -2 9 | \end{tabular} 10 | ) 11 | -------------------------------------------------------------------------------- /manual/strideslice.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/strideslice.gif -------------------------------------------------------------------------------- /manual/tau.yo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/tau.yo -------------------------------------------------------------------------------- /manual/tensor1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/tensor1.gif -------------------------------------------------------------------------------- /manual/tinymatrix.yo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/tinymatrix.yo -------------------------------------------------------------------------------- /manual/tuning.yo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blitzpp/blitz/f24a250a43dff88c31ad92916da828b7ea9a98b7/manual/tuning.yo -------------------------------------------------------------------------------- /manual/update: -------------------------------------------------------------------------------- 1 | echo Generating Blitz++ HTML documentation... 2 | yodl2html -l2 blitz.yo 3 | ./makeindex 4 | 5 | echo Generating Blitz++ Latex/PS documentation... 6 | ./preview blitz 7 | 8 | -------------------------------------------------------------------------------- /random/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(RAMDOM_FILES 2 | F.h beta.h chisquare.h default.h discrete-uniform.h exponential.h 3 | gamma.h mt.h mtparam.cc normal.h uniform.h) 4 | 5 | INSTALL(FILES ${RAMDOM_FILES} DESTINATION include/random ) 6 | -------------------------------------------------------------------------------- /testsuite/Adnene-Ben-Abdallah-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array psiElem(3); 8 | psiElem = 9 | -0.121990517304243,-0.099118834514638,-0.164750336116265; 10 | 11 | double psi_max = blitz::max(psiElem); 12 | cout << "psiElem = " << psiElem << endl; 13 | cout << "psi_max = " << psi_max << endl; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /testsuite/Adnene-Ben-Abdallah-2.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | using namespace tensor; 9 | 10 | Array X(4), Y1(4), Y2(4); 11 | X = 1, 2, 3, 4; 12 | Array A(4,4); 13 | A = 1, 2, 3, 4, 14 | 5, 6, 7, 8, 15 | 9, 10, 11, 12, 16 | 13, 14, 15, 16; 17 | 18 | Y1 = 5, 6, 7, 8; 19 | Y2 = 5, 6, 7, 8; 20 | // this does not work under IBM xlC compiler! 21 | #if !defined(_IBMR2) 22 | Y1 += sum(A(i,j) * X(j), j); 23 | Y2 = Y2 + sum(A(i,j)* X(j), j); 24 | #endif 25 | BZTEST(count(Y1==Y2)==4); 26 | 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /testsuite/Josef-Wagenhuber.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | Array A(5,5,FortranArray<2>()); 10 | 11 | A = 1,2,3,4,5, 12 | 6,7,8,9,10, 13 | 11,12,13,14,15, 14 | 16,17,18,19,20, 15 | 21,22,23,24,25; 16 | 17 | // cout << A << endl; 18 | // A.dumpStructureInformation(cout); 19 | Array Asub = A(Range(1,4,3), Range(2,4,2)); 20 | // Asub.dumpStructureInformation(cout); 21 | // cout << A(Range(1,4,3), Range(2,4,2)) << endl; 22 | BZTEST(Asub(1,1) == 6); 23 | BZTEST(Asub(1,2) == 16); 24 | BZTEST(Asub(2,1) == 9); 25 | BZTEST(Asub(2,2) == 19); 26 | return 0; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /testsuite/Olaf-Ronneberger-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main( void) 7 | { 8 | Array A(1,10,10); 9 | Array B(10,10); 10 | 11 | A = 0.0f; 12 | B = 0.0f; 13 | 14 | beginCheckAssert(); 15 | A(1, Range::all(), Range::all()) = B; // first index should have been 0! 16 | endCheckAssert(); 17 | 18 | beginCheckAssert(); 19 | A(1, Range::all(), Range::all()) = B; // not okay: shape error 20 | endCheckAssert(); 21 | 22 | beginCheckAssert(); 23 | A(Range::all(), 10, Range::all()) = 0; // not okay: second index out of range 24 | endCheckAssert(); 25 | 26 | A(0, Range::all(), Range::all()) = B; // okay 27 | 28 | exit(0); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /testsuite/Ulisses-Mello-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array geo(5,10,15); 9 | Array bio; 10 | 11 | geo = -1.0; 12 | 13 | bio.resize(geo.shape()); 14 | BZTEST(geo.extent(0) == bio.extent(0) 15 | && geo.extent(1) == bio.extent(1) 16 | && geo.extent(2) == bio.extent(2)); 17 | 18 | bio = geo; 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /testsuite/arrayinitialize.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array d(5); 9 | d=1,-1,2,-2,0; 10 | BZTEST(d(0) == 1); 11 | BZTEST(d(1) == -1); 12 | BZTEST(d(2) == 2); 13 | BZTEST(d(3) == -2); 14 | BZTEST(d(4) == 0); 15 | 16 | Array c(5); 17 | c=1.0,-1.0,2.0,-2.0,0.0; 18 | BZTEST(c(0) == 1); 19 | BZTEST(c(1) == -1); 20 | BZTEST(c(2) == 2); 21 | BZTEST(c(3) == -2); 22 | BZTEST(c(4) == 0); 23 | 24 | // and finally test initializations where implicit conversions to 25 | // T_numtype are necessary 26 | 27 | Array b(5); 28 | b=1,-1,2,-2,0; 29 | BZTEST(b(0) == 1); 30 | BZTEST(b(1) == -1); 31 | BZTEST(b(2) == 2); 32 | BZTEST(b(3) == -2); 33 | BZTEST(b(4) == 0); 34 | 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /testsuite/cast.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array f(3); 9 | Array d(3),e(3); 10 | f=1,2,4; 11 | e=1,2,4; 12 | 13 | d=cast(f); 14 | BZTEST(all(f==e)); 15 | 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /testsuite/chris-jeffery-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int zippy() 7 | { return 0; } 8 | 9 | int main() 10 | { 11 | if (zippy()) 12 | { 13 | #ifdef BZ_HAVE_COMPLEX 14 | #ifdef BZ_HAVE_COMPLEX_MATH1 15 | 16 | { 17 | Array,1> test(5); 18 | test = sqrt(test); 19 | 20 | Array test2(5); 21 | test2 = sqrt(test2); 22 | } 23 | 24 | #endif // BZ_HAVE_COMPLEX_MATH1 25 | 26 | { 27 | Array,1> test(5),test2(5) ; 28 | Array test3(5) ; 29 | test3 = 0.64f ; 30 | test2 = complex(3,3) ; 31 | test = 2*test3*test2 ; 32 | test = test3*test2; 33 | } 34 | 35 | #endif // BZ_HAVE_COMPLEX 36 | 37 | } 38 | 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /testsuite/chris-jeffery-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array,2> test(4,4) ; 8 | Array test2(2,2) ; 9 | 10 | test2 = real(test(Range(0,1),Range(0,1))) ; 11 | Array test3; 12 | test3.reference(test2(Range(0,1),Range(0,1))); 13 | 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /testsuite/chris-jeffery-3.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | Array test(8,8), test2(5,5) ; 10 | 11 | test = 5; 12 | 13 | Range I(2,6) ; 14 | Range J(3,7) ; 15 | 16 | // Koenig lookup hack 17 | #if defined(__GNUC__) && (__GNUC__ < 3) 18 | test2 = where(blitz::operator> (test(I,J), test(I-1,J)), 0, test(I,J)); 19 | #else 20 | test2 = where(test(I,J) > test(I-1,J), 0, test(I,J)); 21 | #endif 22 | 23 | BZTEST(test2(3,3) == 5); 24 | 25 | cout << test2 << endl ; 26 | 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /testsuite/constarray.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | using namespace blitz::tensor; 6 | 7 | // Test that subarrays may be taken of const arrays. 8 | 9 | void foo(const Array& A) 10 | { 11 | int n1 = sum(A(1,Range::all())); 12 | BZTEST(n1 == 46); 13 | 14 | Array B(4), C(4); 15 | B = sum(A(j,i),j); 16 | C = 60, 64, 68, 72; 17 | BZTEST(count(B==C)==4); 18 | 19 | n1 = sum(A(Range::all(), Range::all())); 20 | BZTEST(n1 == 264); 21 | 22 | n1 = sum(2*A); 23 | BZTEST(n1 == 264*2); 24 | } 25 | 26 | // 0 1 2 3 27 | // 10 11 12 13 28 | // 20 21 22 23 29 | // 30 31 32 33 30 | 31 | int main() 32 | { 33 | Array A(4,4); 34 | 35 | A = 10*i+j; 36 | 37 | foo(A); 38 | 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /testsuite/copy.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A(1); 9 | A(0) = 5; 10 | Array B(1); 11 | B = A; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /testsuite/declfunc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | inline double p(double x) { return 2 * x; } 3 | BZ_DECLARE_FUNCTION(p) 4 | int main() { } 5 | -------------------------------------------------------------------------------- /testsuite/derrick-bass-3.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | 5 | using namespace blitz; 6 | 7 | int main() { 8 | Array A(4); 9 | Array B(4), C(4); 10 | 11 | firstIndex i; 12 | secondIndex j; 13 | 14 | A = i+j; 15 | 16 | B = max(A,j); 17 | 18 | C = 3, 4, 5, 6; 19 | BZTEST(count(B == C) == 4); 20 | 21 | return 0; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /testsuite/exprctor.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | using namespace blitz::tensor; 6 | 7 | int main() 8 | { 9 | Array A(2,3), B(2,3); 10 | 11 | A = 0, 3, 5, 12 | 1, 6, 9; 13 | B = 2, 5, 1, 14 | 9, 3, 4; 15 | 16 | Array C(A+2*B); 17 | Array C2(2,3); 18 | C2 = 4, 13, 7, 19 | 19, 12, 17; 20 | BZTEST(count(C2 == C) == 6); 21 | 22 | beginCheckAssert(); 23 | Array D(i*10+j); 24 | endCheckAssert(); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /testsuite/free.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A(16384); 9 | 10 | Array B(A); 11 | A.free(); 12 | BZTEST(A.data() == 0); 13 | BZTEST(A.extent(0) == 0); 14 | B = 0; // If B's data was accidentally freed, then will hopefully 15 | // cause a segment violation 16 | 17 | B.free(); 18 | BZTEST(B.data() == 0); 19 | BZTEST(B.extent(0) == 0); 20 | 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /testsuite/gary-huber-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | Array< double, 1> a(100); 8 | 9 | int main(){ 10 | 11 | BZTEST(a.size() == 100); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /testsuite/int-math-func.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | // test that math functions operating on integers return doubles and not ints 7 | 8 | int main() 9 | { 10 | Array a(10); 11 | Array b(10); 12 | b=tensor::i; 13 | a=sqrt(b); 14 | 15 | cout << a ; 16 | BZTEST(a(2)==sqrt(2)); 17 | BZTEST(a(5)==sqrt(5)); 18 | 19 | a=sqrt(tensor::i); 20 | cout << a ; 21 | BZTEST(a(2)==sqrt(2)); 22 | BZTEST(a(5)==sqrt(5)); 23 | 24 | // we can't really test that the powN and abs are not cast to 25 | // doubles because it's not really visible from the outside. 26 | 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /testsuite/mattias-lindstroem-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | using namespace blitz; 5 | Array A(7, 7); 6 | firstIndex i; 7 | secondIndex j; 8 | A=i+10*j; 9 | cout << A << endl << A.base() << endl << A.ubound() << endl << endl; 10 | A.reindexSelf(TinyVector(2,3)); 11 | cout << A << endl << A.base() << endl << A.ubound() << endl << endl; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /testsuite/minsumpow.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | using namespace blitz::tensor; 6 | 7 | int main() 8 | { 9 | Array A(4,4); 10 | Array B(4), C(4); 11 | A = 0, 1, 2, 3, 12 | 30, 2, 4, 1, 13 | 3, 2, 5, 6, 14 | 12, 9, 0, 0; 15 | 16 | B = sum(pow2(A),j); 17 | C = 14, 921, 74, 225; 18 | BZTEST(count(C == B) == 4); 19 | 20 | // workaround for MIPSpro compiler bug 21 | #if defined(__sgi) 22 | TinyVector N = maxIndex(B); 23 | #else 24 | TinyVector N = maxIndex(sum(pow2(A),j)); 25 | #endif 26 | BZTEST(N(0) == 1); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /testsuite/module1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This test program verifies that multi-module programs will compile 3 | * and link properly. 4 | */ 5 | 6 | #include 7 | 8 | using namespace blitz; 9 | 10 | int module2(); 11 | 12 | int main() 13 | { 14 | using namespace blitz::tensor; 15 | 16 | Array A(4,4); 17 | A = 1.0 / (1 + i + j); 18 | 19 | sum(A); 20 | return module2(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /testsuite/module2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int module2() 6 | { 7 | using namespace blitz::tensor; 8 | 9 | Array A(4); 10 | A = pow2(i); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /testsuite/peter-bienstman-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A; 9 | A.resizeAndPreserve(2,2); 10 | BZTEST(A.numElements() == 4); 11 | 12 | Array B; 13 | B.resizeAndPreserve(2,2,2,2,2); 14 | BZTEST(B.numElements() == 32); 15 | 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /testsuite/peter-bienstman-2.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A(4), B(4); 9 | firstIndex i; 10 | A = i; 11 | B = 0, 1, 2, 3; 12 | BZTEST(count(A==B)==4); 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /testsuite/peter-bienstman-4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace blitz; 4 | 5 | int main() 6 | { 7 | Array A(0,0); 8 | Array B(0,0); 9 | 10 | firstIndex i; 11 | secondIndex j; 12 | 13 | B = A(j,i); 14 | 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /testsuite/peter-bienstman-5.cpp: -------------------------------------------------------------------------------- 1 | // Creating arrays from array-expressions 2 | #include "testsuite.h" 3 | #include 4 | 5 | using namespace blitz; 6 | 7 | int main() 8 | { 9 | Array A(4,3,fortranArray); 10 | Array B(4,3,fortranArray); 11 | 12 | A = 2.0; 13 | B = 1.0; 14 | 15 | Array C(A+B); 16 | 17 | BZTEST(C.ordering(0) == A.ordering(0)); 18 | BZTEST(C.ordering(1) == A.ordering(1)); 19 | 20 | Array D(4,3); 21 | 22 | beginCheckAssert(); 23 | Array C3(A+D); // conflicting storage formats 24 | endCheckAssert(); 25 | 26 | return 0; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /testsuite/peter-nordlund-2.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | template 7 | void subsample(Array& in, Array& sub1) 8 | { 9 | Range all = Range::all(); 10 | 11 | sub1.resize((in.extent(0)-3)/2+1, in.extent(1)); 12 | 13 | Range R0(1, in.extent(0)-2, 2); 14 | 15 | sub1(all, all) = (2*in(R0, all) + in(R0+1, all) + in(R0-1, all))/4.0; 16 | } 17 | 18 | int main() 19 | { 20 | Array A(9,5), B; 21 | 22 | using namespace blitz::tensor; 23 | 24 | A = 20*i+j; 25 | 26 | subsample(A,B); 27 | 28 | Array C(4,5); 29 | C = 20, 21, 22, 23, 24, 30 | 60, 61, 62, 63, 64, 31 | 100, 101, 102, 103, 104, 32 | 140, 141, 142, 143, 144; 33 | BZTEST(count(B==C) == 20); 34 | 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /testsuite/preexisting.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | // tests that preexisting memory constructors work with padding 7 | int main() 8 | { 9 | Array b(3,3); 10 | b = 1,2,3,4,5,6,7,8,9; 11 | 12 | { 13 | int p[] = {1,2,3,4,5,6,7,8,9}; 14 | Array a(p, shape(3,3), neverDeleteData); 15 | BZTEST(all(a==b)); 16 | } 17 | 18 | { 19 | int* pp; 20 | pp = new int[3*3]; 21 | Array a(pp, shape(3,3), deleteDataWhenDone); 22 | a = 1,2,3,4,5,6,7,8,9; 23 | BZTEST(all(a==b)); 24 | } 25 | 26 | 27 | const int w =simdTypes::vecWidth; 28 | if(w>1) { 29 | int p[] = {1,2,3,4,5,6,7,8,9}; 30 | beginCheckAssert(); 31 | Array a(p, shape(3,3), neverDeleteData, FortranArray<2>(paddedData)); 32 | endCheckAssert(); 33 | } 34 | 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /testsuite/reindex.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | using namespace blitz::tensor; 9 | 10 | Array A(3,3); 11 | A = i*3 + j; 12 | 13 | // 0, 1, 2 14 | // 3, 4, 5 15 | // 6, 7, 8 16 | 17 | A.reindexSelf(TinyVector(3,4)); 18 | BZTEST(A(3,4) == 0); 19 | BZTEST(A(5,6) == 8); 20 | 21 | Array B = A.reindex(TinyVector(0,0)); 22 | BZTEST(B(0,0) == 0); 23 | BZTEST(B(2,2) == 8); 24 | 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /testsuite/shapecheck.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array A(4,4), B(3,4), C(4,4), D(3,4); 9 | Array E(4,4,4); 10 | 11 | A = 0; 12 | B = 0; 13 | C = 0; 14 | D = 0; 15 | E = 0; 16 | 17 | beginCheckAssert(); 18 | A = D; 19 | endCheckAssert(); 20 | 21 | A = C; 22 | 23 | beginCheckAssert(); 24 | A = B + D; 25 | endCheckAssert(); 26 | 27 | return 0; 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /testsuite/slice-iterators.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main(int argc, char* argv[]) { 7 | Array image(100, 200); 8 | for (int x=0;x<100;x++) 9 | for (int y=0;y<200;y++) 10 | image(x,y) = 1000*y+x; 11 | 12 | RectDomain<2> rect_domain(shape(0,0),shape(99,0)); 13 | Array slice = image(rect_domain); 14 | 15 | unsigned k = 0; 16 | for (Array::iterator i=slice.begin();i!=slice.end();++i) 17 | BZTEST(*i==k++); 18 | 19 | slice.reverseSelf(0); 20 | for (Array::iterator i=slice.begin();i!=slice.end();++i) 21 | BZTEST(*i==--k); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /testsuite/stub.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /testsuite/testsuite.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTSUITE_H 2 | #define TESTSUITE_H 3 | 4 | #ifdef BZ_DEBUG_H 5 | #error must be included before any other header files. 6 | #endif 7 | 8 | #define BZ_TESTSUITE 9 | 10 | #include 11 | 12 | #define BZTEST(x) { if(!(x)) { std::cout << "Test failed: " << __FILE__ << " line " << __LINE__ << std::endl; std::exit(1); } } 13 | 14 | #endif // TESTSUITE_H 15 | -------------------------------------------------------------------------------- /testsuite/theodore-papadopoulo-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | Array F(4); 9 | 10 | F = -1.0, -2.0, -3.0, -4.0; 11 | 12 | TinyVector i = maxIndex(F); 13 | double f = max(F); 14 | 15 | BZTEST(i[0] == 0); 16 | BZTEST(f == -1.0); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /testsuite/tinymat.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace blitz; 8 | 9 | int main() 10 | { 11 | TinyMatrix A,B,C; 12 | A = 7; 13 | BZTEST(A(1,2) == 7); 14 | BZTEST(A(0,0) == 7); 15 | 16 | B = 0, 1, 2, 17 | 2, 3, 4; 18 | BZTEST(B(0,0) == 0); 19 | BZTEST(B(1,2) == 4); 20 | 21 | C = A*B; 22 | 23 | BZTEST(C(0,0) == 0); 24 | BZTEST(C(1,2) == 28); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /testsuite/weakref.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | // test that weak references work ok for various types of arrays 7 | // including nonunit strides and strange orderings resulting from 8 | // slicing. 9 | 10 | #define test_expr(d1,d2) BZTEST(all((d1)==(d2))); 11 | 12 | int main() 13 | { 14 | Array a(10,10); 15 | Array aa(10,10,10); 16 | Array b; 17 | Array c; 18 | 19 | a=tensor::i+10*tensor::j; 20 | aa=tensor::i+10*tensor::j+100*tensor::k; 21 | 22 | b.weakReference(a); 23 | test_expr(a,b); 24 | c.weakReference(a(1,Range::all())); 25 | test_expr(a(1,Range::all()), c); 26 | c.weakReference(a(Range::all(),2)); 27 | test_expr(a(Range::all(),2), c); 28 | a.weakReference(aa(Range(2,6), Range::all(), 7)); 29 | test_expr(aa(Range(2,6), Range::all(), 7), a); 30 | 31 | return 0; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /testsuite/where.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | const int N = 5; 9 | Array A(N), B(N), C(N), D(N), E(N); 10 | 11 | A = 0, 3, -2, 5, -4; 12 | B = 0, 1, 2, 3, 4; 13 | C = 10, 11, 12, 13, 14; 14 | 15 | D = where(A > 0, pow2(B), pow2(C)); 16 | 17 | E = 100, 1, 144, 9, 196; 18 | 19 | BZTEST(count(D == E) == N); 20 | 21 | D = where(A > 0, A, 0); 22 | E = 0, 3, 0, 5, 0; 23 | 24 | BZTEST(count(D == E) == N); 25 | 26 | Array F ( where(A > 0, pow2(B), pow2(C)) ); 27 | BZTEST(count(D == E) == N); 28 | 29 | TinyVector a(1,2,3); 30 | TinyVector b(3,2,1); 31 | TinyVector c(0,0,0); 32 | a = where(a <= b, c, a); 33 | BZTEST(sum(a) == 3); 34 | 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /testsuite/zeek-1.cpp: -------------------------------------------------------------------------------- 1 | #include "testsuite.h" 2 | #include 3 | 4 | using namespace blitz; 5 | 6 | int main() 7 | { 8 | using namespace tensor; 9 | 10 | Array A(4, 4); 11 | A = 1, 2, 3, 4, 12 | 5, 6, 7, 8, 13 | 9, 10, 11, 12, 14 | 13, 14, 15, 16; 15 | 16 | Array a(4); 17 | a = sum(A, j); 18 | Array b(sum(A, j)); 19 | 20 | BZTEST(all(a == b)); 21 | 22 | return 0; 23 | } 24 | 25 | --------------------------------------------------------------------------------