binary_library.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 // This is a pure C header, no C++ here.
11 // The functions declared here will be implemented in C++ but
12 // we don't have to know, because thanks to the extern "C" syntax,
13 // they will be compiled to C object code.
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 // just dummy empty structs to give different pointer types,
20 // instead of using void* which would be type unsafe
21 struct C_MatrixXd {};
22 struct C_Map_MatrixXd {};
23 
24 // the C_MatrixXd class, wraps some of the functionality
25 // of Eigen::MatrixXd.
26 struct C_MatrixXd *MatrixXd_new(int rows, int cols);
27 void MatrixXd_delete(struct C_MatrixXd *m);
28 double *MatrixXd_data(struct C_MatrixXd *m);
29 void MatrixXd_set_zero(struct C_MatrixXd *m);
30 void MatrixXd_resize(struct C_MatrixXd *m, int rows, int cols);
31 void MatrixXd_copy(struct C_MatrixXd *dst, const struct C_MatrixXd *src);
32 void MatrixXd_copy_map(struct C_MatrixXd *dst, const struct C_Map_MatrixXd *src);
33 void MatrixXd_set_coeff(struct C_MatrixXd *m, int i, int j, double coeff);
34 double MatrixXd_get_coeff(const struct C_MatrixXd *m, int i, int j);
35 void MatrixXd_print(const struct C_MatrixXd *m);
36 void MatrixXd_add(const struct C_MatrixXd *m1, const struct C_MatrixXd *m2, struct C_MatrixXd *result);
37 void MatrixXd_multiply(const struct C_MatrixXd *m1, const struct C_MatrixXd *m2, struct C_MatrixXd *result);
38 
39 // the C_Map_MatrixXd class, wraps some of the functionality
40 // of Eigen::Map<MatrixXd>
41 struct C_Map_MatrixXd *Map_MatrixXd_new(double *array, int rows, int cols);
44 void Map_MatrixXd_copy(struct C_Map_MatrixXd *dst, const struct C_Map_MatrixXd *src);
45 void Map_MatrixXd_copy_matrix(struct C_Map_MatrixXd *dst, const struct C_MatrixXd *src);
46 void Map_MatrixXd_set_coeff(struct C_Map_MatrixXd *m, int i, int j, double coeff);
47 double Map_MatrixXd_get_coeff(const struct C_Map_MatrixXd *m, int i, int j);
48 void Map_MatrixXd_print(const struct C_Map_MatrixXd *m);
49 void Map_MatrixXd_add(const struct C_Map_MatrixXd *m1, const struct C_Map_MatrixXd *m2, struct C_Map_MatrixXd *result);
50 void Map_MatrixXd_multiply(const struct C_Map_MatrixXd *m1, const struct C_Map_MatrixXd *m2,
51  struct C_Map_MatrixXd *result);
52 
53 #ifdef __cplusplus
54 } // end extern "C"
55 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Matrix3d m1
Definition: IOFormat.cpp:2
MatrixType m2(n_dims)
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
void MatrixXd_multiply(const struct C_MatrixXd *m1, const struct C_MatrixXd *m2, struct C_MatrixXd *result)
void MatrixXd_add(const struct C_MatrixXd *m1, const struct C_MatrixXd *m2, struct C_MatrixXd *result)
double Map_MatrixXd_get_coeff(const struct C_Map_MatrixXd *m, int i, int j)
double * MatrixXd_data(struct C_MatrixXd *m)
Definition: binary_library.cpp:53
double MatrixXd_get_coeff(const struct C_MatrixXd *m, int i, int j)
void Map_MatrixXd_copy(struct C_Map_MatrixXd *dst, const struct C_Map_MatrixXd *src)
void Map_MatrixXd_print(const struct C_Map_MatrixXd *m)
void MatrixXd_copy(struct C_MatrixXd *dst, const struct C_MatrixXd *src)
void MatrixXd_print(const struct C_MatrixXd *m)
void MatrixXd_resize(struct C_MatrixXd *m, int rows, int cols)
Definition: binary_library.cpp:57
void Map_MatrixXd_set_zero(struct C_Map_MatrixXd *m)
Definition: binary_library.cpp:85
void Map_MatrixXd_set_coeff(struct C_Map_MatrixXd *m, int i, int j, double coeff)
Definition: binary_library.cpp:91
void Map_MatrixXd_copy_matrix(struct C_Map_MatrixXd *dst, const struct C_MatrixXd *src)
void Map_MatrixXd_add(const struct C_Map_MatrixXd *m1, const struct C_Map_MatrixXd *m2, struct C_Map_MatrixXd *result)
struct C_Map_MatrixXd * Map_MatrixXd_new(double *array, int rows, int cols)
Definition: binary_library.cpp:79
void Map_MatrixXd_delete(struct C_Map_MatrixXd *m)
Definition: binary_library.cpp:83
void MatrixXd_delete(struct C_MatrixXd *m)
Definition: binary_library.cpp:51
struct C_MatrixXd * MatrixXd_new(int rows, int cols)
Definition: binary_library.cpp:49
void Map_MatrixXd_multiply(const struct C_Map_MatrixXd *m1, const struct C_Map_MatrixXd *m2, struct C_Map_MatrixXd *result)
void MatrixXd_copy_map(struct C_MatrixXd *dst, const struct C_Map_MatrixXd *src)
void MatrixXd_set_zero(struct C_MatrixXd *m)
Definition: binary_library.cpp:55
void MatrixXd_set_coeff(struct C_MatrixXd *m, int i, int j, double coeff)
Definition: binary_library.cpp:63
int * m
Definition: level2_cplx_impl.h:294
std::array< T, N > array
Definition: EmulateArray.h:231
Definition: binary_library.h:22
Definition: binary_library.h:21
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2