/** * Returns metric tensor with specified indices. * * @param index1 first index * @param index2 second index * @return metric tensor with specified indices * @throws IllegalArgumentException if indices have different states * @throws IllegalArgumentException if indices have different types * @throws IllegalArgumentException if indices have non metric types */ public static SimpleTensor createMetric(int index1, int index2) { return CC.current().createMetric(index1, index2); }
/** * Returns metric tensor if specified indices have same states and * Kronecker tensor if specified indices have different states. * * @param index1 first index * @param index2 second index * @return metric tensor if specified indices have same states and * Kronecker tensor if specified indices have different states * @throws IllegalArgumentException if indices have different types * @throws IllegalArgumentException if indices have same states and non metric types */ public SimpleTensor createMetricOrKronecker(int index1, int index2) { if (IndicesUtils.getRawStateInt(index1) == IndicesUtils.getRawStateInt(index2)) return createMetric(index1, index2); return createKronecker(index1, index2); }