Vector class
 Inheritance

 Implementers
 Available Extensions
Constructors

Vector(dynamic input, {bool isDouble = true})

Constructs a Vector of given length with all elements initialized to 0.

Vector.arrange(int end, {int start = 0, int step = 1})

Alias for Matrix.range.
factory

Vector.fromList(List<num> data)

Constructs a Vector from a list of numerical values.

Vector.linspace(int start, int end, [int number = 50])

Creates a row Vector with equally spaced values between the start and end values (inclusive).
factory

Vector.random(int length, {double min = 0, double max = 1, bool isDouble = true, Random? random, int? seed})

Constructs a new vector of the given
length
with randomly generated values.
factory

Vector.range(int end, {int start = 0, int step = 1})

Creates a Vector with values in the specified range, incremented by the specified step size.
factory
Properties

elements
→ Iterable

Getter to retrieve an iterable over all elements in the matrix,
regardless of their row or column.
no setter

first
→ num

The first element.
no setterinherited

hashCode
→ int

The hash code for this object.
no setteroverride

isEmpty
→ bool

Whether this collection has no elements.
no setterinherited

isNotEmpty
→ bool

Whether this collection has at least one element.
no setterinherited

iterator
→ Iterator<num>

Overrides the iterator getter to provide a VectorIterator.
This iterator iterates over the elements of the vector.
no setteroverride

last
→ num

The last element.
no setterinherited

length
→ int

Returns the length (number of elements) of the vector.
no setteroverride

runtimeType
→ Type

A representation of the runtime type of the object.
no setterinherited

single
→ num

Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods

angle(Vector other)
→ double

Returns the angle (in radians) between this vector and
other
.

any(bool test(num element))
→ bool

Checks whether any element of this iterable satisfies
test
.
inherited

cast<R>()
→ Iterable<R>

A view of this iterable as an iterable of
R
instances.
inherited

contains(Object? element)
→ bool

Whether the collection contains an element equal to
element
.
inherited

distance(Vector other, {DistanceType distance = DistanceType.frobenius})
→ num

Sets all elements of this vector to
value
.

elementAt(int index)
→ num

Returns the
index
th element.
inherited

every(bool test(num element))
→ bool

Checks whether every element of this iterable satisfies
test
.
inherited

expand<T>(Iterable<T> toElements(num element))
→ Iterable<T>

Expands each element of this Iterable into zero or more elements.
inherited

firstWhere(bool test(num element), {num orElse()?})
→ num

The first element that satisfies the given predicate
test
.
inherited

flip()
→ Vector

Flips elements of the vector.

fold<T>(T initialValue, T combine(T previousValue, num element))
→ T

Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited

followedBy(Iterable<num> other)
→ Iterable<num>

Creates the lazy concatenation of this iterable and
other
.
inherited

forEach(void action(num element))
→ void

Invokes
action
on each element of this iterable in iteration order.
inherited

getVector(List<String> mapping)
→ Vector

Generates a new Vector (Vector2, Vector3, Vector4) based on the mapping provided.

isUnit()
→ bool

Returns
true
if this is a unit vector, i.e., its norm is 1.

isZero()
→ bool

Returns
true
if this is a zero vector, i.e., all its elements are zero.

join([String separator = ""])
→ String

Converts each element to a String and concatenates the strings.
inherited

lastWhere(bool test(num element), {num orElse()?})
→ num

The last element that satisfies the given predicate
test
.
inherited

map<T>(T toElement(num e))
→ Iterable<T>

The current elements of this iterable modified by
toElement
.
inherited

noSuchMethod(Invocation invocation)
→ dynamic

Invoked when a nonexistent method or property is accessed.
inherited

pop()
→ num

Removes the last value in the row.

projection(Vector other)
→ Vector

Returns the projection of this vector onto
other
.

push(num value)
→ void

Adds a new value at the end of the row.

reduce(num combine(num value, num element))
→ num

Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited

roll(dynamic shift)
→ Vector

Rolls the elements in a 1D list by a certain amount.

shift()
→ dynamic

Removes the first value in the row.

singleWhere(bool test(num element), {num orElse()?})
→ num

The single element that satisfies
test
.
inherited

skip(int count)
→ Iterable<num>

Creates an Iterable that provides all but the first
count
elements.
inherited

skipWhile(bool test(num value))
→ Iterable<num>

Creates an
Iterable
that skips leading elements while test
is satisfied.
inherited

splice(int start, int deleteCount, [List<num> newItems = const []])
→ void

Adds/removes elements at an arbitrary position in the row.

subVector({List<int>? indices, String range = '', int? start, int? end})
→ Vector

Extracts a subVector from the given vector using the specified indices or range.

swap(int index1, int index2)
→ void

Swaps two elements in the row.

take(int count)
→ Iterable<num>

Creates a lazy iterable of the
count
first elements of this iterable.
inherited

takeWhile(bool test(num value))
→ Iterable<num>

Creates a lazy iterable of the leading elements satisfying
test
.
inherited

toCylindrical()
→ List<double>

Converts the Vector from Cartesian to Cylindrical coordinates.

toDiagonal()
→ Matrix

Returns the leading diagonal matrix from a vector.

toList({bool growable = true})
→ List<num>

Creates a List containing the elements of this Iterable.
inherited

toMatrix(int rows, int cols, {bool fillWithZeros = true})
→ Matrix

Constructs a new Matrix from a vector.

toPoint()
→ Point


toPolar()
→ List<double>

Converts the Vector from Cartesian to Polar coordinates.

toSet()
→ Set<num>

Creates a Set containing the same elements as this iterable.
inherited

toSpherical()
→ List<double>

Converts the Vector from Cartesian to Spherical coordinates.

toString()
→ String

Returns a string representation of (some of) the elements of
this
.
override

unShift(num value)
→ void

Adds a new value at the beginning of the row.

where(bool test(num element))
→ Iterable<num>

Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.
inherited

whereType<T>()
→ Iterable<T>

Creates a new lazy Iterable with all elements that have type
T
.
inherited