Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/setup.py | #!/usr/bin/env python
"""
WARNING: this code is deprecated and slated for removal soon. See the
doc/cython directory for the replacement, which uses Cython (the actively
maintained version of Pyrex).
Install file for example on how to use Pyrex with Numpy.
For more details, see:
http://www.scipy.org/Cookbook/Pyrex_... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/Makefile | all:
python setup.py build_ext --inplace
test: all
python run_test.py
.PHONY: clean
clean:
rm -rf *~ *.so *.c *.o build
| 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/c_numpy.pxd | # :Author: Travis Oliphant
cdef extern from "numpy/arrayobject.h":
cdef enum NPY_TYPES:
NPY_BOOL
NPY_BYTE
NPY_UBYTE
NPY_SHORT
NPY_USHORT
NPY_INT
NPY_UINT
NPY_LONG
NPY_ULONG
NPY_LONGLONG
NPY_ULONGLONG
NPY_FLOAT
... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/c_python.pxd | # -*- Mode: Python -*- Not really, but close enough
# Expose as much of the Python C API as we need here
cdef extern from "stdlib.h":
ctypedef int size_t
cdef extern from "Python.h":
ctypedef int Py_intptr_t
void* PyMem_Malloc(size_t)
void* PyMem_Realloc(void *p, size_t n)
void PyMem_Free(vo... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/notes | - cimport with a .pxd file vs 'include foo.pxi'?
- the need to repeat: pyrex does NOT parse C headers. | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/run_test.py | #!/usr/bin/env python
from numpyx import test
test()
| 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/numpyx.pyx | # -*- Mode: Python -*- Not really, but close enough
"""WARNING: this code is deprecated and slated for removal soon. See the
doc/cython directory for the replacement, which uses Cython (the actively
maintained version of Pyrex).
"""
cimport c_python
cimport c_numpy
import numpy
# Numpy must be initialized
c_numpy.i... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/pyrex/MANIFEST | numpyx.pyx
setup.py
| 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/swig/README | Notes for the numpy/doc/swig directory
======================================
This set of files is for developing and testing file numpy.i, which is
intended to be a set of typemaps for helping SWIG interface between C
and C++ code that uses C arrays and the python module NumPy. It is
ultimately hoped that numpy.i wi... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/swig/Makefile | # List all of the subdirectories here for recursive make
SUBDIRS = test doc
# Default target
.PHONY : default
default:
@echo "There is no default make target for this Makefile"
@echo "Valid make targets are:"
@echo " test - Compile and run tests of numpy.i"
@echo " doc - Generate numpy.i... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/swig/numpy.i | /* -*- C -*- (not really, but good for syntax highlighting) */
#ifdef SWIGPYTHON
%{
#ifndef SWIG_FILE_WITH_INIT
# define NO_IMPORT_ARRAY
#endif
#include "stdio.h"
#include <numpy/arrayobject.h>
%}
/**********************************************************************/
%fragment("NumPy_Backward_Compatibility", "he... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/swig/pyfragments.swg | /*-*- C -*-*/
/**********************************************************************/
/* For numpy versions prior to 1.0, the names of certain data types
* are different than in later versions. This fragment provides macro
* substitutions that allow us to support old and new versions of
* numpy.
*/
%fragment("... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Matrix.cxx | #include <stdlib.h>
#include <math.h>
#include <iostream>
#include "Matrix.h"
// The following macro defines a family of functions that work with 2D
// arrays with the forms
//
// TYPE SNAMEDet( TYPE matrix[2][2]);
// TYPE SNAMEMax( TYPE * matrix, int rows, int cols);
// TYPE SNAMEMin( int rows, i... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Fortran.i | // -*- c++ -*-
%module Fortran
%{
#define SWIG_FILE_WITH_INIT
#include "Fortran.h"
%}
// Get the NumPy typemaps
%include "../numpy.i"
%init %{
import_array();
%}
%define %apply_numpy_typemaps(TYPE)
%apply (TYPE* IN_FARRAY2, int DIM1, int DIM2) {(TYPE* matrix, int rows, int cols)};
%enddef /* %apply_numpy_typ... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Array1.cxx | #include "Array1.h"
#include <iostream>
#include <sstream>
// Default/length/array constructor
Array1::Array1(int length, long* data) :
_ownData(false), _length(0), _buffer(0)
{
resize(length, data);
}
// Copy constructor
Array1::Array1(const Array1 & source) :
_length(source._length)
{
allocateMemory();
*t... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Tensor.cxx | #include <stdlib.h>
#include <math.h>
#include <iostream>
#include "Tensor.h"
// The following macro defines a family of functions that work with 3D
// arrays with the forms
//
// TYPE SNAMENorm( TYPE tensor[2][2][2]);
// TYPE SNAMEMax( TYPE * tensor, int rows, int cols, int num);
// TYPE SNAMEMin( ... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Vector.i | // -*- c++ -*-
%module Vector
%{
#define SWIG_FILE_WITH_INIT
#include "Vector.h"
%}
// Get the NumPy typemaps
%include "../numpy.i"
%init %{
import_array();
%}
%define %apply_numpy_typemaps(TYPE)
%apply (TYPE IN_ARRAY1[ANY]) {(TYPE vector[3])};
%apply (TYPE* IN_ARRAY1, int DIM1) {(TYPE* series, int size)};
%appl... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Farray.h | #ifndef FARRAY_H
#define FARRAY_H
#include <stdexcept>
#include <string>
class Farray
{
public:
// Size constructor
Farray(int nrows, int ncols);
// Copy constructor
Farray(const Farray & source);
// Destructor
~Farray();
// Assignment operator
Farray & operator=(const Farray & source);
// Equa... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Farray.cxx | #include "Farray.h"
#include <sstream>
// Size constructor
Farray::Farray(int nrows, int ncols) :
_nrows(nrows), _ncols(ncols), _buffer(0)
{
allocateMemory();
}
// Copy constructor
Farray::Farray(const Farray & source) :
_nrows(source._nrows), _ncols(source._ncols)
{
allocateMemory();
*this = source;
}
// ... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/testArray.py | #! /usr/bin/env python
# System imports
from distutils.util import get_platform
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0:
BadListError = TypeError
else:
BadListError = ValueError
import Array
#####... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Tensor.h | #ifndef TENSOR_H
#define TENSOR_H
// The following macro defines the prototypes for a family of
// functions that work with 3D arrays with the forms
//
// TYPE SNAMENorm( TYPE tensor[2][2][2]);
// TYPE SNAMEMax( TYPE * tensor, int rows, int cols, int num);
// TYPE SNAMEMin( int rows, int cols, int ... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/setup.py | #! /usr/bin/env python
# System imports
from distutils.core import *
from distutils import sysconfig
# Third-party modules - we depend on numpy for everything
import numpy
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = numpy.get_include()
except Attribute... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Array2.cxx | #include "Array2.h"
#include <sstream>
// Default constructor
Array2::Array2() :
_ownData(false), _nrows(0), _ncols(), _buffer(0), _rows(0)
{ }
// Size/array constructor
Array2::Array2(int nrows, int ncols, long* data) :
_ownData(false), _nrows(0), _ncols(), _buffer(0), _rows(0)
{
resize(nrows, ncols, data);
}
... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Farray.i | // -*- c++ -*-
%module Farray
%{
#define SWIG_FILE_WITH_INIT
#include "Farray.h"
%}
// Get the NumPy typemaps
%include "../numpy.i"
// Get the STL typemaps
%include "stl.i"
// Handle standard exceptions
%include "exception.i"
%exception
{
try
{
$action
}
catch (const std::invalid_argument& e)
{
... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Vector.cxx | #include <stdlib.h>
#include <math.h>
#include <iostream>
#include "Vector.h"
// The following macro defines a family of functions that work with 1D
// arrays with the forms
//
// TYPE SNAMELength( TYPE vector[3]);
// TYPE SNAMEProd( TYPE * series, int size);
// TYPE SNAMESum( int size, TYPE * series)... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Makefile | # SWIG
INTERFACES = Array.i Farray.i Vector.i Matrix.i Tensor.i Fortran.i
WRAPPERS = $(INTERFACES:.i=_wrap.cxx)
PROXIES = $(INTERFACES:.i=.py )
# Default target: build the tests
.PHONY : all
all: $(WRAPPERS) Array1.cxx Array1.h Farray.cxx Farray.h Vector.cxx Vector.h \
Matrix.cxx Matrix.h Tensor.cxx Tensor.... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Array2.h | #ifndef ARRAY2_H
#define ARRAY2_H
#include "Array1.h"
#include <stdexcept>
#include <string>
class Array2
{
public:
// Default constructor
Array2();
// Size/array constructor
Array2(int nrows, int ncols, long* data=0);
// Copy constructor
Array2(const Array2 & source);
// Destructor
~Array2();
... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/testTensor.py | #! /usr/bin/env python
# System imports
from distutils.util import get_platform
from math import sqrt
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListErro... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/testFortran.py | #! /usr/bin/env python
# System imports
from distutils.util import get_platform
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Fortran
##... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Array1.h | #ifndef ARRAY1_H
#define ARRAY1_H
#include <stdexcept>
#include <string>
class Array1
{
public:
// Default/length/array constructor
Array1(int length = 0, long* data = 0);
// Copy constructor
Array1(const Array1 & source);
// Destructor
~Array1();
// Assignment operator
Array1 & operator=(const Ar... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Matrix.i | // -*- c++ -*-
%module Matrix
%{
#define SWIG_FILE_WITH_INIT
#include "Matrix.h"
%}
// Get the NumPy typemaps
%include "../numpy.i"
%init %{
import_array();
%}
%define %apply_numpy_typemaps(TYPE)
%apply (TYPE IN_ARRAY2[ANY][ANY]) {(TYPE matrix[ANY][ANY])};
%apply (TYPE* IN_ARRAY2, int DIM1, int DIM2) {(TYPE* mat... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Fortran.h | #ifndef FORTRAN_H
#define FORTRAN_H
#define TEST_FUNC_PROTOS(TYPE, SNAME) \
\
TYPE SNAME ## SecondElement( TYPE * matrix, int rows, int cols); \
TEST_FUNC_PROTOS(signed char , schar )
TEST_FUNC_PROTOS(unsigned char , uchar )
TEST_FUNC_PROTOS(short , short )
TEST_FUNC_PROTOS(unsigned ... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Vector.h | #ifndef VECTOR_H
#define VECTOR_H
// The following macro defines the prototypes for a family of
// functions that work with 1D arrays with the forms
//
// TYPE SNAMELength( TYPE vector[3]);
// TYPE SNAMEProd( TYPE * series, int size);
// TYPE SNAMESum( int size, TYPE * series);
// void SNAMERevers... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/testMatrix.py | #! /usr/bin/env python
# System imports
from distutils.util import get_platform
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Matrix
###... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/testFarray.py | #! /usr/bin/env python
# System imports
from distutils.util import get_platform
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
# Add the distutil... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Fortran.cxx | #include <stdlib.h>
#include <math.h>
#include <iostream>
#include "Fortran.h"
#define TEST_FUNCS(TYPE, SNAME) \
\
TYPE SNAME ## SecondElement(TYPE * matrix, int rows, int cols) { \
TYPE result = matrix[1]; \
return result; \
} ... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Array.i | // -*- c++ -*-
%module Array
%{
#define SWIG_FILE_WITH_INIT
#include "Array1.h"
#include "Array2.h"
%}
// Get the NumPy typemaps
%include "../numpy.i"
// Get the STL typemaps
%include "stl.i"
// Handle standard exceptions
%include "exception.i"
%exception
{
try
{
$action
}
catch (const std::invalid_ar... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Matrix.h | #ifndef MATRIX_H
#define MATRIX_H
// The following macro defines the prototypes for a family of
// functions that work with 2D arrays with the forms
//
// TYPE SNAMEDet( TYPE matrix[2][2]);
// TYPE SNAMEMax( TYPE * matrix, int rows, int cols);
// TYPE SNAMEMin( int rows, int cols, TYPE * matrix);
... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/Tensor.i | // -*- c++ -*-
%module Tensor
%{
#define SWIG_FILE_WITH_INIT
#include "Tensor.h"
%}
// Get the NumPy typemaps
%include "../numpy.i"
%init %{
import_array();
%}
%define %apply_numpy_typemaps(TYPE)
%apply (TYPE IN_ARRAY3[ANY][ANY][ANY]) {(TYPE tensor[ANY][ANY][ANY])};
%apply (TYPE* IN_ARRAY3, int DIM1, int DIM2, i... | 0 |
public_repos/numpy-refactor/doc/swig | public_repos/numpy-refactor/doc/swig/test/testVector.py | #! /usr/bin/env python
# System imports
from distutils.util import get_platform
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Vector
###... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/numpybook/runcode.py | # This script takes a lyx file and runs the python code in it.
# Then rewrites the lyx file again.
#
# Each section of code portion is assumed to be in the same namespace
# where a from numpy import * has been applied
#
# If a PYNEW inside a Note is encountered, the name space is restarted
#
# The output (if any) is ... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/numpybook/capi.lyx | #LyX 1.5.1 created this file. For more info see http://www.lyx.org/
\lyxformat 276
\begin_document
\begin_header
\textclass mybook
\language english
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt... | 0 |
public_repos/numpy-refactor/doc | public_repos/numpy-refactor/doc/numpybook/numpybook.lyx | #LyX 1.5.1 created this file. For more info see http://www.lyx.org/
\lyxformat 276
\begin_document
\begin_header
\textclass mybook
\begin_preamble
\usepackage{array}
% This gives us a better font in URL links (otherwise the default
% MonoSpace font is bitmapped, and it looks horrible in PDF)
\usepackage{courier}
\... | 0 |
public_repos/numpy-refactor/doc/numpybook | public_repos/numpy-refactor/doc/numpybook/Figures/threefundamental.eps | %!PS-Adobe-2.0 EPSF-2.0
%%Title: threefundamental.fig
%%Creator: fig2dev Version 3.2 Patchlevel 4
%%CreationDate: Mon Jan 16 15:40:51 2006
%%For: oliphant@den.local.net (Travis Oliphant)
%%BoundingBox: 0 0 438 162
%%Magnification: 1.0000
%%EndComments
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/... | 0 |
public_repos/numpy-refactor/doc/numpybook | public_repos/numpy-refactor/doc/numpybook/Figures/threefundamental.fig | #FIG 3.2
Landscape
Center
Inches
Letter
100.00
Single
-2
1200 2
6 1950 2850 4350 3450
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
1950 2850 4350 2850 4350 3450 1950 3450 1950 2850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2550 2850 2550 3450
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3150 2850 3150 3450
2 1 0 1 0 7 50 -... | 0 |
public_repos/numpy-refactor/doc/numpybook | public_repos/numpy-refactor/doc/numpybook/Figures/contiguous.fig | #FIG 3.2
Landscape
Center
Inches
Letter
100.00
Single
-2
1200 2
6 3300 1500 10500 2250
2 2 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
5700 1575 6900 1575 6900 2175 5700 2175 5700 1575
2 2 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
7500 1575 8700 1575 8700 2175 7500 2175 7500 1575
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
3300 ... | 0 |
public_repos/numpy-refactor/doc/numpybook | public_repos/numpy-refactor/doc/numpybook/Figures/hierarchy.eps | %!PS-Adobe-2.0 EPSF-2.0
%%Title: hierarchy.dia
%%Creator: Dia v0.94
%%CreationDate: Wed Jan 4 16:44:07 2006
%%For: oliphant
%%Orientation: Portrait
%%Magnification: 1.0000
%%BoundingBox: 0 0 743 584
%%BeginSetup
%%EndSetup
%%EndComments
%%BeginProlog
[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.n... | 0 |
public_repos/numpy-refactor/doc/numpybook | public_repos/numpy-refactor/doc/numpybook/Figures/contiguous.eps | %!PS-Adobe-2.0 EPSF-2.0
%%Title: contiguous.fig
%%Creator: fig2dev Version 3.2 Patchlevel 4
%%CreationDate: Thu Aug 18 12:08:29 2005
%%For: oliphant@oliphant (Travis Oliphant)
%%BoundingBox: 0 0 434 215
%%Magnification: 1.0000
%%EndComments
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/col-1 {0 se... | 0 |
public_repos/numpy-refactor/doc/numpybook | public_repos/numpy-refactor/doc/numpybook/comparison/timing.py |
import timeit
pyrex_pre = """
import numpy as N
a = N.random.rand(%d,%d)
import filter
"""
pyrex_run = """
b = filter.filter(a)
"""
weave_pre = """
import numpy as N
a = N.random.rand(%d,%d)
import filter
"""
weave_run = """
b = filter.filter(a)
"""
ctypes_pre = """
import numpy as N
a = N.random.rand(%d,%d)
impo... | 0 |
public_repos/numpy-refactor/doc/numpybook/comparison | public_repos/numpy-refactor/doc/numpybook/comparison/weave/filter.py | from scipy import weave, zeros_like
def filter(a):
if a.ndim != 2:
raise ValueError, "a must be 2-d"
code = r"""
int i,j;
for(i=1;i<Na[0]-1;i++) {
for(j=1;j<Na[1]-1;j++) {
B2(i,j) = A2(i,j) + (A2(i-1,j) +
A2(i+1,j) + A2(i,j-1)
+ A2... | 0 |
public_repos/numpy-refactor/doc/numpybook/comparison | public_repos/numpy-refactor/doc/numpybook/comparison/weave/inline.py | from scipy import weave
from numpy import rand, zeros_like
def example1(a):
if not isinstance(a, list):
raise ValueError, "argument must be a list"
code = r"""
int i;
py::tuple results(2);
for (i=0; i<a.length(); i++) {
a[i] = i;
}
... | 0 |
public_repos/numpy-refactor/doc/numpybook/comparison | public_repos/numpy-refactor/doc/numpybook/comparison/weave/timeme | python2.4 -m timeit -s "import numpy as N; a=N.random.rand(100,200); import filter" "b = filter.filter(a)"
| 0 |
public_repos/numpy-refactor/doc/numpybook/comparison | public_repos/numpy-refactor/doc/numpybook/comparison/ctypes/newfile.dat |