APIdock / Ruby
/
class

Vector

ruby latest stable - Superclass: Object

The Vector class represents a mathematical vector, which is useful in its own right, and also constitutes a row or column of a Matrix.

Method Catalogue

To create a Vector:

  • Vector.[](*array)

  • Vector.elements(array, copy = true)

  • Vector.basis(size: n, index: k)

  • Vector.zero(n)

To access elements:

  • #[](i)

To enumerate the elements:

  • #each2(v)

  • #collect2(v)

Properties of vectors:

Vector arithmetic:

  • #*(x) "is matrix or number"

  • #+(v)

  • #-(v)

  • #/(v)

  • #+@

  • #-@

Vector functions:

Conversion to other data types:

String representations:

Included modules

  • Enumerable
  • ExceptionForMatrix
  • Matrix::CoercionHelper

Attributes

[R] elements

Files

  • lib/matrix.rb

AltStyle によって変換されたページ (->オリジナル) /