Apply the inverse transformation onto a vector

@param v vector of dimensionality dim
@return transformed vector of dimensionality dim
763820
public double[] applyInverse(double[] v) {
    if(inv == null) {
      updateInverse();
    }
    return unhomogeneVector(times(inv, homogeneVector(v)));
  }
1207320
public static double dotDense(NumberVector v1, NumberVector v2) {
    final int dim1 = v1.getDimensionality(), dim2 = v2.getDimensionality();
    final int mindim = (dim1 <= dim2) ? dim1 : dim2;
    double dot = 0;
    for(int k = 0; k < mindim; k++) {
      dot += v1.doubleValue(k) * v2.doubleValue(k);
    }
    return dot;
  }
1033378
public Vector4f set(Vector4fc v) {
        if (v instanceof Vector4f) {
            MemUtil.INSTANCE.copy((Vector4f) v, this);
        } else {
            this.x = v.x();
            this.y = v.y();
            this.z = v.z();
            this.w = v.w();
        }
        return this;
    }
443758
public Vector3d transform(Vector3dc vec, Vector3d dest) {
        return transform(vec.x(), vec.y(), vec.z(), dest);
    }
16445
public Vector3f transform(Vector3fc v, Vector3f dest) {
        double sin = Math.sin(angle);
        double cos = Math.cosFromSin(sin, angle);
        float dot = x * v.x() + y * v.y() + z * v.z();
        dest.set((float) (v.x() * cos + sin * (y * v.z() - z * v.y()) + (1.0 - cos) * dot * x),
                 (float) (v.y() * cos + sin * (z * v.x() - x * v.z()) + (1.0 - cos) * dot * y),
                 (float) (v.z() * cos + sin * (x * v.y() - y * v.x()) + (1.0 - cos) * dot * z));
        return dest;
    }
1281069
public Vector4f set(Vector3fc v, float w) {
        return set(v.x(), v.y(), v.z(), w);
    }
629396
public Vector3d set(Vector3dc v) {
        return set(v.x(), v.y(), v.z());
    }
773153
private static ValidationMessage[] vmFromVector(Vector v) {
        ValidationMessage[] vm = new ValidationMessage[v.size()];
        for (int i = 0; i < vm.length; i++) {
            vm[i] = (ValidationMessage) v.get(i);
        }
        return vm;
    }
576522
public Vector4f transform(float x, float y, float z, float w, Vector4f dest) {
       dest.x = x;
       dest.y = y;
       dest.z = z;
       dest.w = w;
       return dest.mul(this);
    }
1320389
@Override
    public double[] transform(double[] x) {
        if (x.length != scale.length) {
            throw new IllegalArgumentException(String.format("Invalid vector size %d, expected %d", x.length, scale.length));
        }

        double[] y = copy ? new double[x.length] : x;
        for (int i = 0; i < x.length; i++) {
            y[i] = x[i] / scale[i];
        }

        return y;
    }
1061390
public static void inverse(Transformation3D src, Transformation3D result) {
		double det = src.xx * (src.yy * src.zz - src.zy * src.yz) - src.yx
				* (src.xy * src.zz - src.zy * src.xz) + src.zx
				* (src.xy * src.yz - src.yy * src.xz);
		if (det != 0) {
			double xx, yx, zx;
			double xy, yy, zy;
			double xz, yz, zz;
			double xd, yd, zd;

			double det_1 = 1.0 / det;
			xx = (src.yy * src.zz - src.zy * src.yz) * det_1;
			xy = -(src.xy * src.zz - src.zy * src.xz) * det_1;
			xz = (src.xy * src.yz - src.yy * src.xz) * det_1;

			yx = -(src.yx * src.zz - src.yz * src.zx) * det_1;
			yy = (src.xx * src.zz - src.zx * src.xz) * det_1;
			yz = -(src.xx * src.yz - src.yx * src.xz) * det_1;

			zx = (src.yx * src.zy - src.zx * src.yy) * det_1;
			zy = -(src.xx * src.zy - src.zx * src.xy) * det_1;
			zz = (src.xx * src.yy - src.yx * src.xy) * det_1;

			xd = -(src.xd * xx + src.yd * xy + src.zd * xz);
			yd = -(src.xd * yx + src.yd * yy + src.zd * yz);
			zd = -(src.xd * zx + src.yd * zy + src.zd * zz);

			result.xx = xx;
			result.yx = yx;
			result.zx = zx;
			result.xy = xy;
			result.yy = yy;
			result.zy = zy;
			result.xz = xz;
			result.yz = yz;
			result.zz = zz;
			result.xd = xd;
			result.yd = yd;
			result.zd = zd;
		} else {
			throw new GeometryException("math singularity");
		}
	}
872062
public Vector2d add(Vector2fc v, Vector2d dest) {
        dest.x = x + v.x();
        dest.y = y + v.y();
        return dest;
    }
147817
public Vector3d set(Vector2ic v, double z) {
        return set(v.x(), v.y(), z);
    }
1227979
public Vector4f transform(float x, float y, float z, Vector4f dest) {
        float w2 = this.w * this.w;
        float x2 = this.x * this.x;
        float y2 = this.y * this.y;
        float z2 = this.z * this.z;
        float zw = this.z * this.w, zwd = zw + zw;
        float xy = this.x * this.y, xyd = xy + xy;
        float xz = this.x * this.z, xzd = xz + xz;
        float yw = this.y * this.w, ywd = yw + yw;
        float yz = this.y * this.z, yzd = yz + yz;
        float xw = this.x * this.w, xwd = xw + xw;
        float m00 = w2 + x2 - z2 - y2;
        float m01 = xyd + zwd;
        float m02 = xzd - ywd;
        float m10 = xyd - zwd;
        float m11 = y2 - z2 + w2 - x2;
        float m12 = yzd + xwd;
        float m20 = ywd + xzd;
        float m21 = yzd - xwd;
        float m22 = z2 - y2 - x2 + w2;
        dest.x = m00 * x + m10 * y + m20 * z;
        dest.y = m01 * x + m11 * y + m21 * z;
        dest.z = m02 * x + m12 * y + m22 * z;
        return dest;
    }
927322
public Vector3f transformDirection(Vector3fc v, Vector3f dest) {
        dest.set(m00 * v.x() + m10 * v.y() + m20 * v.z(),
                 m01 * v.x() + m11 * v.y() + m21 * v.z(),
                 m02 * v.x() + m12 * v.y() + m22 * v.z());
        return dest;
    }
374463
public Vector3d set(Vector3ic v) {
        return set(v.x(), v.y(), v.z());
    }
411535
public static double[] plus(final double[] v1, final double[] v2) {
    assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
    final double[] result = new double[v1.length];
    for(int i = 0; i < result.length; i++) {
      result[i] = v1[i] + v2[i];
    }
    return result;
  }