ruby-eigen 0.0.11.pre1 → 0.0.11.pre2

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.
@@ -0,0 +1,13 @@
1
+ namespace RubyEigen {
2
+ typedef FullPivLU<MatrixXd> FullPivLUDouble;
3
+ typedef FullPivLU<MatrixXcd> FullPivLUComplex;
4
+ typedef PartialPivLU<MatrixXd> PartialPivLUDouble;
5
+ typedef FullPivHouseholderQR<MatrixXd> FullPivHouseholderQRDouble;
6
+ typedef FullPivHouseholderQR<MatrixXcd> FullPivHouseholderQRComplex;
7
+ typedef JacobiSVD<MatrixXd> JacobiSVDDouble;
8
+ typedef JacobiSVD<MatrixXcd> JacobiSVDComplex;
9
+ typedef LDLT<MatrixXd> LDLTDouble;
10
+ typedef LDLT<MatrixXcd> LDLTComplex;
11
+ typedef LLT<MatrixXd> LLTDouble;
12
+ typedef LLT<MatrixXcd> LLTComplex;
13
+ };
@@ -0,0 +1,7 @@
1
+ namespace RubyEigen {
2
+ typedef SparseQR<RubyEigen::SpMatrixDouble, COLAMDOrdering<int> > SparseQRDouble;
3
+ typedef SparseQR<RubyEigen::SpMatrixFloat, COLAMDOrdering<int> > SparseQRFloat;
4
+
5
+ typedef SparseLU<RubyEigen::SpMatrixDouble, COLAMDOrdering<int> > SparseLUDouble;
6
+ typedef SparseLU<RubyEigen::SpMatrixFloat, COLAMDOrdering<int> > SparseLUFloat;
7
+ };
@@ -0,0 +1,34 @@
1
+ /* To avoid contaminating Eigen namespace, we use RubyEigen instead of Eigen. */
2
+ namespace RubyEigen {
3
+
4
+ typedef RubyEigen::Matrix<double, RubyEigen::Dynamic, RubyEigen::Dynamic> MatrixDouble;
5
+ typedef RubyEigen::Matrix<float, RubyEigen::Dynamic, RubyEigen::Dynamic> MatrixFloat;
6
+ typedef RubyEigen::Matrix<std::complex<double>, RubyEigen::Dynamic, RubyEigen::Dynamic> MatrixComplex;
7
+ typedef RubyEigen::Matrix<std::complex<float>, RubyEigen::Dynamic, RubyEigen::Dynamic> MatrixComplexFloat;
8
+
9
+ typedef RubyEigen::Array<double, RubyEigen::Dynamic, RubyEigen::Dynamic> ArrayXXd;
10
+
11
+ /*
12
+ By redefining VectorXd and VectorXcd in SWIG scope, SWIG can interpret what the templates are.
13
+ The following templates appear in some decomposition classes.
14
+ */
15
+ typedef RubyEigen::Matrix<RubyEigen::MatrixDouble::Scalar, RubyEigen::Dynamic, 1> VectorXd;
16
+ typedef RubyEigen::Matrix<RubyEigen::MatrixComplex::Scalar, RubyEigen::Dynamic, 1> VectorXcd;
17
+ typedef RubyEigen::Matrix<RubyEigen::MatrixXi::Scalar, RubyEigen::Dynamic, 1> VectorXi;
18
+
19
+ typedef RubyEigen::Block<RubyEigen::MatrixDouble> MatrixDoubleRef;
20
+ typedef RubyEigen::Block<RubyEigen::MatrixXcd> MatrixComplexRef;
21
+
22
+ typedef Matrix<bool, Dynamic, Dynamic> MatrixBool;
23
+ typedef Matrix<bool, Dynamic, 1> VectorBool;
24
+ typedef Array<bool, Dynamic, Dynamic> CMatrixBool;
25
+ typedef Array<bool, Dynamic, 1> CVectorBool;
26
+
27
+ typedef SparseMatrix<double> SpMatrixDouble;
28
+ typedef SparseMatrix<float> SpMatrixFloat;
29
+ typedef SparseMatrix<double>::InnerIterator SpMatrixDoubleIter;
30
+ typedef SparseMatrix<float>::InnerIterator SpMatrixFloatIter;
31
+
32
+ typedef PermutationMatrix<RubyEigen::Dynamic, RubyEigen::Dynamic, int> PermutationMatrix;
33
+ typedef Matrix<int, Dynamic, 1> PermutationIndices;
34
+ };
@@ -0,0 +1,15 @@
1
+ namespace RubyEigen {
2
+ class EigenRuntimeError : public std::runtime_error {
3
+ public:
4
+ EigenRuntimeError(const std::string& cause)
5
+ : std::runtime_error(cause) {}
6
+ };
7
+ };
8
+
9
+ VALUE rb_eEigenRuntimeError;
10
+
11
+ /* DONOT use rb_raise here. eigen_assert is called inside the functions
12
+ of eigen library in C++. Calling rb_raise will cause deconstructor issues. */
13
+ #undef eigen_assert
14
+ #define eigen_assert(x) do {\
15
+ if(!Eigen::internal::copy_bool(x)) throw (RubyEigen::EigenRuntimeError(EIGEN_MAKESTRING(x))); } while(false)
@@ -0,0 +1,5 @@
1
+ #ifndef RUBYEIGEN_GC_H
2
+ #define RUBYEIGEN_GC_H
3
+ void rb_gc();
4
+ void rubyeigen_gc_add_count(size_t sz);
5
+ #endif
@@ -0,0 +1,26 @@
1
+ #ifndef RUBYEIGEN_GC_HPP
2
+ #define RUBYEIGEN_GC_HPP
3
+
4
+ #include "rubyeigen_gc.h"
5
+ #include <climits>
6
+
7
+ static size_t rubyeigen_gc_count = 0;
8
+
9
+ size_t rubyeigen_gc_get_count() {
10
+ return rubyeigen_gc_count;
11
+ }
12
+
13
+ void rubyeigen_gc_reset_count() {
14
+ rubyeigen_gc_count = 0;
15
+ }
16
+
17
+ void rubyeigen_gc_add_count(size_t sz) {
18
+ const size_t max_size = (size_t)-1;
19
+ if(max_size - rubyeigen_gc_count > sz ) {
20
+ rubyeigen_gc_count += sz;
21
+ } else if( sz > rubyeigen_gc_count ) {
22
+ rubyeigen_gc_count = sz;
23
+ }
24
+ }
25
+
26
+ #endif
data/lib/eigen.rb CHANGED
@@ -144,6 +144,12 @@ class Eigen::MatrixDouble
144
144
  private "__get_item__", "__get_block__"
