Permalink
Browse files

Add documentation for jit and autojit classes

  • Loading branch information...
1 parent 2ba65aa commit 7629a0e9a0b9736200b1b17ff53273293c038e31 @markflorisson markflorisson committed Apr 4, 2013
Showing with 229 additions and 128 deletions.
  1. 0 docs/source/{doc → }/architecture.rst
  2. 0 docs/source/{doc → }/arrays.rst
  3. +0 −114 docs/source/doc/pythonstuff.rst
  4. 0 docs/source/{doc → }/doctest.rst
  5. +2 −0 docs/source/{doc → }/examples.rst
  6. +14 −14 docs/source/index.rst
  7. 0 docs/source/{doc → }/interface_c.rst
  8. 0 docs/source/{doc → }/ir.rst
  9. 0 docs/source/{doc → }/modules/ast_constant_folding.rst
  10. 0 docs/source/{doc → }/modules/ast_translate.rst
  11. 0 docs/source/{doc → }/modules/ast_type_inference.rst
  12. 0 docs/source/{doc → }/modules/cfg.rst
  13. 0 docs/source/{doc → }/modules/closure.rst
  14. 0 docs/source/{doc → }/modules/decorators.rst
  15. 0 docs/source/{doc → }/modules/functions.rst
  16. 0 docs/source/{doc → }/modules/llvm_types.rst
  17. 0 docs/source/{doc → }/modules/minivect.rst
  18. 0 docs/source/{doc → }/modules/multiarray_api.rst
  19. 0 docs/source/{doc → }/modules/naming.rst
  20. 0 docs/source/{doc → }/modules/ndarray_helpers.rst
  21. 0 docs/source/{doc → }/modules/nodes.rst
  22. 0 docs/source/{doc → }/modules/numba.rst
  23. 0 docs/source/{doc → }/modules/pipeline.rst
  24. 0 docs/source/{doc → }/modules/pycc.rst
  25. 0 docs/source/{doc → }/modules/stdio_util.rst
  26. 0 docs/source/{doc → }/modules/symtab.rst
  27. 0 docs/source/{doc → }/modules/transforms.rst
  28. 0 docs/source/{doc → }/modules/translate.rst
  29. 0 docs/source/{doc → }/modules/utils.rst
  30. 0 docs/source/{doc → }/modules/visitors.rst
  31. 0 docs/source/{doc → }/pycc.rst
  32. +213 −0 docs/source/pythonstuff.rst
  33. 0 docs/source/{doc → }/reference.rst
  34. 0 docs/source/{doc → }/releases.rst
  35. 0 docs/source/{doc → }/roadmap.rst
  36. 0 docs/source/{doc → }/type_inference.rst
  37. 0 docs/source/{doc → }/types.rst
  38. 0 docs/source/{doc → }/userguide.rst
File renamed without changes.
File renamed without changes.
@@ -1,114 +0,0 @@
-********************
-Python Functionality
-********************
-
-Extension Types (Classes)
-=========================
-Numba supports classes similar to Python classes and extension types.
-Currently the methods have static signatures, but in the future they
-we will likely support multiple inheritance and autojitting methods.
-
-One can refer to the extension type as a type by accessing its ``exttype``
-attribute::
-
- @jit
- class MyExtension(object):
- ...
-
- @jit(MyExtension.exttype(double))
- def create_ext(arg):
- return MyExtension(arg)
-
-It is not yet possible to refer to the extension type in the class body or
-methods of that extension type.
-
-An example of extension classes and their capabilities and limitations
-is shown below:
-
-.. literalinclude:: /../../examples/numbaclasses.py
-
-Closures
-========
-
-Numba supports closures (nested functions), and keeps the variable scopes
-alive for the lifetime of the closures.
-Variables that are closed over by the closures (``cell variables``) have
-one consistent type throughout the entirety of the function. This means
-differently typed variables can only be assigned if they are unifyable,
-such as for instance ints and floats::
-
- @autojit
- def outer(arg1, arg2):
- arg1 = 0
- arg1 = 0.0 # This is fine
- arg1 = "hello" # ERROR! arg1 must have a single type
-
- arg2 = 0
- arg2 = "hello" # FINE! Not a cell variable
-
- def inner():
- print arg1
-
- return inner
-
-Calling an inner function directly in the body of ``outer`` will result in
-a direct, native call of the closure. In the future it is likely that passing
-around the closure will still result in a native call in other places.
-
-Like Python closures, closures can be arbitrarily nested, and follow the same
-scoping rules.
-
-Typed Containers
-================
-Numba ships implementations of various typed containers, which allow fast
-execution and memory-efficient storage.
-
-We hope to support the following container types:
-
- * list, tuple
- * dict, ordereddict
- * set, orderedset
- * queues, channels
- * <your idea here>
-
-There are many more data structure that can be implemented, but future releases
-of numba will make it easier (nearly trivial) for people to implement those
-data structure themselves while supporting full data polymorphism.
-
-Currently implemented:
-
- * typedlist
- * typedtuple
-
-These data structures work exactly like their python equivalents, but take a
-first parameter which specifies the element type::
-
- >>> numba.typedlist(int32, range(10))
- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
- >>> numba.typedlist(float32, range(10))
- [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
-
- >>> tlist = numba.typedlist(int32)
- >>> tlist
- []
- >>> tlist.extend([3, 2, 1, 3])
- >>> tlist
- [3, 1, 2, 3]
- >>> tlist.count(3)
- 2L
- >>> tlist[0]
- 3L
- >>> tlist.pop()
- 3L
- >>> tlist.reverse()
- >>> tlist
- [1, 2, 3]
-
-Things that are not yet implemented:
-
- * Methods ``remove``, ``insert``
- * Slicing
-
-Typed containers can be used from Python or from numba code. Using them from numba code
-will result in fast calls without boxing and unboxing.
-
File renamed without changes.
@@ -46,6 +46,8 @@ Python wrapper to that low-level function so that the function can be
called from Python. The first function can be called from other
numba functions to eliminate all python overhead in function calling.
+.. _classes:
+
Classes
-------
.. literalinclude:: /../../examples/numbaclasses.py
View
@@ -14,49 +14,49 @@ Documentation for numba
:titlesonly:
:maxdepth: 2
- doc/userguide.rst
- doc/types.rst
- doc/pythonstuff.rst
+ userguide.rst
+ types.rst
+ pythonstuff.rst
**Arrays:**
.. toctree::
:maxdepth: 2
- doc/arrays.rst
+ arrays.rst
**Interfacing with native code:**
.. toctree::
:maxdepth: 2
- doc/interface_c.rst
+ interface_c.rst
**Misc:**
.. toctree::
:titlesonly:
:maxdepth: 2
- doc/pycc.rst
- doc/type_inference.rst
+ pycc.rst
+ type_inference.rst
**Examples:**
.. toctree::
:titlesonly:
:maxdepth: 2
- doc/doctest.rst
- doc/examples.rst
+ doctest.rst
+ examples.rst
**Releases:**
.. toctree::
:titlesonly:
:maxdepth: 2
- doc/releases.rst
+ releases.rst
Developer Documentation
------------------------
@@ -66,10 +66,10 @@ Developer Documentation
:titlesonly:
:maxdepth: 1
- doc/architecture.rst
- doc/ir.rst
- doc/roadmap.rst
- doc/reference.rst
+ architecture.rst
+ ir.rst
+ roadmap.rst
+ reference.rst
Indices and tables
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.

0 comments on commit 7629a0e

Please sign in to comment.