gsl4r 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/t.rb CHANGED
@@ -1,10 +1,19 @@
1
- include ::GSL4r::Complex
2
- a=GSL_Complex.create(1,1)
3
-
4
- a.gsl_complex_arccsc_real(5.0)
5
- a.arccsc_real(5.0)
6
-
7
- #a.gsl_complex_abs(a)
8
- #a.gsl_complex_abs()
9
- #a.abs()
10
-
1
+ require 'rubygems'
2
+ require 'gsl4r'
3
+ require 'gsl4r/vector'
4
+ include FFI
5
+ op1 = MemoryPointer.new :pointer
6
+ op1 = GSL4r::Vector::Methods::gsl_vector_alloc(50)
7
+ puts op1.get_ulong(0)
8
+ ob1=GSL4r::Vector::GSL_Vector.new(op1)
9
+ ob2=GSL4r::Vector::GSL_Vector_Cast.new(op1)
10
+ puts ob1.length
11
+ puts ob2.length
12
+ ob1.set( (1..50).to_a.collect { |i| i=i*5.0 } )
13
+ puts ob2.values
14
+ #op1.put_array_of_double(1, (1..50).to_a.collect { |i| i=i*5.0 } )
15
+ #ob1[:data].put_array_of_double(0, (1..50).to_a.collect { |i| i=i*5.0 } )
16
+ #puts ob2.set( (1..50).to_a.collect { |i| i=i*5.0 } )
17
+ #v = ob2.values
18
+ #v[1] = 3000.0
19
+ #puts v
@@ -1,8 +1,12 @@
1
- This directory is empty for now, as all tests are generated automatically by running:
1
+ Most tests are generated automatically by running at the top of the source tree:
2
2
 
3
3
  rake test
4
4
 
5
- This will create a C programs that make calls to GSL functions, then writing the
5
+ This will create C programs that make calls to GSL functions, then writing the
6
6
  results as Ruby programs that cross check the FFI based wrapper answers against
7
7
  the C programs' results using Test::Unit.
8
8
 
