~jfpacker/pyeigen/bugfixes-0.1

« back to all changes in this revision

Viewing changes to source/matrix/matrix4f.h

  • Committer: Jussi Lepistö
  • Date: 2010-03-20 00:16:13 UTC
  • Revision ID: jussi.lepisto@iki.fi-20100320001613-f08k4wgogq8p7ogf
- Directory structure reorganization
- Matrix inverse & transpose
- Class methods for creating matrices and vectors
- Matrix * vector multiply
- Fix repr for matrix classes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2010 Jussi Lepisto
 
2
 
 
3
#ifndef MATRIX4F_H
 
4
#define MATRIX4F_H
 
5
 
 
6
#include <Python.h>
 
7
#include <Eigen/Core>
 
8
 
 
9
 
 
10
typedef struct
 
11
{
 
12
        PyObject_HEAD
 
13
        Eigen::Matrix4f matrix;
 
14
} Matrix4f;
 
15
 
 
16
extern PyTypeObject Matrix4fType;
 
17
 
 
18
// Helpers
 
19
int Matrix4f_Check(PyObject* p);
 
20
int Matrix4f_ParseKey(PyObject* key, Py_ssize_t& key1, Py_ssize_t& key2);
 
21
 
 
22
// Construction
 
23
PyObject* Matrix4f_new(PyTypeObject* type, PyObject* args, PyObject* kwds);
 
24
int Matrix4f_init(Matrix4f* self, PyObject* args, PyObject* kwds);
 
25
void Matrix4f_dealloc(Matrix4f* self);
 
26
 
 
27
// Properties
 
28
PyObject* Matrix4f_get_inverse(Matrix4f* self, void* closure);
 
29
PyObject* Matrix4f_get_transpose(Matrix4f* self, void* closure);
 
30
int Matrix4f_set_transpose(Matrix4f* self, PyObject* value, void* closure);
 
31
 
 
32
// Methods
 
33
PyObject* Matrix4f_zero(PyTypeObject* cls, PyObject* args);
 
34
PyObject* Matrix4f_ones(PyTypeObject* cls, PyObject* args);
 
35
PyObject* Matrix4f_constant(PyTypeObject* cls, PyObject* args);
 
36
PyObject* Matrix4f_identity(PyTypeObject* cls, PyObject* args);
 
37
PyObject* Matrix4f_random(PyTypeObject* cls, PyObject* args);
 
38
 
 
39
PyObject* Matrix4f_set(Matrix4f* self, PyObject* args);
 
40
PyObject* Matrix4f_set_zero(Matrix4f* self, PyObject* noargs);
 
41
PyObject* Matrix4f_set_ones(Matrix4f* self, PyObject* noargs);
 
42
PyObject* Matrix4f_set_identity(Matrix4f* self, PyObject* noargs);
 
43
PyObject* Matrix4f_set_constant(Matrix4f* self, PyObject* args);
 
44
PyObject* Matrix4f_set_random(Matrix4f* self, PyObject* noargs);
 
45
 
 
46
PyObject* Matrix4f_get_block2(Matrix4f* self, PyObject* args);
 
47
PyObject* Matrix4f_set_block2(Matrix4f* self, PyObject* args);
 
48
PyObject* Matrix4f_get_block3(Matrix4f* self, PyObject* args);
 
49
PyObject* Matrix4f_set_block3(Matrix4f* self, PyObject* args);
 
50
PyObject* Matrix4f_get_col(Matrix4f* self, PyObject* args);
 
51
PyObject* Matrix4f_set_col(Matrix4f* self, PyObject* args);
 
52
PyObject* Matrix4f_get_row(Matrix4f* self, PyObject* args);
 
53
PyObject* Matrix4f_set_row(Matrix4f* self, PyObject* args);
 
54
 
 
55
// Number methods
 
56
PyObject* Matrix4f_add(PyObject* o1, PyObject* o2);
 
57
PyObject* Matrix4f_subtract(PyObject* o1, PyObject* o2);
 
58
PyObject* Matrix4f_multiply(PyObject* o1, PyObject* o2);
 
59
PyObject* Matrix4f_divide(PyObject* o1, PyObject* o2);
 
60
PyObject* Matrix4f_negative(PyObject* o);
 
61
PyObject* Matrix4f_inplace_add(PyObject* o1, PyObject* o2);
 
62
PyObject* Matrix4f_inplace_subtract(PyObject* o1, PyObject* o2);
 
63
PyObject* Matrix4f_inplace_multiply(PyObject* o1, PyObject* o2);
 
64
PyObject* Matrix4f_inplace_divide(PyObject* o1, PyObject* o2);
 
65
 
 
66
// Mapping methods
 
67
Py_ssize_t Matrix4f_length(Matrix4f* self);
 
68
PyObject* Matrix4f_subscript(Matrix4f* self, PyObject* key);
 
69
int Matrix4f_ass_subscript(Matrix4f* self, PyObject* key, PyObject* value);
 
70
 
 
71
// Special methods
 
72
PyObject* Matrix4f_repr(Matrix4f* self);
 
73
 
 
74
#endif