Class TestUtilsQuantumChannel
java.lang.Object
com.polytechnik.kgo.TestUtilsQuantumChannel
A class to store util functions for quantum channel unit tests.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]
calcualteppSKfromMappings
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) static double[]
calcualteScaleRho2SKfromMappings
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) static double[]
calcualteSKequivBs
(int nC, int nX, double[][] B) Construct SK (of rankB.length
) corresponding to quantum channel B.static double[]
calcualteSKequivSelectedSolutions
(int nC, int nX, AlgebraicResult[] h) Construct SK (of rankh.length
) corresponding to a hierarchy of unitary operators.private static double[]
calcualteSKppFromMappings
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, ToDoubleBiFunction<double[], double[]> scaleFactor) static double[]
calcualteSKvfromMappings
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) createSqrtDMmappingsFromDM
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) generateDMMappings
(int nC, int nX, double[][] B, List<double[]> rhosIn) static List
<double[]> generateRandomDMList
(int n, Random r, int rank, int nSample) static double[]
generateRandomDMState
(int n, int rank, Random r) static double[]
generateRandomOrthogonalMatrix
(int n, Random r) static double[][]
generateRandomQuantumChannel
(int nS, int nC, int nX, Random r) Creates orthogonal random Kraus mapping.static double
getFidelity
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) private static double
getFidelityCalculation
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B, boolean flagSquareResult) static double
getFpp
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) static double
getFrobeniusDiffDM
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) static double
getFscaleRho2
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) private static double
getFsimple
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B, ToDoubleBiFunction<double[], double[]> scaleFactor) static double
getFv
(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) private static double
maxElementDiff
(double[] m1, double[] m2) static void
Print single matrix.private static double
sqrtLam
(int ind, double lam) (package private) static void
testBasisOrthogonality
(double[][] basis, double eps) static void
testBCanonical
(int nC, int nX, double[][] B, double eps) (package private) static void
testBCanonical
(int nS, int nC, int nX, double[] b, double eps) static void
testBOrthogonality
(int nC, int nX, double[][] B, double eps) (package private) static void
testBOrthogonality
(int nS, int nC, int nX, double[] b, double eps) static void
testLinearConstraints
(double[] u, double[][] linearConstraints, double eps) static void
testOrthogonality
(String txt, int nC, int nX, double[] basis, double eps) private static void
testOrthogonality
(String txt, int nC, int nX, double[] basis, double eps, boolean flagTestDiag) (package private) static void
testOrthogonalitySkipDiagCheck
(String txt, int nC, int nX, double[] basis, double eps) static double[][]
toArrayOfArrays
(int nS, int nC, int nX, double[] b) static double[]
toSingleArray
(int nC, int nX, double[][] B) static double[]
transformDMThroughQuantumChannel
(int nC, int nX, double[][] B, double[] rho) static double
uMatrixDiff
(double[] m1, double[] m2) Check matrix diff withing a +- sign.
-
Constructor Details
-
TestUtilsQuantumChannel
public TestUtilsQuantumChannel()
-
-
Method Details
-
transformDMThroughQuantumChannel
public static double[] transformDMThroughQuantumChannel(int nC, int nX, double[][] B, double[] rho) -
generateRandomDMState
-
generateRandomOrthogonalMatrix
-
generateRandomDMList
-
generateDMMappings
public static List<TestUtilsQuantumChannel.MappingDM> generateDMMappings(int nC, int nX, double[][] B, List<double[]> rhosIn) -
sqrtLam
private static double sqrtLam(int ind, double lam) -
createSqrtDMmappingsFromDM
public static List<TestUtilsQuantumChannel.MappingDM> createSqrtDMmappingsFromDM(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) -
generateRandomQuantumChannel
Creates orthogonal random Kraus mapping. -
testBCanonical
static void testBCanonical(int nS, int nC, int nX, double[] b, double eps) -
testBCanonical
public static void testBCanonical(int nC, int nX, double[][] B, double eps) -
testBOrthogonality
static void testBOrthogonality(int nS, int nC, int nX, double[] b, double eps) -
testBOrthogonality
public static void testBOrthogonality(int nC, int nX, double[][] B, double eps) -
testBasisOrthogonality
static void testBasisOrthogonality(double[][] basis, double eps) -
testLinearConstraints
public static void testLinearConstraints(double[] u, double[][] linearConstraints, double eps) -
testOrthogonality
-
testOrthogonalitySkipDiagCheck
-
testOrthogonality
private static void testOrthogonality(String txt, int nC, int nX, double[] basis, double eps, boolean flagTestDiag) -
getFrobeniusDiffDM
public static double getFrobeniusDiffDM(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) -
getFidelity
public static double getFidelity(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) -
getFidelityCalculation
private static double getFidelityCalculation(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B, boolean flagSquareResult) -
getFsimple
private static double getFsimple(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B, ToDoubleBiFunction<double[], double[]> scaleFactor) -
getFpp
public static double getFpp(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) -
calcualteppSKfromMappings
public static double[] calcualteppSKfromMappings(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) -
getFscaleRho2
public static double getFscaleRho2(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) -
calcualteScaleRho2SKfromMappings
public static double[] calcualteScaleRho2SKfromMappings(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) -
getFv
public static double getFv(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, double[][] B) -
calcualteSKvfromMappings
public static double[] calcualteSKvfromMappings(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping) -
calcualteSKppFromMappings
private static double[] calcualteSKppFromMappings(int nC, int nX, List<TestUtilsQuantumChannel.MappingDM> dmMapping, ToDoubleBiFunction<double[], double[]> scaleFactor) -
calcualteSKequivBs
public static double[] calcualteSKequivBs(int nC, int nX, double[][] B) Construct SK (of rankB.length
) corresponding to quantum channel B. -
calcualteSKequivSelectedSolutions
Construct SK (of rankh.length
) corresponding to a hierarchy of unitary operators. -
maxElementDiff
private static double maxElementDiff(double[] m1, double[] m2) -
uMatrixDiff
public static double uMatrixDiff(double[] m1, double[] m2) Check matrix diff withing a +- sign. -
printU
Print single matrix. -
toSingleArray
public static double[] toSingleArray(int nC, int nX, double[][] B) -
toArrayOfArrays
public static double[][] toArrayOfArrays(int nS, int nC, int nX, double[] b)
-