9
+ Other tests include:
10
+
11
+ block_class_test.rb - Test basic operations dealing with gsl_block types
12
+ vector_class_test.rb - Test basic operations dealing with gsl_vector types
@@ -0,0 +1,104 @@
1
+ $: << File.join('..','lib')
2
+
3
+ require 'rubygems'
4
+ require 'ffi'
5
+
6
+ require 'test/unit'
7
+ require 'test/unit/autorunner'
8
+
9
+ require 'gsl4r'
10
+ require 'gsl4r/block'
11
+
12
+ include GSL4r::Block
13
+ include FFI
14
+
15
+ class BlockTests < Test::Unit::TestCase
16
+
17
+ SIZE=50
18
+
19
+ def test_gsl_block_alloc_and_free()
20
+ assert_nothing_raised do
21
+ blkptr = MemoryPointer.new :pointer
22
+ blkptr = GSL4r::Block::Methods::gsl_block_alloc( SIZE )
23
+ GSL4r::Block::Methods::gsl_block_free( blkptr )
24
+ end
25
+ end
26
+
27
+ # freed by leaving scope
28
+ def test_gsl_block_calloc()
29
+ assert_nothing_raised do
30
+ blkptr = MemoryPointer.new :pointer
31
+ blkptr = GSL4r::Block::Methods::gsl_block_calloc( SIZE )
32
+ blk = GSL_Block.new( blkptr )
33
+
34
+ v = blk.values
35
+ assert v.length == SIZE
36
+ v.each { |i| assert i == 0 }
37
+
38
+ end
39
+ end
40
+
41
+ def test_gsl_block_new()
42
+ assert_nothing_raised do
43
+ blkptr = MemoryPointer.new :pointer
44
+ blkptr = GSL4r::Block::Methods::gsl_block_alloc( SIZE )
45
+
46
+ blk = GSL_Block.new( blkptr )
47
+ assert blk.length == SIZE
48
+ end
49
+ end
50
+
51
+ class ::GSL4r::Block::GSL_Block_Monitor < ::GSL4r::Block::GSL_Block
52
+ def self.release(ptr)
53
+ super
54
+ $release_count = $release_count + 1
55
+ end
56
+ end
57
+
58
+ class ::GSL4r::Block::GSL_Block_Cast_Monitor < ::GSL4r::Block::GSL_Block_Cast
59
+ def self.release(ptr)
60
+ super
61
+ $release_count = $release_count + 1
62
+ end
63
+ end
64
+
65
+ # tests using a cast object to retain a reference
66
+ # to a memory pointer, without freeing it when the
67
+ # object is garbage collected.
68
+ def test_gsl_block_cast()
69
+ $release_count = 0
70
+
71
+ assert_nothing_raised do
72
+ blkptr = MemoryPointer.new :pointer
73
+ blkptr = GSL4r::Block::Methods::gsl_block_alloc( SIZE )
74
+
75
+ b1=GSL4r::Block::GSL_Block_Monitor.new( blkptr )
76
+ b2=GSL4r::Block::GSL_Block_Cast_Monitor.new( blkptr )
77
+
78
+ assert b1.length == b2.length
79
+ end
80
+
81
+ b1=nil
82
+ b2=nil
83
+ GC.start
84
+
85
+ assert $release_count == 1
86
+
87
+ end
88
+
89
+ def test_gsl_block_set_values()
90
+ assert_nothing_raised do
91
+ blkptr = MemoryPointer.new :pointer
92
+ blkptr = GSL4r::Block::Methods::gsl_block_alloc( SIZE )
93
+ blk = GSL_Block.new( blkptr )
94
+
95
+ blk.set( (1..SIZE).to_a.collect { |i| i=i*i } )
96
+ v = blk.values
97
+ (1..SIZE).each { |i| assert v[i-1] == i*i }
98
+
99
+ end
100
+ end
101
+
102
+
103
+
104
+ end
@@ -5,6 +5,216 @@ require 'gsl4r/complex'
5
5
  include GSL4r::Complex
6
6
  class ComplexTests < Test::Unit::TestCase
7
7
  EPSILON = 5.0e-15
