Package com.titan.math
Class Vector
java.lang.Object
com.titan.math.Vector
-
Constructor Summary
ConstructorsConstructorDescriptionVector(double[] values) constructs a vector and calculates its length using the appropriate formula -
Method Summary
Modifier and TypeMethodDescriptionadds two vectors togetherstatic Vectorclone()clones a vectordoubledotProduct(Vector c) static doubledotProduct(Vector v, Vector c) booleandoublereturns the length of a vectorintgetSize()returns the dimension of a vectordoublegetValue(int i) double[]multiplyByScalar(double c) multiplies a given vector by a scalarsubtracts a vector from anotherstatic VectortoString()
-
Constructor Details
-
Vector
public Vector(double[] values) constructs a vector and calculates its length using the appropriate formula- Parameters:
values-
-
-
Method Details
-
getLength
public double getLength()returns the length of a vector- Returns:
-
getSize
public int getSize()returns the dimension of a vector- Returns:
-
getValues
public double[] getValues()- Returns:
- values a vector holds
-
getValue
public double getValue(int i) - Parameters:
i- index of value- Returns:
- specific value a vector holds
-
add
-
subtract
-
multiplyByScalar
multiplies a given vector by a scalar- Parameters:
c- scalar to multuplly by- Returns:
- new Vector after multiplication
-
add
-
subtract
-
dotProduct
-
dotProduct
-
toString
-
clone
-
equals
-