Jonathan Hanke | 12 Dec 04:53 2014
Picon

Trouble enabling the cython debugger

Hi,

I was interested in enabling the cython debugger, and after reading the debugging page added the gdb_enable=True argument to the cythonize command in setup.py.  

from distutils.core import setup
from Cython.Build import cythonize

setup(
    name = "QFLIBapp",
    ext_modules = cythonize('*.pyx', gdb_debug=True),
)

However this gives an error related to some path settings:

python setup.py build_ext --inplace
Compiling matrix_mpz.pyx because it changed.
Cythonizing matrix_mpz.pyx
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    ext_modules = cythonize('*.pyx', gdb_debug=True),
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 840, in cythonize
    cythonize_one(*args[1:])
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 942, in cythonize_one
    result = compile([pyx_file], options)
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 629, in compile
    return compile_multiple(source, options)
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 607, in compile_multiple
    result = run_pipeline(source, options, context=context)
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 438, in run_pipeline
    pipeline = Pipeline.create_pyx_pipeline(context, options, result)
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Compiler/Pipeline.py", line 231, in create_pyx_pipeline
    options.output_dir)
  File "/Users/jonhanke/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Debugger/DebugWriter.py", line 45, in __init__
    self.output_dir = os.path.join(output_dir, 'cython_debug')
  File "/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
make: *** [build] Error 1

Will I need to change setup.py to use the Extensions command for this to work, or is it supposed to be ok to add the debugging flag when distutils takes its arguments from the .pyx file? 

Thanks,

-Jon

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Barz | 11 Dec 13:18 2014

Unresolved external symbols when wrapping a C++ library

Hello together,

I'm trying to build a python wrapper for the library videoInput by ofTheo with Cython. I'm using Python 2.7 on Windows 8.1 x64 and Cython with the Visual Studio 2008 compiler (2012 is also installed). The first problem I faced was that the pre-built videoInput.lib is available for x86 only. For that I found a solution in a fork by liquidzym providing an x64 version. Unfortunately I got stuck with another problem. I get a linker error, LNK1120: 8 unresolved externals.

The extension in setup.py is defined as follows:

extensions = [Extension(  name="pyVideoInput",
                sources
=['pyVideoInput.pyx'],
                language
="c++",
                extra_objects
= ['videoInput.lib'],
                include_dirs
= ['videoInput/videoInputSrcAndDemos/libs/'],
                library_dirs
= ['vi_x64/'])
   
]

When building with setup.py build_ext --inplace I get a console output like:

