nb_multiply and different types

A

Andrew Wilkinson

Hi,

I'm trying to wrap a Vector and Matrix class I have written in C into Python
types. Everything is working nicely, except for the Matrix multiply by
Vector function.

I have defined an nb_multiple callback, and it works fine for Matrix *
Matrix - but it's not even getting called for Matrix * Vector - Python is
deciding for me that its of the wrong type, and raising a type error. How
do I persuade it that I know what I'm doing?

I have seen about about coercing, but I'm not sure if that'll do what I want
- if someone could give me an example that'd be muchly appreciated.

Thanks in advance,
Andrew Wilkinson
 
A

Andrew Wilkinson

Andrew said:
Hi,

I'm trying to wrap a Vector and Matrix class I have written in C into
Python types. Everything is working nicely, except for the Matrix multiply
by Vector function.

Ok, ignore me - I've discovered that coercion is what I wanted, and I've got
it working.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,478
Latest member
ReginaldVi

Latest Threads

Top