Dxpy.java
package org.mklab.sdpj.gpack.blaswrap;
import org.mklab.nfc.matrix.ComplexNumericalMatrix;
import org.mklab.nfc.matrix.RealNumericalMatrix;
import org.mklab.nfc.scalar.ComplexNumericalScalar;
import org.mklab.nfc.scalar.RealNumericalScalar;
/**
* @author koga
* @version $Revision$, 2009/04/24
* @param <RS> 実スカラーの型
* @param <RM> 実行列の型
* @param <CS> 複素スカラーの型
* @param <CM> 複素行列の型
*/
public class Dxpy<RS extends RealNumericalScalar<RS, RM, CS, CM>, RM extends RealNumericalMatrix<RS, RM, CS, CM>, CS extends ComplexNumericalScalar<RS, RM, CS, CM>, CM extends ComplexNumericalMatrix<RS, RM, CS, CM>> {
/**
* vector plus a vector.
*
* @param size 成分の数
* @param x x
* @param incx x成分の指数の増分
* @param y y
* @param incy y成分の指数の増分
*/
void dxpy(int size, RS[] x, int incx, RS[] y, int incy) {
if (incx == 1 && incy == 1) {
for (int i = 0; i < size; i++) {
y[i] = y[i].add(x[i]);
}
return;
}
int ix = 0;
int iy = 0;
if (incx < 0) {
ix = (-(size) + 1) * incx;
}
if (incy < 0) {
iy = (-(size) + 1) * incy;
}
for (int i = 1; i <= size; ++i) {
y[iy] = y[iy].add(x[ix]);
ix += incx;
iy += incy;
}
}
}