E:\Entwicklung\Python\pyvideoinput>setup.py build_ext --inplace
running build_ext
building
'pyVideoInput' extension
C
:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IvideoInput/videoInputSrcAndDemos/libs/ -IC:\Python27\include -IC:\Python27\PC /TppyVideoInput.cpp /Fobuild\temp.win-amd64-2.7\Release\pyVideoInput.obj
pyVideoInput
.cpp
C
:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C
:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:vi_x64/ /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 /EXPORT:initpyVideoInput build\temp.win-amd64-2.7\Release\pyVideoInput.obj videoInput.lib /OUT:E:\Entwicklung\Python\pyvideoinput\pyVideoInput.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\pyVideoInput.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\pyVideoInput.pyd.manifest
videoInput
.lib(videoInput.obj) : warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1700' encountered; ignored
videoInput
.lib(videoInput.obj) : warning LNK4229: invalid directive '/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=0' encountered; ignored
videoInput
.lib(videoInput.obj) : warning LNK4229: invalid directive '/FAILIFMISMATCH:RuntimeLibrary=MT_StaticRelease' encountered; ignored
pyVideoInput
.obj : warning LNK4197: export 'initpyVideoInput' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.7\Release\pyVideoInput.lib and object build\temp.win-amd64-2.7\Release\pyVideoInput.exp
LINK
: warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc <at> std <at> <at> YAXXZ) referenced in function "char * __cdecl std::_Allocate<char>(unsigned __int64,char *)" (??$_Allocate <at> D <at> std <at> <at> YAPEAD_KPEAD <at> Z)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error <at> std <at> <at> YAXPEBD <at> Z) referenced in function "public: bool __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned__int64,bool)" (?_Grow <at> ?$basic_string <at> DU?$char_traits <at> D <at> std <at> <at> V?$allocator <at> D <at> 2 <at> <at> std <at> <at> QEAA_N_K_N <at> Z)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range <at> std <at> <at> YAXPEBD <at> Z) referenced in function "public: void __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xran(void)const " (?_Xran <at> ?$basic_string <at> DU?$char_traits <at> D <at> std <at> <at> V?$allocator <at> D <at> 2 <at> <at> std <at> <at> QEBAXXZ)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map <at> std <at> <at> YAPEBDH <at> Z) referenced in function "public: virtual class
std::error_condition __cdecl std::_System_error_category::default_error_condition(int)const "
(?default_error_condition <at> _System_error_category <at> std <at> <at> UEBA?AVerror_condition <at> 2 <at> H <at> Z)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map <at> std <at> <at> YAPEBDH <at> Z) referenced in function "public: virtual class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::_System_error_category::message(int)const "
(?message <at> _System_error_category <at> std <at> <at> UEBA?AV?$basic_string <at> DU?$char_traits <at> D <at> std <at> <at> V?$allocator <at> D <at> 2 <at> <at> 2 <at> H <at> Z)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol __imp_VariantInit referenced in function "private: long __cdecl videoInput::getDevice(struct IBaseFilter * *,int,wchar_t *,char *)" (?getDevice <at> videoInput <at> <at> AEAAJPEAPEAUIBaseFilter <at> <at> HPEA_WPEAD <at> Z)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol __imp_VariantClear referenced in function "private: long __cdecl videoInput::getDevice(struct IBaseFilter * *,int,wchar_t *,char *)" (?getDevice <at> videoInput <at> <at> AEAAJPEAPEAUIBaseFilter <at> <at> HPEA_WPEAD <at> Z)
videoInput
.lib(videoInput.obj) : error LNK2019: unresolved external symbol __imp_OleCreatePropertyFrame referenced in function "private: static long __cdecl videoInput::ShowFilterPropertyPages(structIBaseFilter *)" (?ShowFilterPropertyPages <at> videoInput <at> <at> CAJPEAUIBaseFilter <at> <at> <at> Z)
E
:\Entwicklung\Python\pyvideoinput\pyVideoInput.pyd : fatal error LNK1120: 8 unresolved externals
error
: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

I found some hints, one related to name mangling, another related to different MSVC compiler versions, but none of them was really helpful.

It would be great if someone has an idea on how to solve this issue.


Thanks in advance!

Best, Michael

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Lyrics Türkiye | 10 Dec 20:13 2014
Picon

Struct pointer declaring

Hello guys,

I started Cython new. Documention say to me (url)

cdef struct Grail:
   
int age
   
float volume

For this is use;

cdef Grail *gp

and after we know, I guess so like,

gp.age = 19

My sample is;

cdef struct kimlik:
    int tc
   
cdef kimlik k
k
.tc = 12345678911

print
"TC:",k.tc

result by to -539222977 If it isn't shot to me I must using pointer.

cdef kimlik * k

Compile is true but doesn't work it. (python.exe stopped by windows)

How is show to result value 12345678911?

Thank you for interest.
Best regards..

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
larsmans | 10 Dec 20:19 2014
Picon

run a small part of the test suite with runtests.py

Hi all,

Quick question: if I've altered a test in the Cython source code, how do I run only that test (or maybe the file it's in) and not the entire test suite with runtests.py? I couldn't find it in the --help output.

TIA,
Lars

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hai Nguyen | 10 Dec 17:50 2014
Picon

Cython syntax for CUDA programming?

Hi there,