8
+ def test_gsl_complex_add()
9
+ v4 = GSL_Complex.create
10
+ v4.set(2.0,2.0)
11
+ v5 = GSL_Complex.create
12
+ v5.set(2.0,2.0)
13
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_add(v4,v5)
14
+ r_r2 = GSL_Complex.new
15
+ r_r2.set(4,4)
16
+ assert r_r1.equals(r_r2)
17
+ end
18
+ def test_gsl_complex_negative()
19
+ v30 = GSL_Complex.create
20
+ v30.set(2.0,2.0)
21
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_negative(v30)
22
+ r_r2 = GSL_Complex.new
23
+ r_r2.set(-2,-2)
24
+ assert r_r1.equals(r_r2)
25
+ end
26
+ def test_gsl_complex_tan()
27
+ v48 = GSL_Complex.create
28
+ v48.set(2.0,2.0)
29
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_tan(v48)
30
+ r_r2 = GSL_Complex.new
31
+ r_r2.set(-0.0283929528682323,1.02383559457047)
32
+ assert r_r1.equals(r_r2)
33
+ end
34
+ def test_gsl_complex_abs()
35
+ v2 = GSL_Complex.create
36
+ v2.set(2.0,2.0)
37
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_abs(v2)
38
+ assert_in_delta r_r1, 2.82842712474619, EPSILON
39
+ end
40
+ def test_gsl_complex_sech()
41
+ v62 = GSL_Complex.create
42
+ v62.set(2.0,2.0)
43
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sech(v62)
44
+ r_r2 = GSL_Complex.new
45
+ r_r2.set(-0.117475142661415,-0.24745418582076)
46
+ assert r_r1.equals(r_r2)
47
+ end
48
+ def test_gsl_complex_div()
49
+ v10 = GSL_Complex.create
50
+ v10.set(2.0,2.0)
51
+ v11 = GSL_Complex.create
52
+ v11.set(2.0,2.0)
53
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_div(v10,v11)
54
+ r_r2 = GSL_Complex.new
55
+ r_r2.set(1,0)
56
+ assert r_r1.equals(r_r2)
57
+ end
58
+ def test_gsl_complex_polar()
59
+
60
+ v33 = 2.0
61
+
62
+ v34 = 2.0
63
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_polar(v33,v34)
64
+ r_r2 = GSL_Complex.new
65
+ r_r2.set(-0.832293673094285,1.81859485365136)
66
+ assert r_r1.equals(r_r2)
67
+ end
68
+ def test_gsl_complex_arcsin_real()
69
+
70
+ v51 = 2.0
71
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arcsin_real(v51)
72
+ r_r2 = GSL_Complex.new
73
+ r_r2.set(1.5707963267949,-1.31695789692482)
74
+ assert r_r1.equals(r_r2)
75
+ end
76
+ def test_gsl_complex_coth()
77
+ v65 = GSL_Complex.create
78
+ v65.set(2.0,2.0)
79
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_coth(v65)
80
+ r_r2 = GSL_Complex.new
81
+ r_r2.set(0.975968735117309,0.0270655117325545)
82
+ assert r_r1.equals(r_r2)
83
+ end
84
+ def test_gsl_complex_mul_real()
85
+ v16 = GSL_Complex.create
86
+ v16.set(2.0,2.0)
87
+
88
+ v17 = 2.0
89
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_mul_real(v16,v17)
90
+ r_r2 = GSL_Complex.new
91
+ r_r2.set(4,4)
92
+ assert r_r1.equals(r_r2)
93
+ end
94
+ def test_gsl_complex_exp()
95
+ v39 = GSL_Complex.create
96
+ v39.set(2.0,2.0)
97
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_exp(v39)
98
+ r_r2 = GSL_Complex.new
99
+ r_r2.set(-3.07493232063936,6.71884969742825)
100
+ assert r_r1.equals(r_r2)
101
+ end
102
+ def test_gsl_complex_arcsec()
103
+ v54 = GSL_Complex.create
104
+ v54.set(2.0,2.0)
105
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arcsec(v54)
106
+ r_r2 = GSL_Complex.new
107
+ r_r2.set(1.32627416165936,0.254895573340551)
108
+ assert r_r1.equals(r_r2)
109
+ end
110
+ def test_gsl_complex_arccosh_real()
111
+
112
+ v68 = 2.0
113
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arccosh_real(v68)
114
+ r_r2 = GSL_Complex.new
115
+ r_r2.set(1.31695789692482,0)
116
+ assert r_r1.equals(r_r2)
117
+ end
118
+ def test_gsl_complex_sub_imag()
119
+ v22 = GSL_Complex.create
120
+ v22.set(2.0,2.0)
121
+
122
+ v23 = 2.0
123
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sub_imag(v22,v23)
124
+ r_r2 = GSL_Complex.new
125
+ r_r2.set(2,0)
126
+ assert r_r1.equals(r_r2)
127
+ end
128
+ def test_gsl_complex_log_b()
129
+ v42 = GSL_Complex.create
130
+ v42.set(2.0,2.0)
131
+ v43 = GSL_Complex.create
132
+ v43.set(2.0,2.0)
133
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_log_b(v42,v43)
134
+ r_r2 = GSL_Complex.new
135
+ r_r2.set(1,0)
136
+ assert r_r1.equals(r_r2)
137
+ end
138
+ def test_gsl_complex_arccsc_real()
139
+
140
+ v57 = 2.0
141
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arccsc_real(v57)
142
+ r_r2 = GSL_Complex.new
143
+ r_r2.set(0.523598775598299,0)
144
+ assert r_r1.equals(r_r2)
145
+ end
146
+ def test_gsl_complex_arctanh()
147
+ v71 = GSL_Complex.create
148
+ v71.set(2.0,2.0)
149
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arctanh(v71)
150
+ r_r2 = GSL_Complex.new
151
+ r_r2.set(0.238877861256859,1.31122326967164)
152
+ assert r_r1.equals(r_r2)
153
+ end
154
+ def test_gsl_complex_conjugate()
155
+ v28 = GSL_Complex.create
156
+ v28.set(2.0,2.0)
157
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_conjugate(v28)
158
+ r_r2 = GSL_Complex.new
159
+ r_r2.set(2,-2)
160
+ assert r_r1.equals(r_r2)
161
+ end
162
+ def test_gsl_complex_sec()
163
+ v46 = GSL_Complex.create
164
+ v46.set(2.0,2.0)
165
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sec(v46)
166
+ r_r2 = GSL_Complex.new
167
+ r_r2.set(-0.117475142661415,0.24745418582076)
168
+ assert r_r1.equals(r_r2)
169
+ end
170
+ def test_gsl_complex_sinh()
171
+ v60 = GSL_Complex.create
172
+ v60.set(2.0,2.0)
173
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sinh(v60)
174
+ r_r2 = GSL_Complex.new
175
+ r_r2.set(-1.50930648532362,3.42095486111701)
176
+ assert r_r1.equals(r_r2)
177
+ end
178
+ def test_gsl_complex_sub()
179
+ v6 = GSL_Complex.create
180
+ v6.set(2.0,2.0)
181
+ v7 = GSL_Complex.create
182
+ v7.set(2.0,2.0)
183
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sub(v6,v7)
184
+ r_r2 = GSL_Complex.new
185
+ r_r2.set(0,0)
186
+ assert r_r1.equals(r_r2)
187
+ end
188
+ def test_gsl_complex_sqrt()
189
+ v31 = GSL_Complex.create
190
+ v31.set(2.0,2.0)
191
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sqrt(v31)
192
+ r_r2 = GSL_Complex.new
193
+ r_r2.set(1.55377397403004,0.643594252905582)
194
+ assert r_r1.equals(r_r2)
195
+ end
196
+ def test_gsl_complex_cot()
197
+ v49 = GSL_Complex.create
198
+ v49.set(2.0,2.0)
199
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_cot(v49)
200
+ r_r2 = GSL_Complex.new
201
+ r_r2.set(-0.0270655117325545,-0.975968735117309)
202
+ assert r_r1.equals(r_r2)
203
+ end
204
+ def test_gsl_complex_abs2()
205
+ v3 = GSL_Complex.create
206
+ v3.set(2.0,2.0)
207
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_abs2(v3)
208
+ assert_in_delta r_r1, 8, EPSILON
209
+ end
210
+ def test_gsl_complex_csch()
211
+ v63 = GSL_Complex.create
212
+ v63.set(2.0,2.0)
213
+ r_r1 = ::GSL4r::Complex::Methods::gsl_complex_csch(v63)
214
+ r_r2 = GSL_Complex.new
215
+ r_r2.set(-0.107954592221385,-0.244687073586957)
216
+ assert r_r1.equals(r_r2)
217
+ end
8
218
  def test_gsl_complex_add_real()
9
219
  v12 = GSL_Complex.create
10
220
  v12.set(2.0,2.0)
@@ -277,214 +487,4 @@ def test_gsl_complex_arccoth()
277
487
  r_r2.set(0.238877861256859,-0.259573057123261)
278
488
  assert r_r1.equals(r_r2)
279
489
  end
280
- def test_gsl_complex_add()
281
- v4 = GSL_Complex.create
282
- v4.set(2.0,2.0)
283
- v5 = GSL_Complex.create
284
- v5.set(2.0,2.0)
285
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_add(v4,v5)
286
- r_r2 = GSL_Complex.new
287
- r_r2.set(4,4)
288
- assert r_r1.equals(r_r2)
289
- end
290
- def test_gsl_complex_negative()
291
- v30 = GSL_Complex.create
292
- v30.set(2.0,2.0)
293
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_negative(v30)
294
- r_r2 = GSL_Complex.new
295
- r_r2.set(-2,-2)
296
- assert r_r1.equals(r_r2)
297
- end
298
- def test_gsl_complex_tan()
299
- v48 = GSL_Complex.create
300
- v48.set(2.0,2.0)
301
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_tan(v48)
302
- r_r2 = GSL_Complex.new
303
- r_r2.set(-0.0283929528682323,1.02383559457047)
304
- assert r_r1.equals(r_r2)
305
- end
306
- def test_gsl_complex_abs()
307
- v2 = GSL_Complex.create
308
- v2.set(2.0,2.0)
309
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_abs(v2)
310
- assert_in_delta r_r1, 2.82842712474619, EPSILON
311
- end
312
- def test_gsl_complex_sech()
313
- v62 = GSL_Complex.create
314
- v62.set(2.0,2.0)
315
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sech(v62)
316
- r_r2 = GSL_Complex.new
317
- r_r2.set(-0.117475142661415,-0.24745418582076)
318
- assert r_r1.equals(r_r2)
319
- end
320
- def test_gsl_complex_div()
321
- v10 = GSL_Complex.create
322
- v10.set(2.0,2.0)
323
- v11 = GSL_Complex.create
324
- v11.set(2.0,2.0)
325
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_div(v10,v11)
326
- r_r2 = GSL_Complex.new
327
- r_r2.set(1,0)
328
- assert r_r1.equals(r_r2)
329
- end
330
- def test_gsl_complex_polar()
331
-
332
- v33 = 2.0
333
-
334
- v34 = 2.0
335
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_polar(v33,v34)
336
- r_r2 = GSL_Complex.new
337
- r_r2.set(-0.832293673094285,1.81859485365136)
338
- assert r_r1.equals(r_r2)
339
- end
340
- def test_gsl_complex_arcsin_real()
341
-
342
- v51 = 2.0
343
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arcsin_real(v51)
344
- r_r2 = GSL_Complex.new
345
- r_r2.set(1.5707963267949,-1.31695789692482)
346
- assert r_r1.equals(r_r2)
347
- end
348
- def test_gsl_complex_coth()
349
- v65 = GSL_Complex.create
350
- v65.set(2.0,2.0)
351
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_coth(v65)
352
- r_r2 = GSL_Complex.new
353
- r_r2.set(0.975968735117309,0.0270655117325545)
354
- assert r_r1.equals(r_r2)
355
- end
356
- def test_gsl_complex_mul_real()
357
- v16 = GSL_Complex.create
358
- v16.set(2.0,2.0)
359
-
360
- v17 = 2.0
361
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_mul_real(v16,v17)
362
- r_r2 = GSL_Complex.new
363
- r_r2.set(4,4)
364
- assert r_r1.equals(r_r2)
365
- end
366
- def test_gsl_complex_exp()
367
- v39 = GSL_Complex.create
368
- v39.set(2.0,2.0)
369
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_exp(v39)
370
- r_r2 = GSL_Complex.new
371
- r_r2.set(-3.07493232063936,6.71884969742825)
372
- assert r_r1.equals(r_r2)
373
- end
374
- def test_gsl_complex_arcsec()
375
- v54 = GSL_Complex.create
376
- v54.set(2.0,2.0)
377
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arcsec(v54)
378
- r_r2 = GSL_Complex.new
379
- r_r2.set(1.32627416165936,0.254895573340551)
380
- assert r_r1.equals(r_r2)
381
- end
382
- def test_gsl_complex_arccosh_real()
383
-
384
- v68 = 2.0
385
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arccosh_real(v68)
386
- r_r2 = GSL_Complex.new
387
- r_r2.set(1.31695789692482,0)
388
- assert r_r1.equals(r_r2)
389
- end
390
- def test_gsl_complex_sub_imag()
391
- v22 = GSL_Complex.create
392
- v22.set(2.0,2.0)
393
-
394
- v23 = 2.0
395
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sub_imag(v22,v23)
396
- r_r2 = GSL_Complex.new
397
- r_r2.set(2,0)
398
- assert r_r1.equals(r_r2)
399
- end
400
- def test_gsl_complex_log_b()
401
- v42 = GSL_Complex.create
402
- v42.set(2.0,2.0)
403
- v43 = GSL_Complex.create
404
- v43.set(2.0,2.0)
405
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_log_b(v42,v43)
406
- r_r2 = GSL_Complex.new
407
- r_r2.set(1,0)
408
- assert r_r1.equals(r_r2)
409
- end
410
- def test_gsl_complex_arccsc_real()
411
-
412
- v57 = 2.0
413
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arccsc_real(v57)
414
- r_r2 = GSL_Complex.new
415
- r_r2.set(0.523598775598299,0)
416
- assert r_r1.equals(r_r2)
417
- end
418
- def test_gsl_complex_arctanh()
419
- v71 = GSL_Complex.create
420
- v71.set(2.0,2.0)
421
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_arctanh(v71)
422
- r_r2 = GSL_Complex.new
423
- r_r2.set(0.238877861256859,1.31122326967164)
424
- assert r_r1.equals(r_r2)
425
- end
426
- def test_gsl_complex_conjugate()
427
- v28 = GSL_Complex.create
428
- v28.set(2.0,2.0)
429
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_conjugate(v28)
430
- r_r2 = GSL_Complex.new
431
- r_r2.set(2,-2)
432
- assert r_r1.equals(r_r2)
433
- end
434
- def test_gsl_complex_sec()
435
- v46 = GSL_Complex.create
436
- v46.set(2.0,2.0)
437
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sec(v46)
438
- r_r2 = GSL_Complex.new
439
- r_r2.set(-0.117475142661415,0.24745418582076)
440
- assert r_r1.equals(r_r2)
441
- end
442
- def test_gsl_complex_sinh()
443
- v60 = GSL_Complex.create
444
- v60.set(2.0,2.0)
445
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sinh(v60)
446
- r_r2 = GSL_Complex.new
447
- r_r2.set(-1.50930648532362,3.42095486111701)
448
- assert r_r1.equals(r_r2)
449
- end
450
- def test_gsl_complex_sub()
451
- v6 = GSL_Complex.create
452
- v6.set(2.0,2.0)
453
- v7 = GSL_Complex.create
454
- v7.set(2.0,2.0)
455
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sub(v6,v7)
456
- r_r2 = GSL_Complex.new
457
- r_r2.set(0,0)
458
- assert r_r1.equals(r_r2)
459
- end
460
- def test_gsl_complex_sqrt()
461
- v31 = GSL_Complex.create
462
- v31.set(2.0,2.0)
463
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_sqrt(v31)
464
- r_r2 = GSL_Complex.new
465
- r_r2.set(1.55377397403004,0.643594252905582)
466
- assert r_r1.equals(r_r2)
467
- end
468
- def test_gsl_complex_cot()
469
- v49 = GSL_Complex.create
470
- v49.set(2.0,2.0)
471
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_cot(v49)
472
- r_r2 = GSL_Complex.new
473
- r_r2.set(-0.0270655117325545,-0.975968735117309)
474
- assert r_r1.equals(r_r2)
475
- end
476
- def test_gsl_complex_abs2()
477
- v3 = GSL_Complex.create
478
- v3.set(2.0,2.0)
479
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_abs2(v3)
480
- assert_in_delta r_r1, 8, EPSILON
481
- end
482
- def test_gsl_complex_csch()
483
- v63 = GSL_Complex.create
484
- v63.set(2.0,2.0)
485
- r_r1 = ::GSL4r::Complex::Methods::gsl_complex_csch(v63)
486
- r_r2 = GSL_Complex.new
487
- r_r2.set(-0.107954592221385,-0.244687073586957)
488
- assert r_r1.equals(r_r2)
489
- end
490
490
  end