Module: CVFFI::Eigen

Extended by:
NiceFFI::Library
Defined in:
lib/opencv-ffi-ext/eigen.rb

Defined Under Namespace

Classes: Eigen6d, Eigen7d, EigenDecompResults, EigenSvdResults

Class Method Summary collapse

Class Method Details

.eigen(a) ⇒ Object



40
41
42
43
44
45
# File 'lib/opencv-ffi-ext/eigen.rb', line 40

def self.eigen( a )
  results = EigenDecompResults.new '\0'
  eigenDecompWithCvMat( a.to_CvMat, results )

  [results.D, results.V]
end

.polySolver(a) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/opencv-ffi-ext/eigen.rb', line 70

def self.polySolver( a )

  case a.length
  when 7  then
    coeffs = Eigen7d.new( a )
    answer = eigenPoly6Solver( coeffs )
  else
    raise "Can't solve polynomial with #{a.length} coefficients"
  end

  answer.to_ary
end

.svd(a, opts = {}) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/opencv-ffi-ext/eigen.rb', line 23

def self.svd( a, opts = {} )
  thin = opts[:thin] ? 1 : 0

  results = EigenSvdResults.new '\0'
  eigenSvdWithCvMat( a.to_CvMat, results, thin )

  [ results.U, results.D, results.V ]
end