Package mathvoyage.matrix
Class vector
java.lang.Object
mathvoyage.matrix.vector
The type Vector.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd vector.doublegetComponent(int index) Gets component.doubleGet magnitude double.getScaled(double value) Get scaled vector.intgetSize()Gets size.Get unit vector vector.booleanIs equal boolean.Multiply vector.voidPrint vector.voidscale(double value) Scale.doublescalerProduct(vector other) Scaler product double.voidsetComponent(int index, double value) Sets component.Subtract vector.vectorProduct(vector other) Vector product vector.
-
Constructor Details
-
vector
public vector(double[] data) Instantiates a new Vector.- Parameters:
data- the data
-
vector
public vector(int size) Instantiates a new Vector.- Parameters:
size- the size
-
-
Method Details
-
getComponent
public double getComponent(int index) Gets component.- Parameters:
index- the index- Returns:
- the component
-
setComponent
public void setComponent(int index, double value) Sets component.- Parameters:
index- the indexvalue- the value
-
getSize
public int getSize()Gets size.- Returns:
- the size
-
scale
public void scale(double value) Scale.- Parameters:
value- the value
-
getScaled
Get scaled vector.- Parameters:
value- the value- Returns:
- the vector
-
add
Add vector.- Parameters:
other- the other- Returns:
- the vector
-
subtract
Subtract vector.- Parameters:
other- the other- Returns:
- the vector
-
scalerProduct
Scaler product double.- Parameters:
other- the other- Returns:
- the double
-
vectorProduct
Vector product vector.- Parameters:
other- the other- Returns:
- the vector
-
multiply
Multiply vector.- Parameters:
m- the m- Returns:
- the vector
-
getMagnitude
public double getMagnitude()Get magnitude double.- Returns:
- the double
-
getUnitVector
Get unit vector vector.- Returns:
- the vector
-
isEqual
Is equal boolean.- Parameters:
other- the other- Returns:
- the boolean
-
printVector
public void printVector()Print vector.
-