ch.akuhn.matrix

Class DenseVector

• ```public class DenseVector
extends Vector```
A dense vector
Author:

• Nested classes/interfaces inherited from class ch.akuhn.matrix.Vector

`Vector.Entry`
• Constructor Summary

Constructors
Modifier Constructor and Description
`protected ` `DenseVector(double[] values)`
`protected ` `DenseVector(int size)`
• Method Summary

All Methods
Modifier and Type Method and Description
`double` `cosine(DenseVector other)`
Cosine of angle between this and another vector
`boolean` ```equals(Vector v, double epsilon)```
Test for equality
`double` `get(int index)`
Get the value at the given index
`double` `norm()`
Compute the L2 norm
`double` ```put(int index, double value)```
Set the value at an index
`int` `size()`
`Vector` `times(double scalar)`
Multiply by a constant, creating a new vector
`Vector` `timesEquals(double scalar)`
Multiply by a constant in-place
`double[]` `unwrap()`
• Methods inherited from class ch.akuhn.matrix.Vector

`add, applyCentering, copy, dense, density, dot, entries, from, mean, scaleAndAddTo, sparse, storeOn, sum, toString, used, wrap`
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• Constructor Detail

• DenseVector

`protected DenseVector(double[] values)`
• DenseVector

`protected DenseVector(int size)`
• Method Detail

• cosine

`public double cosine(DenseVector other)`
Cosine of angle between this and another vector
Parameters:
`other` -
Returns:
the cosine
• get

`public double get(int index)`
Description copied from class: `Vector`
Get the value at the given index
Specified by:
`get` in class `Vector`
Returns:
the value
• norm

`public double norm()`
Description copied from class: `Vector`
Compute the L2 norm
Overrides:
`norm` in class `Vector`
Returns:
the L2 norm
• put

```public double put(int index,
double value)```
Description copied from class: `Vector`
Set the value at an index
Specified by:
`put` in class `Vector`
Returns:
the new value
• size

`public int size()`
Specified by:
`size` in class `Vector`
Returns:
the length of the vector
• times

`public Vector times(double scalar)`
Description copied from class: `Vector`
Multiply by a constant, creating a new vector
Specified by:
`times` in class `Vector`
Returns:
the vector
• timesEquals

`public Vector timesEquals(double scalar)`
Description copied from class: `Vector`
Multiply by a constant in-place
Specified by:
`timesEquals` in class `Vector`
Returns:
this
• equals

```public boolean equals(Vector v,
double epsilon)```
Description copied from class: `Vector`
Test for equality
Specified by:
`equals` in class `Vector`
Returns:
true if the same; false otherwise
• unwrap

`public double[] unwrap()`
Overrides:
`unwrap` in class `Vector`
Returns:
an array