Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75130 - in sandbox/numpy/libs/numpy/doc: . Reference _static _templates reference tutorial
From: seefeld_at_[hidden]
Date: 2011-10-27 10:12:16


Author: stefan
Date: 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
New Revision: 75130
URL: http://svn.boost.org/trac/boost/changeset/75130

Log:
Restructure documentation sources to build with sphinx.
Added:
   sandbox/numpy/libs/numpy/doc/Makefile (contents, props changed)
   sandbox/numpy/libs/numpy/doc/_static/
   sandbox/numpy/libs/numpy/doc/_static/boost.css (contents, props changed)
   sandbox/numpy/libs/numpy/doc/_static/boost.png (contents, props changed)
   sandbox/numpy/libs/numpy/doc/_templates/
   sandbox/numpy/libs/numpy/doc/_templates/layout.html (contents, props changed)
   sandbox/numpy/libs/numpy/doc/conf.py (contents, props changed)
   sandbox/numpy/libs/numpy/doc/index.rst (contents, props changed)
   sandbox/numpy/libs/numpy/doc/make.bat (contents, props changed)
   sandbox/numpy/libs/numpy/doc/reference/
      - copied from r74463, /sandbox/numpy/libs/numpy/doc/Reference/
   sandbox/numpy/libs/numpy/doc/reference/index.rst (contents, props changed)
   sandbox/numpy/libs/numpy/doc/tutorial/
   sandbox/numpy/libs/numpy/doc/tutorial/dtype.rst
      - copied unchanged from r74463, /sandbox/numpy/libs/numpy/doc/dtype.rst
   sandbox/numpy/libs/numpy/doc/tutorial/fromdata.rst
      - copied unchanged from r74463, /sandbox/numpy/libs/numpy/doc/fromdata.rst
   sandbox/numpy/libs/numpy/doc/tutorial/index.rst (contents, props changed)
   sandbox/numpy/libs/numpy/doc/tutorial/ndarray.rst
      - copied unchanged from r74463, /sandbox/numpy/libs/numpy/doc/ndarray.rst
   sandbox/numpy/libs/numpy/doc/tutorial/simple.rst (contents, props changed)
   sandbox/numpy/libs/numpy/doc/tutorial/ufunc.rst
      - copied unchanged from r74463, /sandbox/numpy/libs/numpy/doc/ufunc.rst
Removed:
   sandbox/numpy/libs/numpy/doc/Reference/
   sandbox/numpy/libs/numpy/doc/dtype.rst
   sandbox/numpy/libs/numpy/doc/fromdata.rst
   sandbox/numpy/libs/numpy/doc/ndarray.rst
   sandbox/numpy/libs/numpy/doc/tutorial.rst
   sandbox/numpy/libs/numpy/doc/ufunc.rst

Added: sandbox/numpy/libs/numpy/doc/Makefile
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/Makefile 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,132 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
+
+all: html
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/BoostNumPy.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/BoostNumPy.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/BoostNumPy"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/BoostNumPy"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ make -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."

