fun superposeWithAngle( vec1: ComplexVector, vec2: ComplexVector, weight: Float, permutation: IntArray? ) { var positionToAdd: Int val dim: Int = vec1.getDimension() val c: ShortArray = vec2.getPhaseAngles() val coordinates: FloatArray = vec1.getCoordinates() if (permutation != null) { for (i in 0 until dim) { positionToAdd = permutation[i] shl 1 coordinates[positionToAdd] += CircleLookupTable.getRealEntry(c[i]) * weight coordinates[positionToAdd + 1] += CircleLookupTable.getImagEntry(c[i]) * weight } } else { for (i in 0 until dim) { positionToAdd = i shl 1 coordinates[positionToAdd] += CircleLookupTable.getRealEntry(c[i]) * weight coordinates[positionToAdd + 1] += CircleLookupTable.getImagEntry(c[i]) * weight } } }
Superposes vec2 with vec1 with weight and permutation . vec1 is in CARTESIAN mode . vec2 is in POLAR mode .