145
145
  end
146
146
 
147
+ class Eigen::MatrixFloat
148
+ extend Eigen::MatrixConstructor
149
+ include Eigen::MatrixCommon
150
+ private "__get_item__", "__get_block__"
151
+ end
152
+
147
153
  class Eigen::MatrixComplex
148
154
  extend Eigen::MatrixConstructor
149
155
  include Eigen::MatrixCommon
@@ -203,3 +209,14 @@ class Eigen::SpMatrixDouble
203
209
  include Eigen::SpMatrixCommon
204
210
  private "__reserve__", "__insert__"
205
211
  end
212
+
213
+
214
+ Thread.start do
215
+ loop do
216
+ if Eigen.gc_count > 67108864
217
+ GC.start
218
+ Eigen.reset_gc_count()
219
+ end
220
+ sleep(2)
221
+ end
222
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-eigen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11.pre1
4
+ version: 0.0.11.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Tamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-05 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -328,10 +328,16 @@ files:
328
328
  - ext/eigen/eigen3/signature_of_eigen3_matrix_library
329
329
  - ext/eigen/eigen_wrap.cxx
330
330
  - ext/eigen/extconf.rb
331
+ - ext/eigen/rubyeigen_algo.h
332
+ - ext/eigen/rubyeigen_algo_base.h
333
+ - ext/eigen/rubyeigen_base.h
334
+ - ext/eigen/rubyeigen_except.h
335
+ - ext/eigen/rubyeigen_gc.h
336
+ - ext/eigen/rubyeigen_gc.hpp
331
337
  - lib/eigen.rb
332
338
  homepage: https://github.com/ruby-eigen/ruby-eigen
333
339
  licenses:
334
- - LGPL
340
+ - LGPL-3.0
335
341
  metadata: {}
336
342
  post_install_message:
337
343
  rdoc_options: