ruby-mpfi 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +62 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +48 -0
- data/Rakefile +26 -0
- data/ext/mpfi/extconf.rb +10 -0
- data/ext/mpfi/func_mpfi_extention.c +52 -0
- data/ext/mpfi/func_mpfi_extention.h +2 -0
- data/ext/mpfi/make_c_source.rb +115 -0
- data/ext/mpfi/ruby_mpfi.c +1452 -0
- data/ext/mpfi/ruby_mpfi.h +39 -0
- data/ext/mpfi/ruby_mpfr.h +38 -0
- data/ext/mpfi/yasnippet_mpfi.el +44 -0
- data/ext/mpfi_complex/mpfi/extconf.rb +10 -0
- data/ext/mpfi_complex/mpfi/func_mpfi_extention.h +2 -0
- data/ext/mpfi_complex/mpfi/func_ruby_mpfi_complex.c +130 -0
- data/ext/mpfi_complex/mpfi/func_ruby_mpfi_complex.h +35 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi.h +39 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi_complex.c +217 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi_complex.h +15 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfr.h +38 -0
- data/ext/mpfi_matrix/mpfi/extconf.rb +9 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_extention.h +2 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_matrix.c +795 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_matrix.h +103 -0
- data/ext/mpfi_matrix/mpfi/func_mpfr_matrix.h +72 -0
- data/ext/mpfi_matrix/mpfi/func_ruby_mpfi_complex.h +35 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi.h +39 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_complex.h +15 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.c +1200 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.h +13 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfr.h +38 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfr_matrix.h +13 -0
- data/lib/mpfi/matrix.rb +188 -0
- data/lib/mpfi/version.rb +3 -0
- data/ruby-mpfi.gemspec +35 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/mpfi/generate_number_module.rb +48 -0
- data/spec/mpfi/mpfi_alloc_spec.rb +55 -0
- data/spec/mpfi/mpfi_diam_arithmetic_spec.rb +25 -0
- data/spec/mpfi/mpfi_interval_arithmetic_spec.rb +105 -0
- data/spec/mpfi/mpfi_interval_functions_spec.rb +95 -0
- data/spec/mpfi/mpfi_math_functions_spec.rb +16 -0
- data/spec/mpfi/mpfi_set_operation_spec.rb +102 -0
- data/spec/mpfi/ruby-mpfi_spec.rb +11 -0
- data/spec/mpfi/spec_helper.rb +10 -0
- data/spec/mpfi_complex/spec_helper.rb +10 -0
- data/spec/mpfi_matrix/generate_matrix_arguments.rb +65 -0
- data/spec/mpfi_matrix/mpfi_matrix_alloc_spec.rb +134 -0
- data/spec/mpfi_matrix/mpfi_matrix_arithmetic_spec.rb +156 -0
- data/spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb +30 -0
- data/spec/mpfi_matrix/mpfi_matrix_set_element_spec.rb +55 -0
- data/spec/mpfi_matrix/mpfi_matrix_set_operation_spec.rb +71 -0
- data/spec/mpfi_matrix/mpfi_matrix_string_spec.rb +32 -0
- data/spec/mpfi_matrix/mpfi_matrix_subdivision_spec.rb +14 -0
- data/spec/mpfi_matrix/mpfi_square_matrix_spec.rb +37 -0
- data/spec/mpfi_matrix/mpfi_vector_spec.rb +15 -0
- data/spec/mpfi_matrix/spec_helper.rb +19 -0
- data/spec/spec.opts +1 -0
- data/tasks/extconf.rake +36 -0
- metadata +132 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
#include <mpfr.h>
|
4
|
+
#include <mpfi.h>
|
5
|
+
#include <mpfi_io.h>
|
6
|
+
#include "ruby_mpfr_matrix.h"
|
7
|
+
#include "ruby_mpfi.h"
|
8
|
+
#include "ruby_mpfi_complex.h"
|
9
|
+
|
10
|
+
typedef struct __MPFIMatrix{
|
11
|
+
int row, column, size;
|
12
|
+
MPFI *data;
|
13
|
+
} MPFIMatrix;
|
14
|
+
|
15
|
+
/*
|
16
|
+
1 2 3
|
17
|
+
4 5 6
|
18
|
+
|
19
|
+
row = 2
|
20
|
+
column = 3
|
21
|
+
size = 6
|
22
|
+
MPFI *data 1 4 2 5 3 6
|
23
|
+
|
24
|
+
(i, j) element => data + i + row * j
|
25
|
+
0 <= i < 2, 0 <= j < 3
|
26
|
+
*/
|
27
|
+
|
28
|
+
#define r_mpfi_make_matrix_struct(ruby_var, mpfi_var) { ruby_var = Data_Make_Struct(r_mpfi_matrix, MPFIMatrix, 0, r_mpfi_matrix_free, mpfi_var); }
|
29
|
+
#define r_mpfi_get_matrix_struct(mpfi_var, ruby_var) { Data_Get_Struct(ruby_var, MPFIMatrix, mpfi_var); }
|
30
|
+
|
31
|
+
#define r_mpfi_make_square_matrix_struct(ruby_var, mpfi_var) { ruby_var = Data_Make_Struct(r_mpfi_square_matrix, MPFIMatrix, 0, r_mpfi_matrix_free, mpfi_var); }
|
32
|
+
#define r_mpfi_make_col_vector_struct(ruby_var, mpfi_var) { ruby_var = Data_Make_Struct(r_mpfi_col_vector, MPFIMatrix, 0, r_mpfi_matrix_free, mpfi_var); }
|
33
|
+
#define r_mpfi_make_row_vector_struct(ruby_var, mpfi_var) { ruby_var = Data_Make_Struct(r_mpfi_row_vector, MPFIMatrix, 0, r_mpfi_matrix_free, mpfi_var); }
|
34
|
+
|
35
|
+
#define r_mpfi_matrix_temp_alloc_init(mpfi_var, i, j) { mpfi_var = ALLOC_N(MPFIMatrix, 1); mpfi_matrix_init(mpfi_var, i, j); }
|
36
|
+
#define r_mpfi_matrix_temp_free(mpfi_var) { mpfi_matrix_clear(mpfi_var); free(mpfi_var); }
|
37
|
+
|
38
|
+
#define mpfi_matrix_get_ptr(matrix, i) (matrix->data + i)
|
39
|
+
#define mpfi_matrix_get_element(matrix, i, j) (matrix->data + i + matrix->row * j)
|
40
|
+
|
41
|
+
|
42
|
+
/* Returned value may be same pointer as an argument which has always same size. */
|
43
|
+
/* But if returned value may have different size from that of an argument */
|
44
|
+
/* (for example, mpfi_matrix_transpose), */
|
45
|
+
/* you must use differnt pointer for returned value from that of an argument. */
|
46
|
+
|
47
|
+
void mpfi_matrix_clear(MPFIMatrix *mat);
|
48
|
+
void mpfi_matrix_init(MPFIMatrix *mat, int row, int column);
|
49
|
+
void mpfi_matrix_set_zeros(MPFIMatrix *mat);
|
50
|
+
void mpfi_matrix_set_element(MPFIMatrix *mat, int row, int col, MPFI *a);
|
51
|
+
void mpfi_matrix_set(MPFIMatrix *new, MPFIMatrix *x);
|
52
|
+
void mpfi_matrix_swap(MPFIMatrix *x, MPFIMatrix *y);
|
53
|
+
|
54
|
+
void mpfi_matrix_row(MPFIMatrix *new, MPFIMatrix *x, int row);
|
55
|
+
void mpfi_matrix_column(MPFIMatrix *new, MPFIMatrix *x, int column);
|
56
|
+
void mpfi_matrix_transpose(MPFIMatrix *new, MPFIMatrix *x);
|
57
|
+
void mpfi_matrix_neg(MPFIMatrix *new, MPFIMatrix *x);
|
58
|
+
|
59
|
+
int mpfi_matrix_equal_p(MPFIMatrix *x, MPFIMatrix *y);
|
60
|
+
void mpfi_matrix_add(MPFIMatrix *new, MPFIMatrix *x, MPFIMatrix *y);
|
61
|
+
void mpfi_matrix_add_fr(MPFIMatrix *new, MPFIMatrix *x, MPFRMatrix *y);
|
62
|
+
void mpfi_matrix_sub(MPFIMatrix *new, MPFIMatrix *x, MPFIMatrix *y);
|
63
|
+
void mpfi_matrix_sub_fr(MPFIMatrix *new, MPFIMatrix *x, MPFRMatrix *y);
|
64
|
+
void mpfi_matrix_mul(MPFIMatrix *new, MPFIMatrix *x, MPFIMatrix *y);
|
65
|
+
void mpfi_matrix_mul_fr(MPFIMatrix *new, MPFIMatrix *x, MPFRMatrix *y);
|
66
|
+
void mpfi_matrix_mul_scalar(MPFIMatrix *new, MPFIMatrix *x, MPFI *scalar);
|
67
|
+
void mpfi_matrix_div_scalar(MPFIMatrix *new, MPFIMatrix *x, MPFI *scalar);
|
68
|
+
|
69
|
+
int mpfi_matrix_include_p(MPFIMatrix *x, MPFIMatrix *y);
|
70
|
+
int mpfi_matrix_include_fr_p(MPFIMatrix *x, MPFRMatrix *y);
|
71
|
+
int mpfi_matrix_strictly_include_p(MPFIMatrix *x, MPFIMatrix *y);
|
72
|
+
int mpfi_matrix_bounded_p(MPFIMatrix *x);
|
73
|
+
void mpfi_matrix_mid(MPFRMatrix *ret, MPFIMatrix *x);
|
74
|
+
void mpfi_matrix_mid_interval(MPFIMatrix *ret, MPFIMatrix *x);
|
75
|
+
void mpfi_matrix_from_mpfr_matrix(MPFIMatrix *ret, MPFRMatrix *x);
|
76
|
+
int mpfi_matrix_intersect(MPFIMatrix *ret, MPFIMatrix *x, MPFIMatrix *y);
|
77
|
+
int mpfi_matrix_union(MPFIMatrix *z, MPFIMatrix *x, MPFIMatrix *y);
|
78
|
+
|
79
|
+
void mpfi_matrix_inner_product(MPFI *pr, MPFIMatrix *x, MPFIMatrix *y);
|
80
|
+
void mpfi_matrix_vector_distance(MPFI *distance, MPFIMatrix *x, MPFIMatrix *y);
|
81
|
+
void mpfi_matrix_vector_distance_center_pts(MPFR *distance, MPFIMatrix *x, MPFIMatrix *y);
|
82
|
+
void mpfi_matrix_vector_norm(MPFI *norm, MPFIMatrix *x);
|
83
|
+
void mpfi_matrix_max_norm(MPFI *norm, MPFIMatrix *x);
|
84
|
+
void mpfi_matrix_max_diam_abs(MPFR *diam, MPFIMatrix *x);
|
85
|
+
|
86
|
+
/* ----------------- vector ---------------- */
|
87
|
+
void mpfi_col_vector_init(MPFIMatrix *mat, int row);
|
88
|
+
void mpfi_row_vector_init(MPFIMatrix *mat, int column);
|
89
|
+
int mpfi_vector_normalize(MPFIMatrix *new, MPFIMatrix *x);
|
90
|
+
void mpfi_vector_midpoint(MPFIMatrix *new, MPFIMatrix *x, MPFIMatrix *y);
|
91
|
+
int mpfi_vector_set_length(MPFIMatrix *new, MPFIMatrix *x, MPFR *l);
|
92
|
+
|
93
|
+
/* ----------------- square matrix ----------------- */
|
94
|
+
int mpfi_square_matrix_lu_decomp (MPFIMatrix *ret, int *indx, MPFIMatrix *x);
|
95
|
+
void mpfi_2d_square_matrix_determinant(MPFI *det, MPFIMatrix *x);
|
96
|
+
void mpfi_3d_square_matrix_determinant(MPFI *det, MPFIMatrix *x);
|
97
|
+
void mpfi_square_matrix_determinant(MPFI *det, MPFIMatrix *x);
|
98
|
+
void mpfi_square_matrix_qr_decomp(MPFIMatrix *q, MPFIMatrix *r, MPFIMatrix *x);
|
99
|
+
int mpfi_2d_square_matrix_inverse_matrix(MPFIMatrix *inv, MPFIMatrix *x);
|
100
|
+
int mpfi_2d_square_matrix_eigenvalue(MPFI *val1, MPFI *val2, MPFIMatrix *x);
|
101
|
+
void mpfi_2d_square_matrix_real_eigenvector(MPFIMatrix *vec, MPFIMatrix *x, MPFI *eigenval);
|
102
|
+
void mpfi_square_matrix_identity(MPFIMatrix *id);
|
103
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
#include <mpfr.h>
|
4
|
+
#include "ruby_mpfr.h"
|
5
|
+
|
6
|
+
typedef struct __MPFRMatrix{
|
7
|
+
int row, column, size;
|
8
|
+
MPFR *data;
|
9
|
+
} MPFRMatrix;
|
10
|
+
|
11
|
+
/*
|
12
|
+
1 2 3
|
13
|
+
4 5 6
|
14
|
+
|
15
|
+
row = 2
|
16
|
+
column = 3
|
17
|
+
size = 6
|
18
|
+
MPFR *data 1 4 2 5 3 6
|
19
|
+
|
20
|
+
(i, j) element => data + i + row * j
|
21
|
+
0 <= i < 2, 0 <= j < 3
|
22
|
+
*/
|
23
|
+
|
24
|
+
#define r_mpfr_make_matrix_struct(ruby_var, c_var) { ruby_var = Data_Make_Struct(r_mpfr_matrix, MPFRMatrix, 0, r_mpfr_matrix_free, c_var); }
|
25
|
+
#define r_mpfr_get_matrix_struct(c_var, ruby_var) { Data_Get_Struct(ruby_var, MPFRMatrix, c_var); }
|
26
|
+
|
27
|
+
#define r_mpfr_make_square_matrix_struct(ruby_var, c_var) { ruby_var = Data_Make_Struct(r_mpfr_square_matrix, MPFRMatrix, 0, r_mpfr_matrix_free, c_var); }
|
28
|
+
#define r_mpfr_make_col_vector_struct(ruby_var, c_var) { ruby_var = Data_Make_Struct(r_mpfr_col_vector, MPFRMatrix, 0, r_mpfr_matrix_free, c_var); }
|
29
|
+
#define r_mpfr_make_row_vector_struct(ruby_var, c_var) { ruby_var = Data_Make_Struct(r_mpfr_row_vector, MPFRMatrix, 0, r_mpfr_matrix_free, c_var); }
|
30
|
+
|
31
|
+
#define r_mpfr_matrix_temp_alloc_init(c_var, i, j) { c_var = ALLOC_N(MPFRMatrix, 1); mpfr_matrix_init(c_var, i, j); }
|
32
|
+
#define r_mpfr_matrix_temp_free(c_var) { mpfr_matrix_clear(c_var); free(c_var); }
|
33
|
+
|
34
|
+
#define mpfr_matrix_get_ptr(matrix, i) (matrix->data + i)
|
35
|
+
#define mpfr_matrix_get_element(matrix, i, j) (matrix->data + i + matrix->row * j)
|
36
|
+
|
37
|
+
void mpfr_matrix_clear(MPFRMatrix *mat);
|
38
|
+
void mpfr_matrix_init(MPFRMatrix *mat, int row, int column);
|
39
|
+
void mpfr_matrix_set_zeros(MPFRMatrix *mat);
|
40
|
+
void mpfr_matrix_set_element(MPFRMatrix *mat, int row, int col, MPFR *a);
|
41
|
+
void mpfr_matrix_set(MPFRMatrix *new, MPFRMatrix *x);
|
42
|
+
void mpfr_matrix_swap(MPFRMatrix *x, MPFRMatrix *y);
|
43
|
+
|
44
|
+
void mpfr_matrix_row(MPFRMatrix *new, MPFRMatrix *x, int row);
|
45
|
+
void mpfr_matrix_column(MPFRMatrix *new, MPFRMatrix *x, int column);
|
46
|
+
void mpfr_matrix_transpose(MPFRMatrix *new, MPFRMatrix *x);
|
47
|
+
void mpfr_matrix_neg(MPFRMatrix *new, MPFRMatrix *x);
|
48
|
+
|
49
|
+
int mpfr_matrix_equal_p(MPFRMatrix *x, MPFRMatrix *y);
|
50
|
+
void mpfr_matrix_add(MPFRMatrix *new, MPFRMatrix *x, MPFRMatrix *y);
|
51
|
+
void mpfr_matrix_sub(MPFRMatrix *new, MPFRMatrix *x, MPFRMatrix *y);
|
52
|
+
void mpfr_matrix_mul(MPFRMatrix *new, MPFRMatrix *x, MPFRMatrix *y);
|
53
|
+
void mpfr_matrix_mul_scalar(MPFRMatrix *new, MPFRMatrix *x, MPFR *scalar);
|
54
|
+
void mpfr_matrix_div_scalar(MPFRMatrix *new, MPFRMatrix *x, MPFR *scalar);
|
55
|
+
void mpfr_matrix_inner_product(MPFR *pr, MPFRMatrix *x, MPFRMatrix *y);
|
56
|
+
void mpfr_matrix_vector_distance(MPFR *distance, MPFRMatrix *x, MPFRMatrix *y);
|
57
|
+
void mpfr_matrix_vector_norm(MPFR *norm, MPFRMatrix *x);
|
58
|
+
void mpfr_matrix_max_norm(MPFR *norm, MPFRMatrix *x);
|
59
|
+
|
60
|
+
void mpfr_col_vector_init(MPFRMatrix *mat, int row);
|
61
|
+
void mpfr_row_vector_init(MPFRMatrix *mat, int column);
|
62
|
+
int mpfr_vector_normalize(MPFRMatrix *new, MPFRMatrix *x);
|
63
|
+
int mpfr_vector_set_length(MPFRMatrix *new, MPFRMatrix *x, MPFR *l);
|
64
|
+
void mpfr_vector_midpoint(MPFRMatrix *new, MPFRMatrix *x, MPFRMatrix *y);
|
65
|
+
void mpfr_vector_dividing_point(MPFRMatrix *new, MPFRMatrix *x, MPFRMatrix *y, MPFR *div);
|
66
|
+
|
67
|
+
int mpfr_square_matrix_lu_decomp (MPFRMatrix *ret, int *indx, MPFRMatrix *x);
|
68
|
+
void mpfr_square_matrix_determinant(MPFR *det, MPFRMatrix *x);
|
69
|
+
void mpfr_square_matrix_qr_decomp(MPFRMatrix *q, MPFRMatrix *r, MPFRMatrix *x);
|
70
|
+
void mpfr_square_matrix_identity(MPFRMatrix *id);
|
71
|
+
|
72
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
#include <mpfr.h>
|
4
|
+
#include <mpfi.h>
|
5
|
+
#include <mpfi_io.h>
|
6
|
+
#include "ruby_mpfi.h"
|
7
|
+
|
8
|
+
VALUE r_mpfi_complex;
|
9
|
+
|
10
|
+
typedef struct __MPFIComplex{
|
11
|
+
MPFI *re;
|
12
|
+
MPFI *im;
|
13
|
+
} MPFIComplex;
|
14
|
+
|
15
|
+
/* Although x->re and x->im can have different precision from each other for MPFIComplex x, */
|
16
|
+
/* we implement mpfi_complex_get_prec assuming that they have same presition. */
|
17
|
+
#define mpfi_complex_get_prec(x) mpfi_get_prec(x->re)
|
18
|
+
|
19
|
+
void mpfi_complex_init(MPFIComplex *x);
|
20
|
+
void mpfi_complex_clear(MPFIComplex *x);
|
21
|
+
void mpfi_complex_set_zeros(MPFIComplex *x);
|
22
|
+
void mpfi_complex_set_real_part(MPFIComplex *x, MPFI *a);
|
23
|
+
void mpfi_complex_set_imaginary_part(MPFIComplex *x, MPFI *a);
|
24
|
+
void mpfi_complex_set(MPFIComplex *new, MPFIComplex *x);
|
25
|
+
void mpfi_complex_conjugate(MPFIComplex *new, MPFIComplex *x);
|
26
|
+
void mpfi_complex_add(MPFIComplex *new, MPFIComplex *x, MPFIComplex *y);
|
27
|
+
void mpfi_complex_sub(MPFIComplex *new, MPFIComplex *x, MPFIComplex *y);
|
28
|
+
void mpfi_complex_mul(MPFIComplex *new, MPFIComplex *x, MPFIComplex *y);
|
29
|
+
void mpfi_complex_div(MPFIComplex *new, MPFIComplex *x, MPFIComplex *y);
|
30
|
+
|
31
|
+
/* void mpfi_complex_mul_real(MPFIComplex *new, MPFIComplex *x, MPFI *y); */
|
32
|
+
/* void mpfi_complex_mul_pure_imaginary(MPFIComplex *new, MPFIComplex *x, MPFI *y); */
|
33
|
+
/* void mpfi_complex_div_real(MPFIComplex *new, MPFIComplex *x, MPFI *y); */
|
34
|
+
/* void mpfi_complex_div_pure_imaginary(MPFIComplex *new, MPFIComplex *x, MPFI *y); */
|
35
|
+
/* void mpfi_complex_abs(MPFI *new, MPFIComplex *x); */
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#ifndef _RUBY_MPFI_H_
|
2
|
+
#define _RUBY_MPFI_H_
|
3
|
+
|
4
|
+
#include <stdio.h>
|
5
|
+
#include <ruby.h>
|
6
|
+
#include <mpfr.h>
|
7
|
+
#include <mpfi.h>
|
8
|
+
#include <mpfi_io.h>
|
9
|
+
#include "func_mpfi_extention.h"
|
10
|
+
#include "ruby_mpfr.h"
|
11
|
+
|
12
|
+
typedef __mpfi_struct MPFI;
|
13
|
+
|
14
|
+
VALUE r_mpfi_class, r_mpfi_math;;
|
15
|
+
|
16
|
+
#define r_mpfi_make_struct(ruby_var, c_var) { ruby_var = Data_Make_Struct(r_mpfi_class, MPFI, 0, r_mpfi_free, c_var); }
|
17
|
+
#define r_mpfi_make_struct_init(ruby_var, c_var) { r_mpfi_make_struct(ruby_var, c_var); mpfi_init(c_var); }
|
18
|
+
#define r_mpfi_make_struct_init2(ruby_var, c_var, prec) { r_mpfi_make_struct(ruby_var, c_var); mpfi_init2(c_var, prec); }
|
19
|
+
#define r_mpfi_get_struct(c_var, ruby_var) { Data_Get_Struct(ruby_var, MPFI, c_var); }
|
20
|
+
|
21
|
+
#define r_mpfi_temp_alloc(c_var) { c_var=ALLOC_N(MPFI, 1); }
|
22
|
+
#define r_mpfi_temp_alloc_init(c_var) { r_mpfi_temp_alloc(c_var); mpfi_init(c_var); }
|
23
|
+
#define r_mpfi_temp_alloc_init2(c_var, prec) { r_mpfi_temp_alloc(c_var); mpfi_init2(c_var, prec); }
|
24
|
+
#define r_mpfi_temp_free(c_var) { mpfi_clear(c_var); free(c_var); }
|
25
|
+
|
26
|
+
#define r_mpfi_left_ptr(c_var) (&((c_var)->left))
|
27
|
+
#define r_mpfi_right_ptr(c_var) (&((c_var)->right))
|
28
|
+
|
29
|
+
void r_mpfi_free(void *ptr);
|
30
|
+
VALUE r_mpfi_make_new_fi_obj(MPFI *ptr);
|
31
|
+
VALUE r_mpfi_new_fi_obj(VALUE obj);
|
32
|
+
void r_mpfi_set_robj(MPFI *ptr, VALUE obj);
|
33
|
+
|
34
|
+
int r_mpfi_subdivision2(int num, MPFI *ret, mpfi_t x);
|
35
|
+
|
36
|
+
void r_mpfi_set_function_state(int num);
|
37
|
+
VALUE r_mpfr_get_function_state(VALUE self);
|
38
|
+
|
39
|
+
#endif /* _RUBY_MPFI_H_ */
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#ifndef __RUBY_MPFI_COMPLEX__
|
2
|
+
#define __RUBY_MPFI_COMPLEX__
|
3
|
+
|
4
|
+
#include "func_ruby_mpfi_complex.h"
|
5
|
+
|
6
|
+
#define r_mpfi_make_complex_struct(ruby_var, mpfi_complex_var) { ruby_var = Data_Make_Struct(r_mpfi_complex, MPFIComplex, 0, r_mpfi_complex_free, mpfi_complex_var); }
|
7
|
+
#define r_mpfi_make_complex_struct_init(ruby_var, mpfi_complex_var) { ruby_var = Data_Make_Struct(r_mpfi_complex, MPFIComplex, 0, r_mpfi_complex_free, mpfi_complex_var); mpfi_complex_init(mpfi_complex_var);}
|
8
|
+
#define r_mpfi_get_complex_struct(mpfi_complex_var, ruby_var) { Data_Get_Struct(ruby_var, MPFIComplex, mpfi_complex_var); }
|
9
|
+
|
10
|
+
#define r_mpfi_complex_temp_alloc_init(mpfi_complex_var) { mpfi_complex_var = ALLOC_N(MPFIComplex, 1); mpfi_complex_init(mpfi_complex_var); }
|
11
|
+
#define r_mpfi_complex_temp_free(mpfi_complex_var) { mpfi_complex_clear(mpfi_complex_var); free(mpfi_complex_var); }
|
12
|
+
|
13
|
+
void r_mpfi_complex_free(void *ptr);
|
14
|
+
|
15
|
+
#endif
|