Class: Algebra::Vector
- Inherits:
-
MatrixAlgebra
- Object
- MatrixAlgebra
- Algebra::Vector
- Includes:
- InnerProductSpace
- Defined in:
- lib/algebra/matrix-algebra.rb
Constant Summary collapse
- Matrices =
{}
Class Method Summary collapse
- .[](*a) ⇒ Object
- .create(ground, n) ⇒ Object
- .matrix(r = size, s = 1) ⇒ Object
- .vector(conv = false, &b) ⇒ Object
Instance Method Summary collapse
-
#[](*x) ⇒ Object
def to_a column(0) end.
- #each ⇒ Object
-
#initialize(array, conv = false) ⇒ Vector
constructor
A new instance of Vector.
- #inspect ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
- #transpose ⇒ Object
Methods included from InnerProductSpace
#inner_product, #inner_product_complex, #norm2, #norm2_complex
Methods inherited from MatrixAlgebra
*, #*, **, #+, #-, #/, #==, #[]=, #coerce, #cofactor, #cofactor_matrix, #collect_column, collect_column, #collect_ij, collect_ij, collect_row, #collect_row, #column, #columns, convert_from, #convert_to, #csize, #diag, #display, #display_by_latex, #dsum, dsum, dsum_c, dsum_r, #dup, #e_deg, #each_column, #each_i, each_ij, #each_index, each_index, #each_j, #each_row, #flatten, #i2o, #jordan_form, #jordan_form_info, #latex, #map, matrices, #matrix, minor, #minor, #old_mul, #orthogonal_basis, #rank, regulate, #replace, #row, #row!, #rows, #rsize, #set_column, #set_row, #simplify, #sizes, #to_ary, #to_quint, #to_triplet, transpose, #types, #vectors, zero
Methods included from AlgebraCreator
#create, #superior?, #sysvar, #wedge
Methods included from GaussianElimination
#divide_c, #divide_c!, #divide_r, #divide_r!, #kernel_basis, #left_eliminate!, #left_eliminate_euclidian!, #left_inverse, #left_sweep, #mix_c, #mix_c!, #mix_r, #mix_r!, #multiply_c, #multiply_c!, #multiply_r, #multiply_r!, #sswap_r!, #step_matrix?, #swap_c, #swap_c!, #swap_r, #swap_r!
Methods included from ElementaryDivisor
#_coeff, #e_diagonalize, #e_diagonalize!, #e_inverse, #el_sweep!, #el_sweep_old!, #elementary_divisor, factorize, #horizontal_sweep!, #sq_find_nondiv, #vertical_sweep!
Methods included from Enumerable
Methods included from AlgebraBase
#*, #**, #+, #+@, #-, #-@, #/, #==, append_features, #coerce, #devide?, #ground, #ground=, #regulate, #unit?, #unity, #unity?, #zero, #zero?
Methods included from Orthogonalization
Constructor Details
#initialize(array, conv = false) ⇒ Vector
Returns a new instance of Vector.
587 588 589 590 |
# File 'lib/algebra/matrix-algebra.rb', line 587 def initialize(array, conv = false) @bone0 = array super(array.collect{|x| [x]}, conv) end |
Class Method Details
.[](*a) ⇒ Object
629 630 631 |
# File 'lib/algebra/matrix-algebra.rb', line 629 def self.[](*a) vector(true){|i| a[i]} end |
.create(ground, n) ⇒ Object
615 616 617 618 619 |
# 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) ⇒ Object
633 634 635 |
# File 'lib/algebra/matrix-algebra.rb', line 633 def self.matrix(r = size, s = 1) vector{|i| yield(i, 0)} end |
.vector(conv = false, &b) ⇒ Object
625 626 627 |
# File 'lib/algebra/matrix-algebra.rb', line 625 def self.vector(conv = false, &b) new((0...size).collect(&b), conv) end |
Instance Method Details
#[](*x) ⇒ Object
def to_a
column(0)
end
604 605 606 607 608 609 610 611 612 613 |
# 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 ⇒ Object
592 593 594 595 596 |
# File 'lib/algebra/matrix-algebra.rb', line 592 def each @bone0.each do |x| yield x end end |
#inspect ⇒ Object
637 638 639 |
# File 'lib/algebra/matrix-algebra.rb', line 637 def inspect @bone0.inspect end |
#size ⇒ Object
598 |
# File 'lib/algebra/matrix-algebra.rb', line 598 def size; self.class.size; end |
#to_s ⇒ Object
641 642 643 |
# File 'lib/algebra/matrix-algebra.rb', line 641 def to_s @bone0.inspect end |