zhao.algorithmMagic.operands.vector.ASVector Maven / Gradle / Ivy
package zhao.algorithmMagic.operands.vector;
/**
* 算法之星的向量抽象类,其中提供了两个针对性能设计的方法
* 1 在原有向量数据的基础上进行向量计算的三个函数
* 2 使用行指针锁来进行矩阵计算的三个函数(注意 矩阵中的数据是不可变的,所以这里在矩阵中,下面三个函数提升计算的安全性)
*
* @author zhao
*/
public abstract class ASVector extends Vector {
/**
* 刷新操作数对象的所有字段
*/
protected abstract void reFresh();
/**
* @return 将本对象中存储的向量序列的数组直接返回,注意,这里返回的是一个正在被维护的数组,因此建议保证返回值作为只读变量使用。
*
* Return the array of vector sequences stored in this object directly. Note that the returned value is an array being maintained. Therefore, it is recommended to ensure that the returned value is used as a read-only variable.
*/
public abstract ArrayType toArray();
/**
* 在两个向量对象之间进行计算的函数,自从1.13版本开始支持该函数的调用,该函数中的计算并不会产生一个新的向量,而是将计算操作作用于原操作数中
*
* The function that calculates between two vector objects supports the call of this function since version 1.13. The calculation in this function will not generate a new vector, but will apply the calculation operation to the original operand
*
* @param value 与当前向量一起进行计算的另一个向量对象。
*
* Another vector object that is evaluated with the current vector.
* @param ModifyCaller 计算操作作用对象的设置,该参数如果为true,那么计算时针对向量序列的修改操作将会直接作用到调用函数的向量中,反之将会作用到被操作数中。
*
* The setting of the calculation operation action object. If this parameter is true, the modification of the vector sequence during calculation will directly affect the vector of the calling function, and vice versa.
* @return 两个向量经过了按维度求和计算之后,被修改的向量对象
*/
public abstract ImplementationType add(ImplementationType value, boolean ModifyCaller);
/**
* 在两个向量对象之间进行计算的函数,自从1.13版本开始支持该函数的调用,该函数中的计算并不会产生一个新的向量,而是将计算操作作用于原操作数中
*
* The function that calculates between two vector objects supports the call of this function since version 1.13. The calculation in this function will not generate a new vector, but will apply the calculation operation to the original operand
*
* @param value 与当前向量一起进行计算的另一个向量对象。
*
* Another vector object that is evaluated with the current vector.
* @param ModifyCaller 计算操作作用对象的设置,该参数如果为true,那么计算时针对向量序列的修改操作将会直接作用到调用函数的向量中,反之将会作用到被操作数中。
*
* The setting of the calculation operation action object. If this parameter is true, the modification of the vector sequence during calculation will directly affect the vector of the calling function, and vice versa.
* @return 两个向量经过了按维度的减法计算之后,被修改的向量对象
*/
public abstract ImplementationType diff(ImplementationType value, boolean ModifyCaller);
/**
* 在两个向量对象之间进行计算的函数,自从1.13版本开始支持该函数的调用,该函数中的计算并不会产生一个新的向量,而是将计算操作作用于原操作数中
*
* The function that calculates between two vector objects supports the call of this function since version 1.13. The calculation in this function will not generate a new vector, but will apply the calculation operation to the original operand
*
* @param value 与当前向量一起进行计算的另一个向量对象。
*
* Another vector object that is evaluated with the current vector.
* @param ModifyCaller 计算操作作用对象的设置,该参数如果为true,那么计算时针对向量序列的修改操作将会直接作用到调用函数的向量中,反之将会作用到被操作数中。
*
* The setting of the calculation operation action object. If this parameter is true, the modification of the vector sequence during calculation will directly affect the vector of the calling function, and vice versa.
* @return 两个向量经过了按维度的减法计算之后,被修改的向量对象
*/
public abstract ImplementationType diffAbs(ImplementationType value, boolean ModifyCaller);
/**
* 在两个向量对象之间进行计算的函数,自从1.13版本开始支持该函数的调用,该函数中的计算并不会产生一个新的向量,而是将计算操作作用于原操作数中
*
* The function that calculates between two vector objects supports the call of this function since version 1.13. The calculation in this function will not generate a new vector, but will apply the calculation operation to the original operand
*
* @param value 与当前向量一起进行计算的另一个向量对象。
*
* Another vector object that is evaluated with the current vector.
* @param ModifyCaller 计算操作作用对象的设置,该参数如果为true,那么计算时针对向量序列的修改操作将会直接作用到调用函数的向量中,反之将会作用到被操作数中。
*
* The setting of the calculation operation action object. If this parameter is true, the modification of the vector sequence during calculation will directly affect the vector of the calling function, and vice versa.
* @return 两个向量经过了外积计算之后,被修改的向量对象
*/
public abstract ImplementationType multiply(ImplementationType value, boolean ModifyCaller);
/**
* 将数据所维护的数组左移n个位置,并获取到结果数值
*
* Move the array maintained by the data to the left n positions and get the result value
*
* @param n 被左移的次数,该数值应取值于 [0, getNumberOfDimensions]
*
* The number of times it is moved to the left. The value should be [0, getNumberOfDimensions]
* @param copy 本次左移的作用参数,如果设置为true,代表本次位移会创建出一个新的数组,于当前数组毫无关联。
*
* If the action parameter of this left shift is set to true, it means that this shift will create a new array, which has no association with the current array.
* @return 位移之后的AS操作数对象,其类型与调用者数据类型一致。
*
* The AS operand object after displacement has the same type as the caller data type.
*/
public abstract ImplementationType leftShift(int n, boolean copy);
/**
* 将数据所维护的数组右移n个位置,并获取到结果数值
*
* Move the array maintained by the data to the right n positions and get the result value
*
* @param n 被右移的次数,该数值应取值于 [0, getNumberOfDimensions]
*
* The number of times it is moved to the right. The value should be [0, getNumberOfDimensions]
* @param copy 本次右移的作用参数,如果设置为true,代表本次位移会创建出一个新的数组,于当前数组毫无关联。
*
* If the action parameter of this right shift is set to true, it means that this shift will create a new array, which has no association with the current array.
* @return 位移之后的AS操作数对象,其类型与调用者数据类型一致。
*
* The AS operand object after displacement has the same type as the caller data type.
*/
public abstract ImplementationType rightShift(int n, boolean copy);
/**
* 将当前对象中的元素从左向右的方向进行元素索引为宗旨的反转,实现更多的效果。
*
* Invert the element index of the current object from left to right to achieve more results.
*
* @param isCopy 如果设置为true 代表反转操作会作用到一个新数组中,并不会更改源数组中的元素位置。反之则是直接更改源数组。
*
* If set to true, the inversion operation will be applied to a new array, and the position of the elements in the source array will not be changed. On the contrary, you can directly change the source array.
* @return 被反转之后的对象,该对象的数据类型与函数调用者是一致的。
*
* The data type of the reversed object is the same as that of the function caller.
*/
public abstract ImplementationType reverseLR(boolean isCopy);
}