Package dev.nm.number.doublearray
Class SimpleDoubleArrayOperation
- java.lang.Object
-
- dev.nm.number.doublearray.SimpleDoubleArrayOperation
-
- All Implemented Interfaces:
DoubleArrayOperation
public class SimpleDoubleArrayOperation extends Object implements DoubleArrayOperation
This is a simple, single-threaded implementation of the array math operations.
-
-
Constructor Summary
Constructors Constructor Description SimpleDoubleArrayOperation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]add(double[] arr1, double[] arr2)Add twodoublearrays, entry-by-entry.double[]divide(double[] arr1, double[] arr2)Divide onedoublearray by another, entry-by-entry.double[]minus(double[] arr1, double[] arr2)Subtract onedoublearray from another, entry-by-entry.double[]multiply(double[] arr1, double[] arr2)Multiply onedoublearray to another, entry-by-entry.double[]scaled(double[] arr, double c)Scale each entry of adoublearray.
-
-
-
Method Detail
-
add
public double[] add(double[] arr1, double[] arr2)Description copied from interface:DoubleArrayOperationAdd twodoublearrays, entry-by-entry.- Specified by:
addin interfaceDoubleArrayOperation- Parameters:
arr1- an arraydouble[]arr2- an arraydouble[]- Returns:
- the sum of the two arrays
-
minus
public double[] minus(double[] arr1, double[] arr2)Description copied from interface:DoubleArrayOperationSubtract onedoublearray from another, entry-by-entry.- Specified by:
minusin interfaceDoubleArrayOperation- Parameters:
arr1- an arraydouble[]arr2- an arraydouble[]- Returns:
- the difference of the two arrays
-
multiply
public double[] multiply(double[] arr1, double[] arr2)Description copied from interface:DoubleArrayOperationMultiply onedoublearray to another, entry-by-entry.- Specified by:
multiplyin interfaceDoubleArrayOperation- Parameters:
arr1- an arraydouble[]arr2- an arraydouble[]- Returns:
- the product of the two arrays
-
divide
public double[] divide(double[] arr1, double[] arr2)Description copied from interface:DoubleArrayOperationDivide onedoublearray by another, entry-by-entry.- Specified by:
dividein interfaceDoubleArrayOperation- Parameters:
arr1- an arraydouble[]arr2- an arraydouble[]- Returns:
- the quotient array
-
scaled
public double[] scaled(double[] arr, double c)Description copied from interface:DoubleArrayOperationScale each entry of adoublearray.- Specified by:
scaledin interfaceDoubleArrayOperation- Parameters:
arr- an arraydouble[]c- a scaling constant- Returns:
- the scaled array
-
-