class Algebra::Vector
Constants
- Matrices
Public Class Methods
[](*a)
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 629 def self.[](*a) vector(true){|i| a[i]} end
create(ground, n)
click to toggle source
Calls superclass method
Algebra::MatrixAlgebra::create
# File lib/algebra/matrix-algebra.rb, line 615 def self.create(ground, n) klass = super(ground, n, 1) klass.sysvar(:size, n) klass end
matrix(r = size, s = 1) { |i, 0| ... }
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 633 def self.matrix(r = size, s = 1) vector{|i| yield(i, 0)} end
new(array, conv = false)
click to toggle source
Calls superclass method
Algebra::MatrixAlgebra::new
# File lib/algebra/matrix-algebra.rb, line 587 def initialize(array, conv = false) @bone0 = array super(array.collect{|x| [x]}, conv) end
vector(conv = false, &b)
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 625 def self.vector(conv = false, &b) new((0...size).collect(&b), conv) end
Public Instance Methods
[](*x)
click to toggle source
def to_a
column(0)
end
Calls superclass method
Algebra::MatrixAlgebra::[]
# File lib/algebra/matrix-algebra.rb, line 604 def [](*x) case x.size when 1 super(x[0], 0) when 2 super(*x) else raise "size of index be 1 or 2" end end
each() { |x| ... }
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 592 def each @bone0.each do |x| yield x end end
inspect()
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 637 def inspect @bone0.inspect end
size()
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 598 def size; self.class.size; end
to_s()
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 641 def to_s @bone0.inspect end
transpose()
click to toggle source
# File lib/algebra/matrix-algebra.rb, line 621 def transpose Algebra::Covector.create(ground, size).new(to_a) end