gps_pvt 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +12 -1
- data/ext/gps_pvt/Coordinate/Coordinate_wrap.cxx +5 -0
- data/ext/gps_pvt/GPS/GPS_wrap.cxx +5 -0
- data/ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx +216 -21
- data/ext/gps_pvt/extconf.rb +8 -3
- data/ext/ninja-scan-light/tool/param/matrix.h +24 -18
- data/ext/ninja-scan-light/tool/swig/Coordinate.i +6 -0
- data/ext/ninja-scan-light/tool/swig/GPS.i +7 -0
- data/ext/ninja-scan-light/tool/swig/SylphideMath.i +33 -2
- data/ext/ninja-scan-light/tool/swig/extconf.rb +8 -3
- data/ext/ninja-scan-light/tool/swig/spec/SylphideMath_spec.rb +31 -0
- data/ext/ninja-scan-light/tool/util/bit_counter.h +29 -0
- data/gps_pvt.gemspec +2 -1
- data/lib/gps_pvt/pvt.rb +10 -7
- data/lib/gps_pvt/supl.rb +18 -3
- data/lib/gps_pvt/util.rb +4 -1
- data/lib/gps_pvt/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d4d4d0a34845282d8481d0ddcf5da043e19c89c24890140aaee66e98affea715
|
|
4
|
+
data.tar.gz: 5af5e9575ad0d7afb5de4e52df3a8f9523cb3ccb9942d43500de8317afc37049
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 465e94432458b50d61c3e42102f2e138b7dadcb3c6ee1de2cae02288f73b44de8fcfec17c5b195ad4da4ef3d9387d1855ebad483f71943f23638981b6bf891a8
|
|
7
|
+
data.tar.gz: 935b4bb0ef7abce6836aa1fd046ad43ccc0e7586f7cd585b7df36ff9069c6c58c1c87fa77386f1e7112f4e019034ceaed71ab58c63eafea01154c928ac602b2e
|
data/Rakefile
CHANGED
|
@@ -98,7 +98,8 @@ task :swig do
|
|
|
98
98
|
Dir::chdir(swig_dir){
|
|
99
99
|
Dir::glob("*.i"){|src|
|
|
100
100
|
mod_name = File::basename(src, '.*')
|
|
101
|
-
|
|
101
|
+
out_dir_orig = File::join(out_base_dir, mod_name)
|
|
102
|
+
out_dir = "#{out_dir_orig}.new"
|
|
102
103
|
sh "mkdir -p #{out_dir}"
|
|
103
104
|
wrapper = File::join(out_dir, "#{mod_name}_wrap.cxx")
|
|
104
105
|
sh [:make, :clean, wrapper,
|
|
@@ -113,6 +114,15 @@ task :swig do
|
|
|
113
114
|
io.rewind
|
|
114
115
|
io.write(lines.join)
|
|
115
116
|
}
|
|
117
|
+
FileUtils.instance_eval{
|
|
118
|
+
wrapper_orig = File::join(out_dir_orig, "#{mod_name}_wrap.cxx")
|
|
119
|
+
if File::exist?(wrapper_orig) and cmp(wrapper, wrapper_orig) then
|
|
120
|
+
rm_rf(out_dir)
|
|
121
|
+
else
|
|
122
|
+
rm_rf(out_dir_orig)
|
|
123
|
+
mv(out_dir, out_dir_orig)
|
|
124
|
+
end
|
|
125
|
+
}
|
|
116
126
|
}
|
|
117
127
|
}
|
|
118
128
|
}
|
|
@@ -146,4 +156,5 @@ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
|
146
156
|
config.project = $2
|
|
147
157
|
end if (begin; require 'github_changelog_generator/task'; rescue Exception; false; end)
|
|
148
158
|
|
|
159
|
+
task :build => "ext/ninja-scan-light/tool"
|
|
149
160
|
task :default => ["ext/ninja-scan-light/tool", :compile, :spec]
|
|
@@ -6610,6 +6610,11 @@ SWIGEXPORT void Init_Coordinate(void) {
|
|
|
6610
6610
|
swig::SwigGCReferences::initialize();
|
|
6611
6611
|
|
|
6612
6612
|
|
|
6613
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
6614
|
+
rb_ext_ractor_safe(true);
|
|
6615
|
+
#endif
|
|
6616
|
+
|
|
6617
|
+
|
|
6613
6618
|
SwigClassBase.klass = rb_define_class_under(mCoordinate, "Base", rb_cObject);
|
|
6614
6619
|
SWIG_TypeClientData(SWIGTYPE_p_System_3DT_double_t, (void *) &SwigClassBase);
|
|
6615
6620
|
rb_include_module(SwigClassBase.klass, rb_eval_string("Enumerable"));
|
|
@@ -25782,6 +25782,11 @@ SWIGEXPORT void Init_GPS(void) {
|
|
|
25782
25782
|
|
|
25783
25783
|
swig::SwigGCReferences::initialize();
|
|
25784
25784
|
|
|
25785
|
+
|
|
25786
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
25787
|
+
rb_ext_ractor_safe(true);
|
|
25788
|
+
#endif
|
|
25789
|
+
|
|
25785
25790
|
rb_require("gps_pvt/SylphideMath");
|
|
25786
25791
|
rb_require("gps_pvt/Coordinate");
|
|
25787
25792
|
rb_define_const(mGPS, "GPS_SC2RAD", SWIG_From_double(static_cast< double >(3.1415926535898)));
|
|
@@ -1892,31 +1892,12 @@ static VALUE mSylphideMath;
|
|
|
1892
1892
|
#include <stdexcept>
|
|
1893
1893
|
|
|
1894
1894
|
|
|
1895
|
-
#include <limits.h>
|
|
1896
|
-
#if !defined(SWIG_NO_LLONG_MAX)
|
|
1897
|
-
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
|
|
1898
|
-
# define LLONG_MAX __LONG_LONG_MAX__
|
|
1899
|
-
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
|
1900
|
-
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
|
1901
|
-
# endif
|
|
1902
|
-
#endif
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
#define SWIG_From_long LONG2NUM
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
SWIGINTERNINLINE VALUE
|
|
1909
|
-
SWIG_From_int (int value)
|
|
1910
|
-
{
|
|
1911
|
-
return SWIG_From_long (value);
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
1895
|
#include <string>
|
|
1916
1896
|
#include <sstream>
|
|
1917
1897
|
#include <vector>
|
|
1918
1898
|
#include <exception>
|
|
1919
1899
|
|
|
1900
|
+
|
|
1920
1901
|
#if defined(SWIGRUBY) && defined(isfinite)
|
|
1921
1902
|
#undef isfinite_
|
|
1922
1903
|
#undef isfinite
|
|
@@ -1930,6 +1911,15 @@ SWIG_From_int (int value)
|
|
|
1930
1911
|
#define isfinite(x) finite(x)
|
|
1931
1912
|
#endif
|
|
1932
1913
|
|
|
1914
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
1915
|
+
#include <atomic>
|
|
1916
|
+
template <class T>
|
|
1917
|
+
template <class U>
|
|
1918
|
+
struct Array2D_Dense<T>::property_t<T, U> {
|
|
1919
|
+
typedef std::atomic<int> ref_cnt_t;
|
|
1920
|
+
};
|
|
1921
|
+
#endif
|
|
1922
|
+
|
|
1933
1923
|
|
|
1934
1924
|
#include <typeinfo>
|
|
1935
1925
|
#include <stdexcept>
|
|
@@ -3075,6 +3065,19 @@ struct MatrixUtil {
|
|
|
3075
3065
|
};
|
|
3076
3066
|
|
|
3077
3067
|
|
|
3068
|
+
#include <limits.h>
|
|
3069
|
+
#if !defined(SWIG_NO_LLONG_MAX)
|
|
3070
|
+
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
|
|
3071
|
+
# define LLONG_MAX __LONG_LONG_MAX__
|
|
3072
|
+
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
|
3073
|
+
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
|
3074
|
+
# endif
|
|
3075
|
+
#endif
|
|
3076
|
+
|
|
3077
|
+
|
|
3078
|
+
#define SWIG_From_long LONG2NUM
|
|
3079
|
+
|
|
3080
|
+
|
|
3078
3081
|
SWIGINTERNINLINE VALUE
|
|
3079
3082
|
SWIG_From_unsigned_SS_long (unsigned long value)
|
|
3080
3083
|
{
|
|
@@ -3353,6 +3356,19 @@ SWIGINTERN VALUE Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatVi
|
|
|
3353
3356
|
}
|
|
3354
3357
|
return res;
|
|
3355
3358
|
}
|
|
3359
|
+
SWIGINTERN VALUE Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatViewBase_Sg__to_shareable(Matrix_Frozen< double,Array2D_Dense< double >,MatViewBase > const *self){
|
|
3360
|
+
Matrix_Frozen<double, Array2D_Dense< double >, MatrixViewBase< > > *ptr(
|
|
3361
|
+
new Matrix_Frozen<double, Array2D_Dense< double >, MatrixViewBase< > >(*self));
|
|
3362
|
+
VALUE res(SWIG_NewPointerObj(
|
|
3363
|
+
ptr,
|
|
3364
|
+
SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewBaseT_t_t,
|
|
3365
|
+
SWIG_POINTER_OWN));
|
|
3366
|
+
rb_obj_freeze(res);
|
|
3367
|
+
#if defined(HAVE_RB_EXT_RACTOR_SAFE)
|
|
3368
|
+
RB_FL_SET(res, RUBY_FL_SHAREABLE);
|
|
3369
|
+
#endif
|
|
3370
|
+
return res;
|
|
3371
|
+
}
|
|
3356
3372
|
SWIGINTERN std::string Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatViewBase_Sg____str__(Matrix_Frozen< double,Array2D_Dense< double >,MatViewBase > const *self){
|
|
3357
3373
|
std::stringstream s;
|
|
3358
3374
|
s << (*self);
|
|
@@ -3554,6 +3570,19 @@ SWIGINTERN VALUE Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatVi
|
|
|
3554
3570
|
}
|
|
3555
3571
|
return res;
|
|
3556
3572
|
}
|
|
3573
|
+
SWIGINTERN VALUE Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatView_f_Sg__to_shareable(Matrix_Frozen< double,Array2D_Dense< double >,MatView_f > const *self){
|
|
3574
|
+
Matrix_Frozen<double, Array2D_Dense< double >, MatrixViewFilter< MatrixViewBase< > > > *ptr(
|
|
3575
|
+
new Matrix_Frozen<double, Array2D_Dense< double >, MatrixViewFilter< MatrixViewBase< > > >(*self));
|
|
3576
|
+
VALUE res(SWIG_NewPointerObj(
|
|
3577
|
+
ptr,
|
|
3578
|
+
SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t,
|
|
3579
|
+
SWIG_POINTER_OWN));
|
|
3580
|
+
rb_obj_freeze(res);
|
|
3581
|
+
#if defined(HAVE_RB_EXT_RACTOR_SAFE)
|
|
3582
|
+
RB_FL_SET(res, RUBY_FL_SHAREABLE);
|
|
3583
|
+
#endif
|
|
3584
|
+
return res;
|
|
3585
|
+
}
|
|
3557
3586
|
SWIGINTERN std::string Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatView_f_Sg____str__(Matrix_Frozen< double,Array2D_Dense< double >,MatView_f > const *self){
|
|
3558
3587
|
std::stringstream s;
|
|
3559
3588
|
s << (*self);
|
|
@@ -3900,6 +3929,19 @@ SWIGINTERN VALUE Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Comp
|
|
|
3900
3929
|
}
|
|
3901
3930
|
return res;
|
|
3902
3931
|
}
|
|
3932
|
+
SWIGINTERN VALUE Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sc_MatViewBase_Sg__to_shareable(Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatViewBase > const *self){
|
|
3933
|
+
Matrix_Frozen<Complex< double >, Array2D_Dense< Complex< double > >, MatrixViewBase< > > *ptr(
|
|
3934
|
+
new Matrix_Frozen<Complex< double >, Array2D_Dense< Complex< double > >, MatrixViewBase< > >(*self));
|
|
3935
|
+
VALUE res(SWIG_NewPointerObj(
|
|
3936
|
+
ptr,
|
|
3937
|
+
SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewBaseT_t_t,
|
|
3938
|
+
SWIG_POINTER_OWN));
|
|
3939
|
+
rb_obj_freeze(res);
|
|
3940
|
+
#if defined(HAVE_RB_EXT_RACTOR_SAFE)
|
|
3941
|
+
RB_FL_SET(res, RUBY_FL_SHAREABLE);
|
|
3942
|
+
#endif
|
|
3943
|
+
return res;
|
|
3944
|
+
}
|
|
3903
3945
|
SWIGINTERN std::string Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sc_MatViewBase_Sg____str__(Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatViewBase > const *self){
|
|
3904
3946
|
std::stringstream s;
|
|
3905
3947
|
s << (*self);
|
|
@@ -4101,6 +4143,19 @@ SWIGINTERN VALUE Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Comp
|
|
|
4101
4143
|
}
|
|
4102
4144
|
return res;
|
|
4103
4145
|
}
|
|
4146
|
+
SWIGINTERN VALUE Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sc_MatView_f_Sg__to_shareable(Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatView_f > const *self){
|
|
4147
|
+
Matrix_Frozen<Complex< double >, Array2D_Dense< Complex< double > >, MatrixViewFilter< MatrixViewBase< > > > *ptr(
|
|
4148
|
+
new Matrix_Frozen<Complex< double >, Array2D_Dense< Complex< double > >, MatrixViewFilter< MatrixViewBase< > > >(*self));
|
|
4149
|
+
VALUE res(SWIG_NewPointerObj(
|
|
4150
|
+
ptr,
|
|
4151
|
+
SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t,
|
|
4152
|
+
SWIG_POINTER_OWN));
|
|
4153
|
+
rb_obj_freeze(res);
|
|
4154
|
+
#if defined(HAVE_RB_EXT_RACTOR_SAFE)
|
|
4155
|
+
RB_FL_SET(res, RUBY_FL_SHAREABLE);
|
|
4156
|
+
#endif
|
|
4157
|
+
return res;
|
|
4158
|
+
}
|
|
4104
4159
|
SWIGINTERN std::string Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sc_MatView_f_Sg____str__(Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatView_f > const *self){
|
|
4105
4160
|
std::stringstream s;
|
|
4106
4161
|
s << (*self);
|
|
@@ -8971,6 +9026,39 @@ fail:
|
|
|
8971
9026
|
}
|
|
8972
9027
|
|
|
8973
9028
|
|
|
9029
|
+
/*
|
|
9030
|
+
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenD.to_shareable
|
|
9031
|
+
|
|
9032
|
+
call-seq:
|
|
9033
|
+
to_shareable -> VALUE
|
|
9034
|
+
|
|
9035
|
+
An instance method.
|
|
9036
|
+
|
|
9037
|
+
*/
|
|
9038
|
+
SWIGINTERN VALUE
|
|
9039
|
+
_wrap_Matrix_FrozenD_to_shareable(int argc, VALUE *argv, VALUE self) {
|
|
9040
|
+
Matrix_Frozen< double,Array2D_Dense< double >,MatViewBase > *arg1 = (Matrix_Frozen< double,Array2D_Dense< double >,MatViewBase > *) 0 ;
|
|
9041
|
+
void *argp1 = 0 ;
|
|
9042
|
+
int res1 = 0 ;
|
|
9043
|
+
VALUE result;
|
|
9044
|
+
VALUE vresult = Qnil;
|
|
9045
|
+
|
|
9046
|
+
if ((argc < 0) || (argc > 0)) {
|
|
9047
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
|
9048
|
+
}
|
|
9049
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewBaseT_t_t, 0 | 0 );
|
|
9050
|
+
if (!SWIG_IsOK(res1)) {
|
|
9051
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Matrix_Frozen< double,Array2D_Dense< double >,MatViewBase > const *","to_shareable", 1, self ));
|
|
9052
|
+
}
|
|
9053
|
+
arg1 = reinterpret_cast< Matrix_Frozen< double,Array2D_Dense< double >,MatViewBase > * >(argp1);
|
|
9054
|
+
result = (VALUE)Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatViewBase_Sg__to_shareable((Matrix_Frozen< double,Array2D_Dense< double >,MatrixViewBase< > > const *)arg1);
|
|
9055
|
+
vresult = result;
|
|
9056
|
+
return vresult;
|
|
9057
|
+
fail:
|
|
9058
|
+
return Qnil;
|
|
9059
|
+
}
|
|
9060
|
+
|
|
9061
|
+
|
|
8974
9062
|
/*
|
|
8975
9063
|
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenD.to_s
|
|
8976
9064
|
|
|
@@ -12416,6 +12504,39 @@ fail:
|
|
|
12416
12504
|
}
|
|
12417
12505
|
|
|
12418
12506
|
|
|
12507
|
+
/*
|
|
12508
|
+
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenD_f.to_shareable
|
|
12509
|
+
|
|
12510
|
+
call-seq:
|
|
12511
|
+
to_shareable -> VALUE
|
|
12512
|
+
|
|
12513
|
+
An instance method.
|
|
12514
|
+
|
|
12515
|
+
*/
|
|
12516
|
+
SWIGINTERN VALUE
|
|
12517
|
+
_wrap_Matrix_FrozenD_f_to_shareable(int argc, VALUE *argv, VALUE self) {
|
|
12518
|
+
Matrix_Frozen< double,Array2D_Dense< double >,MatView_f > *arg1 = (Matrix_Frozen< double,Array2D_Dense< double >,MatView_f > *) 0 ;
|
|
12519
|
+
void *argp1 = 0 ;
|
|
12520
|
+
int res1 = 0 ;
|
|
12521
|
+
VALUE result;
|
|
12522
|
+
VALUE vresult = Qnil;
|
|
12523
|
+
|
|
12524
|
+
if ((argc < 0) || (argc > 0)) {
|
|
12525
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
|
12526
|
+
}
|
|
12527
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t, 0 | 0 );
|
|
12528
|
+
if (!SWIG_IsOK(res1)) {
|
|
12529
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Matrix_Frozen< double,Array2D_Dense< double >,MatView_f > const *","to_shareable", 1, self ));
|
|
12530
|
+
}
|
|
12531
|
+
arg1 = reinterpret_cast< Matrix_Frozen< double,Array2D_Dense< double >,MatView_f > * >(argp1);
|
|
12532
|
+
result = (VALUE)Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc_MatView_f_Sg__to_shareable((Matrix_Frozen< double,Array2D_Dense< double >,MatrixViewFilter< MatrixViewBase< > > > const *)arg1);
|
|
12533
|
+
vresult = result;
|
|
12534
|
+
return vresult;
|
|
12535
|
+
fail:
|
|
12536
|
+
return Qnil;
|
|
12537
|
+
}
|
|
12538
|
+
|
|
12539
|
+
|
|
12419
12540
|
/*
|
|
12420
12541
|
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenD_f.to_s
|
|
12421
12542
|
|
|
@@ -16924,6 +17045,39 @@ fail:
|
|
|
16924
17045
|
}
|
|
16925
17046
|
|
|
16926
17047
|
|
|
17048
|
+
/*
|
|
17049
|
+
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenComplexD.to_shareable
|
|
17050
|
+
|
|
17051
|
+
call-seq:
|
|
17052
|
+
to_shareable -> VALUE
|
|
17053
|
+
|
|
17054
|
+
An instance method.
|
|
17055
|
+
|
|
17056
|
+
*/
|
|
17057
|
+
SWIGINTERN VALUE
|
|
17058
|
+
_wrap_Matrix_FrozenComplexD_to_shareable(int argc, VALUE *argv, VALUE self) {
|
|
17059
|
+
Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatViewBase > *arg1 = (Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatViewBase > *) 0 ;
|
|
17060
|
+
void *argp1 = 0 ;
|
|
17061
|
+
int res1 = 0 ;
|
|
17062
|
+
VALUE result;
|
|
17063
|
+
VALUE vresult = Qnil;
|
|
17064
|
+
|
|
17065
|
+
if ((argc < 0) || (argc > 0)) {
|
|
17066
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
|
17067
|
+
}
|
|
17068
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewBaseT_t_t, 0 | 0 );
|
|
17069
|
+
if (!SWIG_IsOK(res1)) {
|
|
17070
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatViewBase > const *","to_shareable", 1, self ));
|
|
17071
|
+
}
|
|
17072
|
+
arg1 = reinterpret_cast< Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatViewBase > * >(argp1);
|
|
17073
|
+
result = (VALUE)Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sc_MatViewBase_Sg__to_shareable((Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatrixViewBase< > > const *)arg1);
|
|
17074
|
+
vresult = result;
|
|
17075
|
+
return vresult;
|
|
17076
|
+
fail:
|
|
17077
|
+
return Qnil;
|
|
17078
|
+
}
|
|
17079
|
+
|
|
17080
|
+
|
|
16927
17081
|
/*
|
|
16928
17082
|
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenComplexD.to_s
|
|
16929
17083
|
|
|
@@ -20367,6 +20521,39 @@ fail:
|
|
|
20367
20521
|
}
|
|
20368
20522
|
|
|
20369
20523
|
|
|
20524
|
+
/*
|
|
20525
|
+
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenComplexD_f.to_shareable
|
|
20526
|
+
|
|
20527
|
+
call-seq:
|
|
20528
|
+
to_shareable -> VALUE
|
|
20529
|
+
|
|
20530
|
+
An instance method.
|
|
20531
|
+
|
|
20532
|
+
*/
|
|
20533
|
+
SWIGINTERN VALUE
|
|
20534
|
+
_wrap_Matrix_FrozenComplexD_f_to_shareable(int argc, VALUE *argv, VALUE self) {
|
|
20535
|
+
Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatView_f > *arg1 = (Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatView_f > *) 0 ;
|
|
20536
|
+
void *argp1 = 0 ;
|
|
20537
|
+
int res1 = 0 ;
|
|
20538
|
+
VALUE result;
|
|
20539
|
+
VALUE vresult = Qnil;
|
|
20540
|
+
|
|
20541
|
+
if ((argc < 0) || (argc > 0)) {
|
|
20542
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
|
20543
|
+
}
|
|
20544
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t, 0 | 0 );
|
|
20545
|
+
if (!SWIG_IsOK(res1)) {
|
|
20546
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatView_f > const *","to_shareable", 1, self ));
|
|
20547
|
+
}
|
|
20548
|
+
arg1 = reinterpret_cast< Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatView_f > * >(argp1);
|
|
20549
|
+
result = (VALUE)Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sc_MatView_f_Sg__to_shareable((Matrix_Frozen< Complex< double >,Array2D_Dense< Complex< double > >,MatrixViewFilter< MatrixViewBase< > > > const *)arg1);
|
|
20550
|
+
vresult = result;
|
|
20551
|
+
return vresult;
|
|
20552
|
+
fail:
|
|
20553
|
+
return Qnil;
|
|
20554
|
+
}
|
|
20555
|
+
|
|
20556
|
+
|
|
20370
20557
|
/*
|
|
20371
20558
|
Document-method: GPS_PVT::SylphideMath::Matrix_FrozenComplexD_f.to_s
|
|
20372
20559
|
|
|
@@ -22321,7 +22508,6 @@ SWIGEXPORT void Init_SylphideMath(void) {
|
|
|
22321
22508
|
}
|
|
22322
22509
|
|
|
22323
22510
|
SWIG_RubyInitializeTrackings();
|
|
22324
|
-
rb_define_const(mSylphideMath, "ENABLE_IOSTREAM", SWIG_From_int(static_cast< int >(1)));
|
|
22325
22511
|
|
|
22326
22512
|
SwigClassGC_VALUE.klass = rb_define_class_under(mSylphideMath, "GC_VALUE", rb_cObject);
|
|
22327
22513
|
SWIG_TypeClientData(SWIGTYPE_p_swig__GC_VALUE, (void *) &SwigClassGC_VALUE);
|
|
@@ -22334,6 +22520,11 @@ SWIGEXPORT void Init_SylphideMath(void) {
|
|
|
22334
22520
|
swig::SwigGCReferences::initialize();
|
|
22335
22521
|
|
|
22336
22522
|
|
|
22523
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
22524
|
+
rb_ext_ractor_safe(true);
|
|
22525
|
+
#endif
|
|
22526
|
+
|
|
22527
|
+
|
|
22337
22528
|
SwigClassComplexD.klass = rb_define_class_under(mSylphideMath, "ComplexD", rb_cObject);
|
|
22338
22529
|
SWIG_TypeClientData(SWIGTYPE_p_ComplexT_double_t, (void *) &SwigClassComplexD);
|
|
22339
22530
|
rb_define_alloc_func(SwigClassComplexD.klass, _wrap_ComplexD_allocate);
|
|
@@ -22442,6 +22633,7 @@ SWIGEXPORT void Init_SylphideMath(void) {
|
|
|
22442
22633
|
rb_define_method(SwigClassMatrix_FrozenD.klass, "index", VALUEFUNC(_wrap_Matrix_FrozenD_index), -1);
|
|
22443
22634
|
rb_define_alias(SwigClassMatrix_FrozenD.klass, "find_index", "index");
|
|
22444
22635
|
rb_define_method(SwigClassMatrix_FrozenD.klass, "to_a", VALUEFUNC(_wrap_Matrix_FrozenD_to_a), -1);
|
|
22636
|
+
rb_define_method(SwigClassMatrix_FrozenD.klass, "to_shareable", VALUEFUNC(_wrap_Matrix_FrozenD_to_shareable), -1);
|
|
22445
22637
|
rb_define_method(SwigClassMatrix_FrozenD.klass, "to_s", VALUEFUNC(_wrap_Matrix_FrozenD___str__), -1);
|
|
22446
22638
|
rb_define_method(SwigClassMatrix_FrozenD.klass, "conjugate", VALUEFUNC(_wrap_Matrix_FrozenD_conjugate), -1);
|
|
22447
22639
|
rb_define_alias(SwigClassMatrix_FrozenD.klass, "conj", "conjugate");
|
|
@@ -22518,6 +22710,7 @@ SWIGEXPORT void Init_SylphideMath(void) {
|
|
|
22518
22710
|
rb_define_method(SwigClassMatrix_FrozenD_f.klass, "index", VALUEFUNC(_wrap_Matrix_FrozenD_f_index), -1);
|
|
22519
22711
|
rb_define_alias(SwigClassMatrix_FrozenD_f.klass, "find_index", "index");
|
|
22520
22712
|
rb_define_method(SwigClassMatrix_FrozenD_f.klass, "to_a", VALUEFUNC(_wrap_Matrix_FrozenD_f_to_a), -1);
|
|
22713
|
+
rb_define_method(SwigClassMatrix_FrozenD_f.klass, "to_shareable", VALUEFUNC(_wrap_Matrix_FrozenD_f_to_shareable), -1);
|
|
22521
22714
|
rb_define_method(SwigClassMatrix_FrozenD_f.klass, "to_s", VALUEFUNC(_wrap_Matrix_FrozenD_f___str__), -1);
|
|
22522
22715
|
rb_define_method(SwigClassMatrix_FrozenD_f.klass, "conjugate", VALUEFUNC(_wrap_Matrix_FrozenD_f_conjugate), -1);
|
|
22523
22716
|
rb_define_alias(SwigClassMatrix_FrozenD_f.klass, "conj", "conjugate");
|
|
@@ -22622,6 +22815,7 @@ SWIGEXPORT void Init_SylphideMath(void) {
|
|
|
22622
22815
|
rb_define_method(SwigClassMatrix_FrozenComplexD.klass, "index", VALUEFUNC(_wrap_Matrix_FrozenComplexD_index), -1);
|
|
22623
22816
|
rb_define_alias(SwigClassMatrix_FrozenComplexD.klass, "find_index", "index");
|
|
22624
22817
|
rb_define_method(SwigClassMatrix_FrozenComplexD.klass, "to_a", VALUEFUNC(_wrap_Matrix_FrozenComplexD_to_a), -1);
|
|
22818
|
+
rb_define_method(SwigClassMatrix_FrozenComplexD.klass, "to_shareable", VALUEFUNC(_wrap_Matrix_FrozenComplexD_to_shareable), -1);
|
|
22625
22819
|
rb_define_method(SwigClassMatrix_FrozenComplexD.klass, "to_s", VALUEFUNC(_wrap_Matrix_FrozenComplexD___str__), -1);
|
|
22626
22820
|
rb_define_method(SwigClassMatrix_FrozenComplexD.klass, "conjugate", VALUEFUNC(_wrap_Matrix_FrozenComplexD_conjugate), -1);
|
|
22627
22821
|
rb_define_alias(SwigClassMatrix_FrozenComplexD.klass, "conj", "conjugate");
|
|
@@ -22698,6 +22892,7 @@ SWIGEXPORT void Init_SylphideMath(void) {
|
|
|
22698
22892
|
rb_define_method(SwigClassMatrix_FrozenComplexD_f.klass, "index", VALUEFUNC(_wrap_Matrix_FrozenComplexD_f_index), -1);
|
|
22699
22893
|
rb_define_alias(SwigClassMatrix_FrozenComplexD_f.klass, "find_index", "index");
|
|
22700
22894
|
rb_define_method(SwigClassMatrix_FrozenComplexD_f.klass, "to_a", VALUEFUNC(_wrap_Matrix_FrozenComplexD_f_to_a), -1);
|
|
22895
|
+
rb_define_method(SwigClassMatrix_FrozenComplexD_f.klass, "to_shareable", VALUEFUNC(_wrap_Matrix_FrozenComplexD_f_to_shareable), -1);
|
|
22701
22896
|
rb_define_method(SwigClassMatrix_FrozenComplexD_f.klass, "to_s", VALUEFUNC(_wrap_Matrix_FrozenComplexD_f___str__), -1);
|
|
22702
22897
|
rb_define_method(SwigClassMatrix_FrozenComplexD_f.klass, "conjugate", VALUEFUNC(_wrap_Matrix_FrozenComplexD_f_conjugate), -1);
|
|
22703
22898
|
rb_define_alias(SwigClassMatrix_FrozenComplexD_f.klass, "conj", "conjugate");
|
data/ext/gps_pvt/extconf.rb
CHANGED
|
@@ -3,9 +3,14 @@ proc{|ninja_tool_dir|
|
|
|
3
3
|
dir_config('ninja_tool', ninja_tool_dir, ninja_tool_dir)
|
|
4
4
|
}.call(File::absolute_path(File::join(
|
|
5
5
|
File::dirname(__FILE__), '..', 'ninja-scan-light', 'tool')))
|
|
6
|
-
cflags = " -Wall"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
cflags = " -Wall -I../../.. -O3" # -march=native
|
|
7
|
+
RE_optflags = /(?<=^|\s)-O(?:[0-3sgz]|fast)?/
|
|
8
|
+
if RE_optflags =~ cflags then
|
|
9
|
+
$CFLAGS.gsub!(RE_optflags, '')
|
|
10
|
+
$CXXFLAGS.gsub!(RE_optflags, '')
|
|
11
|
+
end
|
|
12
|
+
$CFLAGS << cflags
|
|
13
|
+
$CXXFLAGS << cflags
|
|
9
14
|
$LOCAL_LIBS += " -lstdc++ "
|
|
10
15
|
|
|
11
16
|
IO_TARGETS = [
|
|
@@ -235,8 +235,14 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
235
235
|
using super_t::columns;
|
|
236
236
|
|
|
237
237
|
protected:
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
template <class T2, class U = void>
|
|
239
|
+
struct property_t {
|
|
240
|
+
typedef int ref_cnt_t;
|
|
241
|
+
};
|
|
242
|
+
typedef typename property_t<T>::ref_cnt_t ref_cnt_t;
|
|
243
|
+
|
|
244
|
+
static const int offset = (sizeof(T) >= sizeof(ref_cnt_t)) ? 1 : ((sizeof(ref_cnt_t) + sizeof(T) - 1) / sizeof(T));
|
|
245
|
+
ref_cnt_t *ref_cnt; ///< reference counter TODO alignment?
|
|
240
246
|
T *values; ///< array for values
|
|
241
247
|
|
|
242
248
|
template <class T2, bool do_memory_op = std::numeric_limits<T2>::is_specialized>
|
|
@@ -263,7 +269,7 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
263
269
|
};
|
|
264
270
|
|
|
265
271
|
public:
|
|
266
|
-
Array2D_Dense() : super_t(0, 0),
|
|
272
|
+
Array2D_Dense() : super_t(0, 0), ref_cnt(NULL), values(NULL) {
|
|
267
273
|
}
|
|
268
274
|
|
|
269
275
|
/**
|
|
@@ -276,9 +282,9 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
276
282
|
const unsigned int &rows,
|
|
277
283
|
const unsigned int &columns)
|
|
278
284
|
: super_t(rows, columns),
|
|
279
|
-
|
|
280
|
-
values(reinterpret_cast<T *>(
|
|
281
|
-
*
|
|
285
|
+
ref_cnt(reinterpret_cast<ref_cnt_t *>(new T[offset + (rows * columns)])),
|
|
286
|
+
values(reinterpret_cast<T *>(ref_cnt) + offset) {
|
|
287
|
+
*ref_cnt = 1;
|
|
282
288
|
}
|
|
283
289
|
/**
|
|
284
290
|
* Constructor with initializer
|
|
@@ -292,9 +298,9 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
292
298
|
const unsigned int &columns,
|
|
293
299
|
const T *serialized)
|
|
294
300
|
: super_t(rows, columns),
|
|
295
|
-
|
|
296
|
-
values(reinterpret_cast<T *>(
|
|
297
|
-
*
|
|
301
|
+
ref_cnt(reinterpret_cast<ref_cnt_t *>(new T[offset + (rows * columns)])),
|
|
302
|
+
values(reinterpret_cast<T *>(ref_cnt) + offset) {
|
|
303
|
+
*ref_cnt = 1;
|
|
298
304
|
setup_t<T>::copy(*this, serialized);
|
|
299
305
|
}
|
|
300
306
|
/**
|
|
@@ -304,8 +310,8 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
304
310
|
*/
|
|
305
311
|
Array2D_Dense(const self_t &array)
|
|
306
312
|
: super_t(array.m_rows, array.m_columns),
|
|
307
|
-
|
|
308
|
-
if(
|
|
313
|
+
ref_cnt(array.ref_cnt), values(array.values){
|
|
314
|
+
if(ref_cnt){++(*ref_cnt);}
|
|
309
315
|
}
|
|
310
316
|
/**
|
|
311
317
|
* Constructor based on another type array, which performs deep copy.
|
|
@@ -315,9 +321,9 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
315
321
|
template <class T2>
|
|
316
322
|
Array2D_Dense(const Array2D_Frozen<T2> &array)
|
|
317
323
|
: super_t(array.rows(), array.columns()),
|
|
318
|
-
|
|
319
|
-
values(reinterpret_cast<T *>(
|
|
320
|
-
*
|
|
324
|
+
ref_cnt(reinterpret_cast<ref_cnt_t *>(new T[offset + (array.rows() * array.columns())])),
|
|
325
|
+
values(reinterpret_cast<T *>(ref_cnt) + offset) {
|
|
326
|
+
*ref_cnt = 1;
|
|
321
327
|
T *buf(values);
|
|
322
328
|
const unsigned int i_end(array.rows()), j_end(array.columns());
|
|
323
329
|
for(unsigned int i(0); i < i_end; ++i){
|
|
@@ -333,8 +339,8 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
333
339
|
* allocated memory for elements will be deleted.
|
|
334
340
|
*/
|
|
335
341
|
~Array2D_Dense(){
|
|
336
|
-
if(
|
|
337
|
-
delete [] reinterpret_cast<T *>(
|
|
342
|
+
if(ref_cnt && ((--(*ref_cnt)) <= 0)){
|
|
343
|
+
delete [] reinterpret_cast<T *>(ref_cnt);
|
|
338
344
|
}
|
|
339
345
|
}
|
|
340
346
|
|
|
@@ -346,10 +352,10 @@ class Array2D_Dense : public Array2D<T, Array2D_Dense<T> > {
|
|
|
346
352
|
*/
|
|
347
353
|
self_t &operator=(const self_t &array){
|
|
348
354
|
if(this != &array){
|
|
349
|
-
if(
|
|
355
|
+
if(ref_cnt && ((--(*ref_cnt)) <= 0)){delete [] reinterpret_cast<T *>(ref_cnt);}
|
|
350
356
|
super_t::m_rows = array.m_rows;
|
|
351
357
|
super_t::m_columns = array.m_columns;
|
|
352
|
-
if((
|
|
358
|
+
if((ref_cnt = array.ref_cnt)){++(*ref_cnt);}
|
|
353
359
|
values = array.values;
|
|
354
360
|
}
|
|
355
361
|
return *this;
|
|
@@ -50,6 +50,12 @@ inline std::string to_string(const T &value){
|
|
|
50
50
|
%include exception.i
|
|
51
51
|
%include std_except.i
|
|
52
52
|
|
|
53
|
+
%init %{
|
|
54
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
55
|
+
rb_ext_ractor_safe(true);
|
|
56
|
+
#endif
|
|
57
|
+
%}
|
|
58
|
+
|
|
53
59
|
#if !defined(SWIGIMPORTED)
|
|
54
60
|
%exceptionclass native_exception;
|
|
55
61
|
%typemap(throws,noblock=1) native_exception {
|
|
@@ -112,6 +118,7 @@ static std::string inspect_str(const VALUE &v){
|
|
|
112
118
|
%feature("autodoc", "1");
|
|
113
119
|
|
|
114
120
|
%import "SylphideMath.i"
|
|
121
|
+
%fragment("SylphideMath.i");
|
|
115
122
|
%import "Coordinate.i"
|
|
116
123
|
|
|
117
124
|
%typemap(in,numinputs=0) const void *check_block {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
%module SylphideMath
|
|
7
7
|
|
|
8
|
-
#define ENABLE_IOSTREAM 1
|
|
9
|
-
|
|
10
8
|
%{
|
|
11
9
|
#include <string>
|
|
12
10
|
#include <sstream>
|
|
13
11
|
#include <vector>
|
|
14
12
|
#include <exception>
|
|
13
|
+
%}
|
|
15
14
|
|
|
15
|
+
%fragment("SylphideMath.i", "header") %{
|
|
16
16
|
#if defined(SWIGRUBY) && defined(isfinite)
|
|
17
17
|
#undef isfinite_
|
|
18
18
|
#undef isfinite
|
|
@@ -25,14 +25,31 @@
|
|
|
25
25
|
#undef isfinite_
|
|
26
26
|
#define isfinite(x) finite(x)
|
|
27
27
|
#endif
|
|
28
|
+
|
|
29
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
30
|
+
#include <atomic>
|
|
31
|
+
template <class T>
|
|
32
|
+
template <class U>
|
|
33
|
+
struct Array2D_Dense<T>::property_t<T, U> {
|
|
34
|
+
typedef std::atomic<int> ref_cnt_t;
|
|
35
|
+
};
|
|
36
|
+
#endif
|
|
28
37
|
%}
|
|
29
38
|
|
|
39
|
+
%fragment("SylphideMath.i");
|
|
40
|
+
|
|
30
41
|
%include std_common.i
|
|
31
42
|
%include std_string.i
|
|
32
43
|
//%include std_vector.i
|
|
33
44
|
%include exception.i
|
|
34
45
|
%include std_except.i
|
|
35
46
|
|
|
47
|
+
%init %{
|
|
48
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
|
49
|
+
rb_ext_ractor_safe(true);
|
|
50
|
+
#endif
|
|
51
|
+
%}
|
|
52
|
+
|
|
36
53
|
%ignore native_exception;
|
|
37
54
|
#if !defined(SWIGIMPORTED)
|
|
38
55
|
%exceptionclass native_exception;
|
|
@@ -1022,6 +1039,20 @@ struct MatrixUtil {
|
|
|
1022
1039
|
}
|
|
1023
1040
|
return res;
|
|
1024
1041
|
}
|
|
1042
|
+
|
|
1043
|
+
VALUE to_shareable() const {
|
|
1044
|
+
Matrix_Frozen<T, Array2D_Type, ViewType > *ptr(
|
|
1045
|
+
new Matrix_Frozen<T, Array2D_Type, ViewType >(*$self));
|
|
1046
|
+
VALUE res(SWIG_NewPointerObj(
|
|
1047
|
+
ptr,
|
|
1048
|
+
$descriptor(Matrix_Frozen<T, Array2D_Type, ViewType > *),
|
|
1049
|
+
SWIG_POINTER_OWN));
|
|
1050
|
+
rb_obj_freeze(res);
|
|
1051
|
+
%#if defined(HAVE_RB_EXT_RACTOR_SAFE)
|
|
1052
|
+
RB_FL_SET(res, RUBY_FL_SHAREABLE);
|
|
1053
|
+
%#endif
|
|
1054
|
+
return res;
|
|
1055
|
+
}
|
|
1025
1056
|
#endif
|
|
1026
1057
|
%typemap(in)
|
|
1027
1058
|
Matrix<T, Array2D_Dense<T> > &output_L,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
require "mkmf"
|
|
2
|
-
cflags = " -Wall -I../../.."
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
cflags = " -Wall -I../../.. -O3" # -march=native
|
|
3
|
+
RE_optflags = /(?<=^|\s)-O(?:[0-3sgz]|fast)?/
|
|
4
|
+
if RE_optflags =~ cflags then
|
|
5
|
+
$CFLAGS.gsub!(RE_optflags, '')
|
|
6
|
+
$CXXFLAGS.gsub!(RE_optflags, '')
|
|
7
|
+
end
|
|
8
|
+
$CFLAGS << cflags
|
|
9
|
+
$CXXFLAGS << cflags
|
|
5
10
|
$LOCAL_LIBS += " -lstdc++ "
|
|
@@ -602,6 +602,37 @@ shared_examples 'Matrix' do
|
|
|
602
602
|
}
|
|
603
603
|
end
|
|
604
604
|
end
|
|
605
|
+
describe 'parallelization with Ractor' do
|
|
606
|
+
it "supports instantiation in sub Ractor" do
|
|
607
|
+
expect{
|
|
608
|
+
rac = Ractor::new{
|
|
609
|
+
mat_type, r, c = receive
|
|
610
|
+
# @see https://docs.ruby-lang.org/en/master/ractor_md.html#label-Return+value+of+a+block+for+Ractor.new
|
|
611
|
+
# When the block return value is available, ...,
|
|
612
|
+
# so any values can be sent with this communication path
|
|
613
|
+
# without any modification.
|
|
614
|
+
mat_type::new(r, c)
|
|
615
|
+
}
|
|
616
|
+
rac.send([mat_type, params[:rc]].flatten.freeze)
|
|
617
|
+
mat = rac.take
|
|
618
|
+
[:row_size, :column_size].zip(params[:rc]).each{|k, v|
|
|
619
|
+
expect(mat.send(k)).to eq(v)
|
|
620
|
+
}
|
|
621
|
+
}.not_to raise_error
|
|
622
|
+
end
|
|
623
|
+
it "supports messaging by using to_shareable between Ractors" do
|
|
624
|
+
expect{
|
|
625
|
+
rac = Ractor::new{
|
|
626
|
+
mat = receive
|
|
627
|
+
}
|
|
628
|
+
rac.send(mat_type::new(*params[:rc]).to_shareable)
|
|
629
|
+
mat = rac.take
|
|
630
|
+
[:row_size, :column_size].zip(params[:rc]).each{|k, v|
|
|
631
|
+
expect(mat.send(k)).to eq(v)
|
|
632
|
+
}
|
|
633
|
+
}.not_to raise_error
|
|
634
|
+
end
|
|
635
|
+
end if defined?(Ractor)
|
|
605
636
|
end
|
|
606
637
|
|
|
607
638
|
=begin
|
|
@@ -74,11 +74,40 @@ struct BitCounter {
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Count rightmost zeros before the first one (Number of trailing zeros)
|
|
77
|
+
* Be careful, if input equals to 0, then total number of corresponding type bits
|
|
78
|
+
* will be returned like (unsigned int)0 => 32.
|
|
77
79
|
* @param bits results
|
|
78
80
|
*/
|
|
79
81
|
static T ntz(const T &v) {
|
|
80
82
|
return count((T)((~v) & (v - 1)));
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
private:
|
|
86
|
+
template <int Shift, class U = void>
|
|
87
|
+
struct set_lower_bits_loop{
|
|
88
|
+
static inline T run(const T &bits){
|
|
89
|
+
return set_lower_bits_loop<(Shift << 1)>::run(bits | (bits >> Shift));
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
template <class U>
|
|
94
|
+
struct set_lower_bits_loop<num_of_bits, U>{
|
|
95
|
+
static inline T run(const T &bits){
|
|
96
|
+
return bits;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
public:
|
|
100
|
+
static T set_lower_bits(const T &bits) {
|
|
101
|
+
return set_lower_bits_loop<1>::run(bits);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Count leftmost zeros before the first one (Number of leading zeros)
|
|
106
|
+
* @param bits results
|
|
107
|
+
*/
|
|
108
|
+
static T nlz(const T &bits){
|
|
109
|
+
return num_of_bits - count(set_lower_bits(bits));
|
|
110
|
+
}
|
|
82
111
|
};
|
|
83
112
|
|
|
84
113
|
#endif /* __BIT_COUNTER__ */
|
data/gps_pvt.gemspec
CHANGED
|
@@ -35,10 +35,11 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.files += proc{
|
|
36
36
|
require 'pathname'
|
|
37
37
|
base_dir = Pathname::new(File::absolute_path(File.dirname(__FILE__)))
|
|
38
|
+
is_windows_git = `git --version` =~ /windows/i
|
|
38
39
|
# get an array of submodule dirs by executing 'pwd' inside each submodule
|
|
39
40
|
`git submodule --quiet foreach pwd`.split($/).collect{|dir|
|
|
40
41
|
# issue git ls-files in submodule's directory
|
|
41
|
-
`git -C #{dir} ls-files -v`.split($/).collect{|f|
|
|
42
|
+
`git -C #{is_windows_git ? dir.sub(/^\/([^\/]+)/, "\\1:") : dir} ls-files -v`.split($/).collect{|f|
|
|
42
43
|
next nil unless f =~ /^H */ # consider git sparse checkout
|
|
43
44
|
# get relative path
|
|
44
45
|
f = Pathname::new(File::join(dir, $'))
|
data/lib/gps_pvt/pvt.rb
CHANGED
|
@@ -10,7 +10,7 @@ class GPS::PVT_minimal
|
|
|
10
10
|
@vsigma = 13.0 # 95%
|
|
11
11
|
@pdop = 6.0 # 98% global
|
|
12
12
|
@vel_sigma = 0.2 # 85%
|
|
13
|
-
@
|
|
13
|
+
@used_satellites = 0 # unknown
|
|
14
14
|
end
|
|
15
15
|
def position_solved?; @xyz || @llh; end
|
|
16
16
|
def velocity_solved?; @velocity; end
|
|
@@ -45,6 +45,9 @@ class GPS::PVT_minimal
|
|
|
45
45
|
idx = header.find_index{|str| re === str}
|
|
46
46
|
idx && [k, idx]
|
|
47
47
|
}.compact
|
|
48
|
+
opt_keys = [:pdop, :hsigma, :vsigma, :vel_sigma, :used_satellites].select{|k|
|
|
49
|
+
idx_table.any?{|k2, idx| k == k2}
|
|
50
|
+
}
|
|
48
51
|
enum = Enumerator::new{|y|
|
|
49
52
|
io.each_line{|line|
|
|
50
53
|
values = line.chomp.split(/ *, */)
|
|
@@ -52,7 +55,7 @@ class GPS::PVT_minimal
|
|
|
52
55
|
v = values[idx]
|
|
53
56
|
(v == '') ? nil : [k, (Integer(v) rescue Float(v))]
|
|
54
57
|
}.compact.flatten(1))]
|
|
55
|
-
if items
|
|
58
|
+
if items[:week] then
|
|
56
59
|
t = GPS::Time::new(items[:week], items[:tow])
|
|
57
60
|
else
|
|
58
61
|
# UTC assumption, thus leap seconds must be added.
|
|
@@ -60,19 +63,19 @@ class GPS::PVT_minimal
|
|
|
60
63
|
t += GPS::Time::guess_leap_seconds(t)
|
|
61
64
|
end
|
|
62
65
|
pvt = GPS::PVT_minimal::new
|
|
63
|
-
if items
|
|
66
|
+
if items[:lat] then
|
|
64
67
|
pvt.llh = ([:lat, :lng].collect{|k| Math::PI / 180 * items[k]} + [items[:alt]])
|
|
65
|
-
elsif items
|
|
68
|
+
elsif items[:x] then
|
|
66
69
|
pvt.xyz = [:x, :y, :z].collect{|k| items[k]}
|
|
67
70
|
end
|
|
68
|
-
if items
|
|
71
|
+
if items[:vn] then
|
|
69
72
|
pvt.velocity = ([:vn, :ve].collect{|k| items[k]} + [items[:vu] || -items[:vd]])
|
|
70
|
-
elsif items
|
|
73
|
+
elsif items[:vx] then
|
|
71
74
|
pvt.velocity = Coordinate::ENU::relative_rel(
|
|
72
75
|
Coordinate::XYZ::new(*([:vx, :vy, :vz].collect{|k| items[k]})),
|
|
73
76
|
pvt.llh)
|
|
74
77
|
end
|
|
75
|
-
|
|
78
|
+
opt_keys.each{|k| pvt.send("#{k}=", items[k]) if items[k]}
|
|
76
79
|
y.yield(t, pvt)
|
|
77
80
|
}
|
|
78
81
|
}
|
data/lib/gps_pvt/supl.rb
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
require_relative 'upl/upl'
|
|
2
|
-
|
|
2
|
+
require 'gps_pvt/GPS' # in case GPS.so is generated under ext/gps_pvt
|
|
3
3
|
|
|
4
4
|
require 'socket'
|
|
5
5
|
require 'openssl'
|
|
6
|
+
require 'resolv'
|
|
6
7
|
|
|
7
8
|
module GPS_PVT
|
|
8
9
|
class SUPL_Client
|
|
@@ -17,16 +18,30 @@ class SUPL_Client
|
|
|
17
18
|
:debug => 0,
|
|
18
19
|
:protocol => [:lpp, :rrlp],
|
|
19
20
|
:req_data => [:ephemeris], # :almanac
|
|
21
|
+
:timeout => 60, # [sec]
|
|
20
22
|
}.merge(opts)
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def get_assisted_data
|
|
24
26
|
begin
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
timeout = @opts[:timeout]
|
|
28
|
+
host = timeout ? Resolv::getaddress(@host).to_s : @host
|
|
29
|
+
@socket = TCPSocket::new(host, @opts[:port])
|
|
30
|
+
if @opts.include?(:ssl) ? @opts[:ssl] : (@opts[:port] == 7275) then
|
|
27
31
|
@socket = OpenSSL::SSL::SSLSocket::new(@socket)
|
|
28
32
|
@socket.connect
|
|
29
33
|
end
|
|
34
|
+
@socket.define_singleton_method(:read){|bytes|
|
|
35
|
+
buf = String::new
|
|
36
|
+
while (rem = (bytes - buf.size)) > 0
|
|
37
|
+
begin
|
|
38
|
+
buf << read_nonblock(rem)
|
|
39
|
+
rescue IO::WaitReadable
|
|
40
|
+
break unless IO.select([self], nil, nil, timeout)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
buf
|
|
44
|
+
} if timeout
|
|
30
45
|
send_supl_start
|
|
31
46
|
recv_supl_response
|
|
32
47
|
send_supl_pos_init
|
data/lib/gps_pvt/util.rb
CHANGED
|
@@ -100,7 +100,10 @@ module Util
|
|
|
100
100
|
|
|
101
101
|
Tempfile::open(File::basename($0, '.*')){|dst|
|
|
102
102
|
dst.binmode
|
|
103
|
-
dst.write((compressed ? inflate(
|
|
103
|
+
dst.write((compressed ? inflate((case src
|
|
104
|
+
when File, TempFile; src.path
|
|
105
|
+
else; src
|
|
106
|
+
end), compressed) : src).read)
|
|
104
107
|
dst.rewind
|
|
105
108
|
dst.path
|
|
106
109
|
}
|
data/lib/gps_pvt/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gps_pvt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fenrir(M.Naruoka)
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rubyserial
|
|
@@ -66,6 +65,20 @@ dependencies:
|
|
|
66
65
|
- - "~>"
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
67
|
version: '3.0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: matrix
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
69
82
|
- !ruby/object:Gem::Dependency
|
|
70
83
|
name: racc
|
|
71
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -202,7 +215,6 @@ licenses: []
|
|
|
202
215
|
metadata:
|
|
203
216
|
homepage_uri: https://github.com/fenrir-naru/gps_pvt
|
|
204
217
|
source_code_uri: https://github.com/fenrir-naru/gps_pvt
|
|
205
|
-
post_install_message:
|
|
206
218
|
rdoc_options:
|
|
207
219
|
- "--exclude=ext/ninja-scan-light"
|
|
208
220
|
require_paths:
|
|
@@ -218,8 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
218
230
|
- !ruby/object:Gem::Version
|
|
219
231
|
version: '0'
|
|
220
232
|
requirements: []
|
|
221
|
-
rubygems_version:
|
|
222
|
-
signing_key:
|
|
233
|
+
rubygems_version: 4.0.10
|
|
223
234
|
specification_version: 4
|
|
224
235
|
summary: GPS position, velocity, and time (PVT) solver
|
|
225
236
|
test_files: []
|