As far as I know, supporting GPU for Python is still limited and the
most popular library is pycuda/pyopencl. In order to use it we still
need to write extension in C/C++ syntax
(http://documen.tician.de/pycuda/)

I am interested in writing CUDA code in clean Cython/Python syntax. Is
there any quick way to get this code below workable?
( I know that we can write very clean syntax with numbapro but
numbapro is not really free).

Thanks.

(This is very simple hello world example for running in GPU from this website
https://www.pdc.kth.se/resources/computers/zorn/how-to/how-to-compile-and-run-a-simple-cuda-hello-world)

hello.pyx
======
# pseudocode
from libcuda cimport *

DEF N = 7
DEF blocksize = 7

# dummy cuda decorator to let Cython know that it will be used with CUDA
cdef cuda(func, message):
    pass

 <at> cuda('global')
cdef void hello (char* a, int *b, cudablockcode=args):
    # C language: void __global__ hello(...)
    # cudablockcode will be translated to something like <<<dimGrid, dimBlock>>>
    # hello<<dimGrid, dimBlock>>>(ad, bd)
    a[threadIdx.x] += b[threadIdx.x]

cdef main():
    cdef char[N] a = "Hello "
    cdef int[N] b = [15, 10, 6, 0, -11, 1, 0]
    cdef:
        char* ad
        int* db
        int csize = N * sizeof(char)
        int isize = N * sizeof(int)
        int i=1
        dim3 dimBlock(blocksize, i)
        dim3 dimGrid(i, i)

    print a
    # alloc and copy to device
    cudaMalloc(<void**≥&ad, csize)
    cudaMalloc(<void**≥&bd, isize)
    cudaMemcpy(ad, a, csize, cudaMemcpyHostToDevice)
    cudaMemcpy(bd, b, isize, cudaMemcpyHostToDevice)

    # hello<<<dimGrid, dimBlock>>>(ad, bd)
    # call function in device
    hello(ad, bd, cudablockcode=(dimGrid, dimBlock))

    # copy to host
    cudaMemcpy(a, ad, csize, cudaMemcpyDeviceToHost)

    # free mem
    cudaFree(ad)

libcuda.pxd
========
# delaration for CUDA
cdef extern from "driver_types.h":
    ctypedef enum cudaError:
        pass
    ctypedef enum cudaMemcpyKind:
        cudaMemcpyHostToHost
        cudaMemcpyHostToDevice
        cudaMemcpyDeviceToHost
        cudaMemcpyDeviceToDevice
        cudaMemcpyDefault

cdef extern from "vector_types.h":
    ctypedef struct uint3:
        unsigned int x, y, z
    ctypedef struct dim3:
        pass

cdef extern from "cuda.h":
    uint3 threadIdx
    uint3 threadIdy
    uint3 threadIdz

cdef extern from "device_functions.h":
    void __syncthreads(void)

ctypedef cudaError cudaError_t
cdef extern from "cuda_device_runtime_api.h":
    cudaError_t cudaMalloc(void **p, size_t s)
    cudaError_t cudaMemcpy()

cdef extern from "cuda_runtime_api.h":
    cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, size_t count,
                                     enum cudaMemcpyKind kind)

cheer
Hai

--

-- 

--- 
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeroen Demeyer | 10 Dec 17:35 2014
Picon

Exporting C (not Cython) functions

Hello,

Is there a mechanism in Cython to __Pyx_ExportFunction() a function 
which is defined in a C library (which is not a Cython function)?

I want a mylib.pxd file with

cdef int myfunc()       # Note: not extern!

but without defining myfunc() in the .pyx file: the function myfunc() is 
actually implemented in C code which is linked with mylib.pyx.

Is this by any chance possible in Cython?

--

-- 

--- 
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert McGibbon | 9 Dec 08:40 2014
Picon

Creating an array or typed memoryview without holding the GIL?

Is it possible to allocate a typed memoryview without holding the GIL? I was hoping, for example, to use code like what is shown below, but the cast seems to require the gil.

```
from libc.stdlib cimport malloc, free

cdef double* p
cdef double[::1] X
cdef size_t N

with nogil:
        p = <double* >malloc(N*sizeof(double))
        X = <double[:N]> p
        [...]
        free(p)
```

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pedro Camargo | 9 Dec 00:25 2014
Picon

Memory Views and parallel computation

Hi there group.

                   I have not kept up too much with Cython since 0.16, but I am trying to keep up with it now as I try to implement a parallel version of the shortest path algorithms Jake Vanderplas created for SciPy (I'm running shortest path from all to all thousands of times for a really large network, so it NEEDS to be done in parallel, and I have 16 physical cores plus hyper threading).

          Back in early 2013, Sturla mentioned that I could use memory views, but I never got into doing it.
          Since each call of a Dijkstra algorithm will update a single row of the distance matrix, I imagine I can use a memory view of the network (the same for all the paths to be calculated) and a memory view for the corresponding line in the shortest path distance only to be updated in each call and use the cpdef *** nogil: structure found here: http://docs.cython.org/src/userguide/memoryviews.html

Am I missing anything?


Thanks,

Pedro

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ivan Smirnov | 8 Dec 15:52 2014
Picon

New-style type annotations with gdb_debug=True cause compiler crash

Type annotations of the form "variable: type" will cause compiler to crash if gdb_debug is enabled:


Error compiling Cython file:
------------------------------------------------------------
...
    cdef
void reraise_exc(self, e: Exception) except *:
                                           
^
------------------------------------------------------------


test
/file.pyx:195:44: Compiler crash in DebugTransform


ModuleNode.body = StatListNode(file.pyx:6:0)
StatListNode.stats[6] = StatListNode(file.pyx:26:5)
StatListNode.stats[0] = CClassDefNode(file.pyx:26:5,
    as_name
= u'File',
    class_name
= u'File',
    doc
= u'',
    module_name
= u'',
    visibility
= u'private')
CClassDefNode.body = StatListNode(file.pyx:27:4)
StatListNode.stats[2] = CFuncDefNode(file.pyx:195:9,
    args
= [...]/2,
    is_c_class_method
= 1,
    modifiers
= [...]/0,
    visibility
= u'private')
CFuncDefNode.declarator = CFuncDeclaratorNode(file.pyx:195:25,
    calling_convention
= '',
    exception_check
= 1)
CFuncDeclaratorNode.args[1] = CArgDeclNode(file.pyx:195:32,
    cf_is_null
= True,
    cf_maybe_null
= True,
    cf_state
= [...]/0,
    cname
= u'__pyx_v_e',
    is_generic
= 1,
    name
= u'e')
CArgDeclNode.annotation = NameNode(file.pyx:195:44,
    cf_maybe_null
= True,
    is_name
= True,
    name
= u'Exception',
    result_is_used
= True,
    use_managed_ref
= True)


Compiler crash traceback from this point on:
 
File "Cython/Compiler/Visitor.py", line 173, in Cython.Compiler.Visitor.TreeVisitor._visit (-------src-dir-------/Cython-0.21/Cython/Compiler/Visitor.c:4456)
 
File ".../site-packages/Cython/Compiler/ParseTreeTransforms.py", line 2937, in visit_NameNode
    node
.type.is_cfunction and
AttributeError: 'NoneType' object has no attribute 'is_cfunction'
Traceback (most recent call last):
 
File ".../site-packages/Cython/Build/Dependencies.py", line 962, in cythonize_one_helper
   
return cythonize_one(*m[1:])
 
File ".../site-packages/Cython/Build/Dependencies.py", line 944, in cythonize_one
   
raise CompileError(None, pyx_file)
CompileError: test/file.pyx
Traceback (most recent call last):
 
File "setup.py", line 218, in <module>
    setup
(**setup_args())
 
File ".../distutils/core.py", line 151, in setup
    dist
.run_commands()
 
File ".../distutils/dist.py", line 953, in run_commands
   
self.run_command(cmd)
 
File ".../distutils/dist.py", line 971, in run_command
    cmd_obj
.ensure_finalized()
 
File ".../distutils/cmd.py", line 109, in ensure_finalized
   
self.finalize_options()
 
File ".../site-packages/setuptools/command/build_ext.py", line 108, in finalize_options
    _build_ext
.finalize_options(self)
 
File ".../distutils/command/build_ext.py", line 140, in finalize_options
   
('plat_name', 'plat_name'),
 
File ".../distutils/cmd.py", line 298, in set_undefined_options
    src_cmd_obj
.ensure_finalized()
 
File ".../distutils/cmd.py", line 109, in ensure_finalized
   
self.finalize_options()
 
File ".../distutils/command/build.py", line 103, in finalize_options
   
if self.distribution.ext_modules:
 
File "setup.py", line 175, in __len__
   
return len(self.cythonized)
 
File "setup.py", line 154, in cythonized
   
self._cythonized = self._build_and_cythonize()
 
File "setup.py", line 169, in _build_and_cythonize
    gdb_debug
=True, output_dir=os.path.join(pkg_root(), '..'))
 
File ".../site-packages/Cython/Build/Dependencies.py", line 816, in cythonize
    result
.get(99999)  # seconds
 
File ".../multiprocessing/pool.py", line 558, in get
   
raise self._value
Cython.Compiler.Errors.CompileError: test/file.pyx


asd

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
vaxmogel | 8 Dec 11:45 2014
Picon

Weird bug in compiler flags when compiling an extension module

Hi folks,

recently, a bug during the installation of networkit through pip has been discovered for which we aren't able to find an explanation nor a solution.
When compiling the extension source code generated by Cython, it fails to compile, here's the line in question:

  g++-4.8 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c networkit/_NetworKit.cpp -o build/temp.macosx-10.6-intel-3.4/networkit/_NetworKit.o -fopenmp -std=c++11 -O3 -DNOGTEST

It seems that the compiler proceeds as usual, printing out warnings and such. Then, however, more than 100k lines complaining about bad register names in the assembler appear and g++ fails. This suggests, that the highlighted flags specifying the platform are responsible for this behaviour. I guess that most of the flags are generated by Cython's distutils(?), I thought that you maybe have an idea how these flags are gathered/determined.

Please note that this happened on a machine with Mac OSX 10.6 when installing the package through pip. The same happened when trying to build the extensions from a clone of the repository. Manually calling the line without -arch i386 does work, but is not really a solution for the automated installation through pip.

Since I'm not familiar with Mac OS and many installations on other Mac machines worked, the problem's origin is probably OS related and only appears when using Cython, however any help or hints to narrow it down are appreciated.

Thanks in advance,
Max

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Philips | 7 Dec 21:25 2014
Picon

Broadcasting and Memory Views

Is it correct that I should not expect broadcasting to work with memory views? That is what the following suggests. Aside: Is that compiler crash a bug?

def test():
    cdef np
.float64_t[:, :] test = np.ones(10, dtype=np.float64).reshape(5, 2)
   
   
# Compiler crash: Cython/Compiler/UtilNodes.py", AssertionError in line 143, in __init__: assert self.pos is not None
    test
[0] *= 3

    # Invalid operand types for '*' (float64_t[:, :]; long)
   
#test *= 3
   
    # Invalid operand types for '*' (float64_t[:, :]; long)
   
#test = test * 3
   
    # Invalid operand types for '*' (float64_t[:]; long)
   
#test[0] = test[0] * 3


In general, what will be the fastest way do to this? Should I do a manual loop? Or would it be better to do something like:

def test():
   test_
= np.ones(10, dtype=np.float64).reshape(5, 2)
   cdef np
.float64_t[:, :] test = test_
   
...
   test
[0] *= 3



--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gmane