# VectorCategory RΒΆ

vector.spad line 35 [edit on github]

R: Type

VectorCategory represents the type of vector like objects, i.e. finite sequences indexed by some finite segment of the integers. The operations available on vectors depend on the structure of the underlying components. Many operations from the component domain are defined for vectors componentwise. It can by assumed that extraction or updating components can be done in constant time.

- #: % -> NonNegativeInteger
from Aggregate

- *: (%, R) -> % if R has SemiGroup
`y * r`

multiplies each component of the vector`y`

by the element`r`

.

- *: (Integer, %) -> % if R has AbelianGroup
`n * y`

multiplies each component of the vector`y`

by the integer`n`

.

- *: (R, %) -> % if R has SemiGroup
`r * y`

multiplies the element`r`

times each component of the vector`y`

.

- +: (%, %) -> % if R has AbelianSemiGroup
`x + y`

returns the component-wise sum of the vectors`x`

and`y`

. Error: if`x`

and`y`

are not of the same length.

- -: % -> % if R has AbelianGroup
`-x`

negates all components of the vector`x`

.

- -: (%, %) -> % if R has AbelianGroup
`x - y`

returns the component-wise difference of the vectors`x`

and`y`

. Error: if`x`

and`y`

are not of the same length.

- <=: (%, %) -> Boolean if R has OrderedSet
from PartialOrder

- <: (%, %) -> Boolean if R has OrderedSet
from PartialOrder

- >=: (%, %) -> Boolean if R has OrderedSet
from PartialOrder

- >: (%, %) -> Boolean if R has OrderedSet
from PartialOrder

- any?: (R -> Boolean, %) -> Boolean
from HomogeneousAggregate R

- coerce: % -> OutputForm if R has CoercibleTo OutputForm
from CoercibleTo OutputForm

- concat: (%, %) -> %
from LinearAggregate R

- concat: (%, R) -> %
from LinearAggregate R

- concat: (R, %) -> %
from LinearAggregate R

- concat: List % -> %
from LinearAggregate R

- construct: List R -> %
from Collection R

- convert: % -> InputForm if R has ConvertibleTo InputForm
from ConvertibleTo InputForm

- copyInto!: (%, %, Integer) -> %
from LinearAggregate R

- count: (R -> Boolean, %) -> NonNegativeInteger
from HomogeneousAggregate R

- count: (R, %) -> NonNegativeInteger if R has BasicType
from HomogeneousAggregate R

- cross: (%, %) -> % if R has Ring
`cross(u, v)`

constructs the cross product of`u`

and`v`

. Error: if`u`

and`v`

are not of length 3.

- delete: (%, Integer) -> %
from LinearAggregate R

- delete: (%, UniversalSegment Integer) -> %
from LinearAggregate R

- dot: (%, %) -> R if R has AbelianMonoid and R has SemiRng
`dot(x, y)`

computes the inner product of the two vectors`x`

and`y`

. Error: if`x`

and`y`

are not of the same length.

- elt: (%, Integer) -> R
- elt: (%, Integer, R) -> R
from EltableAggregate(Integer, R)

- elt: (%, UniversalSegment Integer) -> %
from Eltable(UniversalSegment Integer, %)

- entries: % -> List R
from IndexedAggregate(Integer, R)

- entry?: (R, %) -> Boolean if R has BasicType
from IndexedAggregate(Integer, R)

- eval: (%, Equation R) -> % if R has SetCategory and R has Evalable R
from Evalable R

- eval: (%, List Equation R) -> % if R has SetCategory and R has Evalable R
from Evalable R

- eval: (%, List R, List R) -> % if R has SetCategory and R has Evalable R
from InnerEvalable(R, R)

- eval: (%, R, R) -> % if R has SetCategory and R has Evalable R
from InnerEvalable(R, R)

- every?: (R -> Boolean, %) -> Boolean
from HomogeneousAggregate R

- fill!: (%, R) -> %
from IndexedAggregate(Integer, R)

- find: (R -> Boolean, %) -> Union(R, failed)
from Collection R

- first: % -> R
from IndexedAggregate(Integer, R)

- first: (%, NonNegativeInteger) -> %
from LinearAggregate R

- hash: % -> SingleInteger if R has Hashable
from Hashable

- hashUpdate!: (HashState, %) -> HashState if R has Hashable
from Hashable

- index?: (Integer, %) -> Boolean
from IndexedAggregate(Integer, R)

- indices: % -> List Integer
from IndexedAggregate(Integer, R)

- insert: (%, %, Integer) -> %
from LinearAggregate R

- insert: (R, %, Integer) -> %
from LinearAggregate R

- latex: % -> String if R has SetCategory
from SetCategory

- leftTrim: (%, R) -> % if R has BasicType
from LinearAggregate R

- length: % -> R if R has RadicalCategory and R has Ring
`length(v)`

computes the sqrt(dot(`v`

,`v`

)), i.e. the euclidean length

- less?: (%, NonNegativeInteger) -> Boolean
from Aggregate

- map!: (R -> R, %) -> %
from HomogeneousAggregate R

- map: ((R, R) -> R, %, %) -> %
from LinearAggregate R

- map: (R -> R, %) -> %
from HomogeneousAggregate R

- max: % -> R if R has OrderedSet
from HomogeneousAggregate R

- max: (%, %) -> % if R has OrderedSet
from OrderedSet

- max: ((R, R) -> Boolean, %) -> R
from HomogeneousAggregate R

- maxIndex: % -> Integer
from IndexedAggregate(Integer, R)

- member?: (R, %) -> Boolean if R has BasicType
from HomogeneousAggregate R

- members: % -> List R
from HomogeneousAggregate R

- merge: (%, %) -> % if R has OrderedSet
from LinearAggregate R

- merge: ((R, R) -> Boolean, %, %) -> %
from LinearAggregate R

- min: % -> R if R has OrderedSet
from HomogeneousAggregate R

- min: (%, %) -> % if R has OrderedSet
from OrderedSet

- minIndex: % -> Integer
from IndexedAggregate(Integer, R)

- more?: (%, NonNegativeInteger) -> Boolean
from Aggregate

- new: (NonNegativeInteger, R) -> %
from LinearAggregate R

- outerProduct: (%, %) -> Matrix R if R has Ring
`outerProduct(u, v)`

constructs the matrix whose (`i`

,`j`

)`'`

th element is`u`

(`i`

)`*v`

(`j`

).

- parts: % -> List R
from HomogeneousAggregate R

- position: (R -> Boolean, %) -> Integer
from LinearAggregate R

- position: (R, %) -> Integer if R has BasicType
from LinearAggregate R

- position: (R, %, Integer) -> Integer if R has BasicType
from LinearAggregate R

- qelt: (%, Integer) -> R
from EltableAggregate(Integer, R)

- qsetelt!: (%, Integer, R) -> R
from EltableAggregate(Integer, R)

- reduce: ((R, R) -> R, %) -> R
from Collection R

- reduce: ((R, R) -> R, %, R) -> R
from Collection R

- reduce: ((R, R) -> R, %, R, R) -> R if R has BasicType
from Collection R

- remove: (R -> Boolean, %) -> %
from Collection R

- remove: (R, %) -> % if R has BasicType
from Collection R

- removeDuplicates: % -> % if R has BasicType
from Collection R

- reverse!: % -> %
from LinearAggregate R

- reverse: % -> %
from LinearAggregate R

- rightTrim: (%, R) -> % if R has BasicType
from LinearAggregate R

- select: (R -> Boolean, %) -> %
from Collection R

- setelt!: (%, Integer, R) -> R
from EltableAggregate(Integer, R)

- setelt!: (%, UniversalSegment Integer, R) -> R
from LinearAggregate R

- size?: (%, NonNegativeInteger) -> Boolean
from Aggregate

- smaller?: (%, %) -> Boolean if R has Comparable
from Comparable

- sort!: % -> % if R has OrderedSet
from LinearAggregate R

- sort!: ((R, R) -> Boolean, %) -> %
from LinearAggregate R

- sort: % -> % if R has OrderedSet
from LinearAggregate R

- sort: ((R, R) -> Boolean, %) -> %
from LinearAggregate R

- sorted?: % -> Boolean if R has OrderedSet
from LinearAggregate R

- sorted?: ((R, R) -> Boolean, %) -> Boolean
from LinearAggregate R

- trim: (%, R) -> % if R has BasicType
from LinearAggregate R

- zero?: % -> Boolean if R has AbelianMonoid
`zero?(x)`

returns`true`

if`x`

is a zero vector,`false`

otherwise.

- zero: NonNegativeInteger -> % if R has AbelianMonoid
`zero(n)`

creates a zero vector of length`n`

.

CoercibleTo OutputForm if R has CoercibleTo OutputForm

Comparable if R has Comparable

ConvertibleTo InputForm if R has ConvertibleTo InputForm

Eltable(UniversalSegment Integer, %)

Evalable R if R has SetCategory and R has Evalable R

InnerEvalable(R, R) if R has SetCategory and R has Evalable R

OneDimensionalArrayAggregate R

OrderedSet if R has OrderedSet

PartialOrder if R has OrderedSet

SetCategory if R has SetCategory