Added: sandbox/numpy/libs/numpy/doc/_static/boost.css
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/_static/boost.css 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,66 @@
+/*=============================================================================
+ Copyright 2002 William E. Kempf
+ Distributed under the Boost Software License, Version 1.0. (See accompany-
+ ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+H1
+{
+ FONT-SIZE: 200%;
+ COLOR: #00008B;
+}
+H2
+{
+ FONT-SIZE: 150%;
+}
+H3
+{
+ FONT-SIZE: 125%;
+}
+H4
+{
+ FONT-SIZE: 108%;
+}
+BODY
+{
+ FONT-SIZE: 100%;
+ BACKGROUND-COLOR: #ffffff;
+ COLOR: #000000;
+}
+PRE
+{
+ MARGIN-LEFT: 2em;
+ FONT-FAMILY: Courier,
+ monospace;
+}
+CODE
+{
+ FONT-FAMILY: Courier,
+ monospace;
+}
+CODE.as_pre
+{
+ white-space: pre;
+}
+.index
+{
+ TEXT-ALIGN: left;
+}
+.page-index
+{
+ TEXT-ALIGN: left;
+}
+.definition
+{
+ TEXT-ALIGN: left;
+}
+.footnote
+{
+ FONT-SIZE: 66%;
+ VERTICAL-ALIGN: super;
+ TEXT-DECORATION: none;
+}
+.function-semantics
+{
+ CLEAR: left;
+}
\ No newline at end of file

Added: sandbox/numpy/libs/numpy/doc/_static/boost.png
==============================================================================
Binary file. No diff available.

Added: sandbox/numpy/libs/numpy/doc/_templates/layout.html
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/_templates/layout.html 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,120 @@
+{%- macro navbar() %}
+ <div class="navbar">
+ {%- if parents|count > 2 %}
+ {{ parents[1].title }}
+ {%- if prev %}
+ <a class="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}">prev</a>
+ {%- endif %}
+ {%- if parents %}
+ <a class="up" title="{{ parents[-1].title|striptags|e }}" href="{{ parents[-1].link|e }}">up</a>
+ {%- endif %}
+ {%- if next %}
+ <a class="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}">next</a>
+ {%- endif %}
+ {%- endif %}
+ </div>
+{%- endmacro %}
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ {{ metatags }}
+ {%- if builder != 'htmlhelp' %}
+ {%- set titlesuffix = docstitle|e %}
+ {%- set titlesuffix = " - " + titlesuffix %}
+ {%- endif %}
+ <title>{{ title|striptags }}{{ titlesuffix }}</title>
+ {%- if builder == 'web' %}
+ <link rel="stylesheet" href="{{ pathto('index') }}?do=stylesheet{%
+ if in_admin_panel %}&admin=yes{% endif %}" type="text/css" />
+ {%- for link, type, title in page_links %}
+ <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}" />
+ {%- endfor %}
+ {%- else %}
+ <link rel="stylesheet" href="{{ pathto('_static/boost.css', 1) }}" type="text/css" />
+ <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
+
+ {%- endif %}
+ {%- if builder != 'htmlhelp' %}
+ <script type="text/javascript">
+ var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: '{{ pathto("", 1) }}',
+ VERSION: '{{ release|e }}',
+ COLLAPSE_MODINDEX: false,
+ FILE_SUFFIX: '{{ file_suffix }}'
+ };
+ </script>
+ {%- for scriptfile in script_files %}
+ <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
+ {%- endfor %}
+ {%- if use_opensearch %}
+ <link rel="search" type="application/opensearchdescription+xml"
+ title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
+ href="{{ pathto('_static/opensearch.xml', 1) }}"/>
+ {%- endif %}
+ {%- if favicon %}
+ <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
+ {%- endif %}
+ {%- endif %}
+{%- block linktags %}
+ {%- if hasdoc('about') %}
+ <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
+ {%- endif %}
+ <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
+ <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
+ {%- if hasdoc('copyright') %}
+ <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
+ {%- endif %}
+ <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
+ {%- if parents %}
+ <link rel="up" title="{{ parents[-1].title|striptags }}" href="{{ parents[-1].link|e }}" />
+ {%- endif %}
+ {%- if next %}
+ <link rel="next" title="{{ next.title|striptags }}" href="{{ next.link|e }}" />
+ {%- endif %}
+ {%- if prev %}
+ <link rel="prev" title="{{ prev.title|striptags }}" href="{{ prev.link|e }}" />
+ {%- endif %}
+{%- endblock %}
+{%- block extrahead %} {% endblock %}
+ </head>
+ <body>
+ <div class="header">
+ <table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
+ "header">
+ <tr>
+ <td valign="top" width="300">
+ <h3><a href="{{ pathto('index') }}"><img height="86" width="277"
+ alt="C++ Boost" src="{{ pathto('_static/' + logo, 1) }}" border="0"></a></h3>
+ </td>
+
+ <td valign="top">
+ <h1 align="center">Boost.NumPy</h1>
+<!-- <h2 align="center">CallPolicies Concept</h2>-->
+ </td>
+ <td>
+ {%- if pagename != "search" %}
+ <div id="searchbox" style="display: none">
+ <form class="search" action="{{ pathto('search') }}" method="get">
+ <input type="text" name="q" size="18" />
+ <input type="submit" value="{{ _('Search') }}" />
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+ </form>
+ </div>
+ <script type="text/javascript">$('#searchbox').show(0);</script>
+ {%- endif %}
+ </td>
+ </tr>
+ </table>
+ </div>
+ <hr/>
+ <div class="content">
+ {%- block top_navbar %}{{ navbar() }}{% endblock %}
+ {% block body %} {% endblock %}
+ {%- block bottom_navbar %}{{ navbar() }}{% endblock %}
+ </div>
+ </body>
+</html>

Added: sandbox/numpy/libs/numpy/doc/conf.py
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/conf.py 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,219 @@
+# -*- coding: utf-8 -*-
+#
+# Boost.NumPy documentation build configuration file, created by
+# sphinx-quickstart on Thu Oct 27 09:04:58 2011.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Boost.NumPy'
+copyright = u'2011, Stefan Seefeld'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.0'
+# The full version, including alpha/beta/rc tags.
+release = '1.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'default'
+
+highlight_language = 'c++'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+html_logo = 'boost.png'
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'BoostNumPydoc'
+
+html_add_permalinks = False
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'BoostNumPy.tex', u'Boost.NumPy Documentation',
+ u'Stefan Seefeld', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'boostnumpy', u'Boost.NumPy Documentation',
+ [u'Stefan Seefeld'], 1)
+]

Deleted: sandbox/numpy/libs/numpy/doc/dtype.rst
==============================================================================
--- sandbox/numpy/libs/numpy/doc/dtype.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
+++ (empty file)
@@ -1,55 +0,0 @@
-How to use dtypes
-=================
-
-Here is a brief tutorial to show how to create ndarrays with built-in python data types, and extract the types and values of member variables
-
-Like before, first get the necessary headers, setup the namespaces and initialize the Python runtime and numpy module::
-
- #include <boost/numpy.hpp>
- #include <iostream>
-
- namespace p = boost::python;
- namespace np = boost::numpy;
-
- int main(int argc, char **argv)
- {
- Py_Initialize();
- np::initialize();
-
-Next, we create the shape and dtype. We use the get_builtin method to get the numpy dtype corresponding to the builtin C++ dtype
-Here, we will create a 3x3 array passing a tuple with (3,3) for the size, and double as the data type ::
-
- p::tuple shape = p::make_tuple(3, 3);
- np::dtype dtype = np::dtype::get_builtin<double>();
- np::ndarray a = np::zeros(shape, dtype);
-
-Finally, we can print the array using the extract method in the python namespace.
-Here, we first convert the variable into a string, and then extract it as a C++ character array from the python string using the <char const \* > template ::
-
- std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
-
-We can also print the dtypes of the data members of the ndarray by using the get_dtype method for the ndarray ::
-
- std::cout << "Datatype is:\n" << p::extract<char const *>(p::str(a.get_dtype())) << std::endl ;
-
-We can also create custom dtypes and build ndarrays with the custom dtypes
-
-We use the dtype constructor to create a custom dtype. This constructor takes a list as an argument.
-
-The list should contain one or more tuples of the format (variable name, variable type)
-
-So first create a tuple with a variable name and its dtype, double, to create a custom dtype ::
-
- p::tuple for_custom_dtype = p::make_tuple("ha",dtype) ;
-
-Next, create a list, and add this tuple to the list. Then use the list to create the custom dtype ::
-
- p::list list_for_dtype ;
- list_for_dtype.append(for_custom_dtype) ;
- np::dtype custom_dtype = np::dtype(list_for_dtype) ;
-
-We are now ready to create an ndarray with dimensions specified by \*shape\* and of custom dtpye ::
-
- np::ndarray new_array = np::zeros(shape,custom_dtype);
-
- }

Deleted: sandbox/numpy/libs/numpy/doc/fromdata.rst
==============================================================================
--- sandbox/numpy/libs/numpy/doc/fromdata.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
+++ (empty file)
@@ -1,51 +0,0 @@
-How to access data using raw pointers
-=====================================
-
-One of the advantages of the ndarray wrapper is that the same data can be used in both Python and C++ and changes can be made to reflect at both ends.
-The from_data method makes this possible.
-
-Like before, first get the necessary headers, setup the namespaces and initialize the Python runtime and numpy module::
-
- #include <boost/numpy.hpp>
- #include <iostream>
-
- namespace p = boost::python;
- namespace np = boost::numpy;
-
- int main(int argc, char **argv)
- {
- Py_Initialize();
- np::initialize();
-
-Create an array in C++ , and pass the pointer to it to the from_data method to create an ndarray::
-
- int arr[] = {1,2,3,4} ;
- np::ndarray py_array = np::from_data(arr, np::dtype::get_builtin<int>() , p::make_tuple(4), p::make_tuple(4), p::object());
-
-Print the source C++ array, as well as the ndarray, to check if they are the same::
-
- std::cout << "C++ array :" << std::endl ;
- for (int j=0;j<4;j++)
- {
- std::cout << arr[j] << ' ' ;
- }
- std::cout << std::endl << "Python ndarray :" << p::extract<char const *>(p::str(py_array)) << std::endl;
-
-Now, change an element in the Python ndarray, and check if the value changed correspondingly in the source C++ array::
-
- py_array[1] = 5 ;
- std::cout << "Is the change reflected in the C++ array used to create the ndarray ? " << std::endl ;
- for (int j = 0;j<4 ; j++)
- {
- std::cout << arr[j] << ' ' ;
- }
-
-Next, change an element of the source C++ array and see if it is reflected in the Python ndarray::
-
- arr[2] = 8 ;
- std::cout << std::endl << "Is the change reflected in the Python ndarray ?" << std::endl << p::extract<char const *>(p::str(py_array)) << std::endl;
-
-}
-
-As we can see, the changes are reflected across the ends. This happens because the from_data method passes the C++ array by reference to create the ndarray, and thus uses the same locations for storing data.
-

Added: sandbox/numpy/libs/numpy/doc/index.rst
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/index.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,16 @@
+.. Boost.NumPy documentation master file, created by
+ sphinx-quickstart on Thu Oct 27 09:04:58 2011.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to Boost.NumPy's documentation!
+=======================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ Tutorial <tutorial/index>
+ Reference <reference/index>
+

Added: sandbox/numpy/libs/numpy/doc/make.bat
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/make.bat 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,170 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^<target^>` where ^<target^> is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\BoostNumPy.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\BoostNumPy.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+:end

Deleted: sandbox/numpy/libs/numpy/doc/ndarray.rst
==============================================================================
--- sandbox/numpy/libs/numpy/doc/ndarray.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
+++ (empty file)
@@ -1,94 +0,0 @@
-Creating ndarrays
-=================
-
-The Boost.Numpy library exposes quite a few methods to create ndarrays. ndarrays can be created in a variety of ways, include empty arrays and zero filled arrays.
-ndarrays can also be created from arbitrary python sequences as well as from data and dtypes.
-
-This tutorial will introduce you to some of the ways in which you can create ndarrays. The methods covered here include creating ndarrays from arbitrary Python sequences, as well as from C++ containers, using both unit and non-unit strides
-
-First, as before, initialise the necessary namepaces and runtimes ::
-
- #include <boost/numpy.hpp>
- #include <iostream>
-
- namespace p = boost::python;
- namespace np = boost::numpy;
-
- int main(int argc, char **argv)
- {
- Py_Initialize();
- np::initialize();
-
-Let's now create an ndarray from a simple tuple. We first create a tuple object, and then pass it to the array method, to generate the necessary tuple ::
-
- p::object tu = p::make_tuple('a','b','c') ;
- np::ndarray example_tuple = np::array(tu) ;
-
-Let's now try the same with a list. We create an empty list, add an element using the append method, and as before, call the array method ::
-
- p::list l ;
- l.append('a') ;
- np::ndarray example_list = np::array (l) ;
-
-Optionally, we can also specify a dtype for the array ::
-
- np::dtype dt = np::dtype::get_builtin<int>();
- np::ndarray example_list1 = np::array (l,dt);
-
-We can also create an array by supplying data arrays and a few other parameters.
-
-First,create an integer array ::
-
- int data[] = {1,2,3,4} ;
-
-Create a shape, and strides, needed by the function ::
-
- p::tuple shape = p::make_tuple(4) ;
- p::tuple stride = p::make_tuple(4) ;
-
-Here, shape is 1x4 , and the stride is also 4.
-A stride is the number of bytes that must be travelled to get to the next desired element while constructing the ndarray. Here, the size of the "int" is 32 bits and hence, the stride is 4 to access each element.
-
-The function also needs an owner, to keep track of the data array passed. Passing none is dangerous ::
-
- p::object own ;
-
-The from_data function takes the data array, datatype,shape,stride and owner as arguments and returns an ndarray ::
-
- np::ndarray data_ex1 = np::from_data(data,dt, shape,stride,own);
-
-Now let's print the ndarray we created ::
-
- std::cout << "Single dimensional array ::" << std::endl << p::extract < char const * > (p::str(data_ex)) << std::endl ;
-
-Let's make it a little more interesting. Lets make an 3x2 ndarray from a multi-dimensional array using non-unit strides
-
-First lets create a 3x4 array of 8-bit integers ::
-
- uint8_t mul_data[][4] = {{1,2,3,4},{5,6,7,8},{1,3,5,7}};
-
-Now let's create an array of 3x2 elements, picking the first and third elements from each row . For that, the shape will be 3x2.
-The strides will be 4x2 i.e. 4 bytes to go to the next desired row, and 2 bytes to go to the next desired column ::
-
- shape = p::make_tuple(3,2) ;
- stride = p::make_tuple(4,2) ;
-
-Get the numpy dtype for the built-in 8-bit integer data type ::
-
- np::dtype dt1 = np::dtype::get_builtin<uint8_t>();
-
-Now lets first create and print out the ndarray as is.
-Notice how we can pass the shape and strides in the function directly, as well as the owner. The last part can be done because we don't have any use to
-manipulate the "owner" object ::
-
- np::ndarray mul_data_ex = np::from_data(mul_data,dt1, p::make_tuple(3,4),p::make_tuple(4,1),p::object());
- std::cout << "Original multi dimensional array :: " << std::endl << p::extract < char const * > (p::str(mul_data_ex)) << std::endl ;
-
-Now create the new ndarray using the shape and strides and print out the array we created using non-unit strides ::
-
- mul_data_ex = np::from_data(mul_data,dt1, shape,stride,p::object());
- std::cout << "Selective multidimensional array :: "<<std::endl << p::extract < char const * > (p::str(mul_data_ex)) << std::endl ;
-
-Note : The from_data method will throw "error_already_set" if the number of elements dictated by the shape and the corresponding strides don't match
-
-}

Added: sandbox/numpy/libs/numpy/doc/reference/index.rst
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/reference/index.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,14 @@
+Boost.NumPy Reference
+=====================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ dtype
+ ndarray
+ unary_ufunc
+ binary_ufunc
+ multi_iter
+

Deleted: sandbox/numpy/libs/numpy/doc/tutorial.rst
==============================================================================
--- sandbox/numpy/libs/numpy/doc/tutorial.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
+++ (empty file)
@@ -1,41 +0,0 @@
-A simple tutorial on Arrays
-===========================
-
-Let's start with a simple tutorial to create and modify arrays.
-
-Get the necessary headers for numpy components and set up necessary namespaces::
-
- #include <boost/numpy.hpp>
- #include <iostream>
-
- namespace p = boost::python;
- namespace np = boost::numpy;
-
-Initialise the Python runtime, and the numpy module. Failure to call these results in segmentation errors::
-
- int main(int argc, char **argv)
- {
- Py_Initialize();
- np::initialize();
-
-
-Zero filled n-dimensional arrays can be created using the shape and data-type of the array as a parameter. Here, the shape is 3x3 and the datatype is the built-in float type::
-
- p::tuple shape = p::make_tuple(3, 3);
- np::dtype dtype = np::dtype::get_builtin<float>();
- np::ndarray a = np::zeros(shape, dtype);
-
-You can also create an empty array like this ::
-
- np::ndarray b = np::empty(shape,dtype);
-
-Print the original and reshaped array. The array a which is a list is first converted to a string, and each value in the list is extracted using extract< >::
-
- std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
-
- // Reshape the array into a 1D array
- a = a.reshape(p::make_tuple(9));
- // Print it again.
- std::cout << "Reshaped array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
- }
-

Added: sandbox/numpy/libs/numpy/doc/tutorial/index.rst
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/tutorial/index.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,14 @@
+Boost.NumPy Tutorial
+====================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ simple
+ dtype
+ ndarray
+ ufunc
+ fromdata
+

Added: sandbox/numpy/libs/numpy/doc/tutorial/simple.rst
==============================================================================
--- (empty file)
+++ sandbox/numpy/libs/numpy/doc/tutorial/simple.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
@@ -0,0 +1,41 @@
+A simple tutorial on Arrays
+===========================
+
+Let's start with a simple tutorial to create and modify arrays.
+
+Get the necessary headers for numpy components and set up necessary namespaces::
+
+ #include <boost/numpy.hpp>
+ #include <iostream>
+
+ namespace p = boost::python;
+ namespace np = boost::numpy;
+
+Initialise the Python runtime, and the numpy module. Failure to call these results in segmentation errors::
+
+ int main(int argc, char **argv)
+ {
+ Py_Initialize();
+ np::initialize();
+
+
+Zero filled n-dimensional arrays can be created using the shape and data-type of the array as a parameter. Here, the shape is 3x3 and the datatype is the built-in float type::
+
+ p::tuple shape = p::make_tuple(3, 3);
+ np::dtype dtype = np::dtype::get_builtin<float>();
+ np::ndarray a = np::zeros(shape, dtype);
+
+You can also create an empty array like this ::
+
+ np::ndarray b = np::empty(shape,dtype);
+
+Print the original and reshaped array. The array a which is a list is first converted to a string, and each value in the list is extracted using extract< >::
+
+ std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
+
+ // Reshape the array into a 1D array
+ a = a.reshape(p::make_tuple(9));
+ // Print it again.
+ std::cout << "Reshaped array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
+ }
+

Deleted: sandbox/numpy/libs/numpy/doc/ufunc.rst
==============================================================================
--- sandbox/numpy/libs/numpy/doc/ufunc.rst 2011-10-27 10:12:14 EDT (Thu, 27 Oct 2011)
+++ (empty file)
@@ -1,116 +0,0 @@
-Ufuncs
-======
-
-Ufuncs or universal functions operate on ndarrays element by element, and support array broadcasting, type casting, and other features.
-
-Lets try and see how we can use the binary and unary ufunc methods
-
-After the neccessary includes ::
-
- #include <boost/numpy.hpp>
- #include <iostream>
-
- namespace p = boost::python;
- namespace np = boost::numpy;
-
-Now we create the structs necessary to implement the ufuncs. The typedefs *must* be made as the ufunc generators take these typedefs as inputs and return an error otherwise ::
-
- struct UnarySquare
- {
- typedef double argument_type;
- typedef double result_type;
-
- double operator()(double r) const { return r * r;}
- };
-
- struct BinarySquare
- {
- typedef double first_argument_type;
- typedef double second_argument_type;
- typedef double result_type;
-
- double operator()(double a,double b) const { return (a*a + b*b) ; }
- };
-
-Initialise the Python runtime and the numpy module ::
-
- int main(int argc, char **argv)
- {
- Py_Initialize();
- np::initialize();
-
-Now expose the struct UnarySquare to Python as a class, and let ud be the class object. ::
-
- p::object ud = p::class_<UnarySquare, boost::shared_ptr<UnarySquare> >("UnarySquare")
- .def("__call__", np::unary_ufunc<UnarySquare>::make());
-
-Let inst be an instance of the class ud ::
-
- p::object inst = ud();
-
-Use the "__call__" method to call the overloaded () operator and print the value ::
-
- std::cout << "Square of unary scalar 1.0 is " << p::extract <char const * > (p::str(inst.attr("__call__")(1.0))) << std::endl ;
-
-Create an array in C++ ::
-
- int arr[] = {1,2,3,4} ;
-
-
-..and use it to create the ndarray in Python ::
-
- np::ndarray demo_array = np::from_data(arr, np::dtype::get_builtin<int>() , p::make_tuple(4), p::make_tuple(4), p::object());
-
-Print out the demo array ::
-
- std::cout << "Demo array is " << p::extract <char const * > (p::str(demo_array)) << std::endl ;
-
-Call the "__call__" method to perform the operation and assign the value to result_array ::
-
- p::object result_array = inst.attr("__call__")(demo_array) ;
-
-Print the resultant array ::
-
- std::cout << "Square of demo array is " << p::extract <char const * > (p::str(result_array)) << std::endl ;
-
-Lets try the same with a list ::
-
- p::list li ;
- li.append(3);
- li.append(7);
-
-Print out the demo list ::
-
- std::cout << "Demo list is " << p::extract <char const * > (p::str(li)) << std::endl ;
-
-Call the ufunc for the list ::
-
- result_array = inst.attr("__call__")(li) ;
-
-And print the list out ::
-
- std::cout << "Square of demo list is " << p::extract <char const * > (p::str(result_array)) << std::endl ;
-
-Now lets try Binary ufuncs. Again, expose the struct BinarySquare to Python as a class, and let ud be the class object ::
-
- ud = p::class_<BinarySquare, boost::shared_ptr<BinarySquare> >("BinarySquare")
- .def("__call__", np::binary_ufunc<BinarySquare>::make());
-
-And initialise ud ::
-
- inst = ud();
-
-Print the two input lists ::
-
- std::cout << "The two input list for binary ufunc are " << std::endl << p::extract <char const * > (p::str(demo_array)) << std::endl << p::extract <char const * > (p::str(demo_array)) << std::endl ;
-
-Call the binary ufunc taking demo_array as both inputs ::
-
- result_array = inst.attr("__call__")(demo_array,demo_array) ;
-
-And print the output ::
-
- std::cout << "Square of list with binary ufunc is " << p::extract <char const * > (p::str(result_array)) << std::endl ;
-
-}
-


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk