Calculates the RMSD of all-to-all structure comparisons (distances),
given a set of superimposed atoms.

@param transformed
@return double RMSD
@see #getRMSD(MultipleAlignment)
497243
public static double getRMSD(List<Atom[]> transformed) {

		double sumSqDist = 0;
		int comparisons = 0;

		for (int r1 = 0; r1 < transformed.size(); r1++) {
			for (int c = 0; c < transformed.get(r1).length; c++) {
				Atom refAtom = transformed.get(r1)[c];
				if (refAtom == null)
					continue;

				double nonNullSqDist = 0;
				int nonNullLength = 0;
				for (int r2 = r1 + 1; r2 < transformed.size(); r2++) {
					Atom atom = transformed.get(r2)[c];
					if (atom != null) {
						nonNullSqDist += Calc.getDistanceFast(refAtom, atom);
						nonNullLength++;
					}
				}

				if (nonNullLength > 0) {
					comparisons++;
					sumSqDist += nonNullSqDist / nonNullLength;
				}
			}
		}
		return Math.sqrt(sumSqDist / comparisons);
	}
1055453
@Override
    public List<Metric> transform(QueryContext context, List<Metric> metrics) {
        if (metrics.size() == 1) {
            return rangeOfOneMetric(metrics.get(0));
        } else {
            return new MetricReducerOrMappingTransform(new RangeValueReducerOrMapping()).transform(context, metrics);
        }
    }
992550
public Transformation2D copy() {
		Transformation2D result = new Transformation2D();
		result.xx = xx;
		result.xy = xy;
		result.xd = xd;
		result.yx = yx;
		result.yy = yy;
		result.yd = yd;
		return result;
	}
73968
public static double getRmsdAtOrigin(Point3d[] fixed, Point3d[] moved) {
		superposer.setCentered(true);
		return superposer.getRmsd(fixed, moved);
	}
1319384
public double getBondLength() {
        PharmacophoreAtom atom1 = PharmacophoreAtom.get(getAtom(0));
        PharmacophoreAtom atom2 = PharmacophoreAtom.get(getAtom(1));
        return atom1.getPoint3d().distance(atom2.getPoint3d());
    }
415114
private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, AFPChain afpChain, Atom[] ca1, Atom[] ca2){



		Atom[] tmp1 = new Atom[focusResn];
		Atom[] tmp2 = new Atom[focusResn];

		for ( int i =0 ; i< focusResn;i++){
			tmp1[i] =       ca1[focusRes1[i]];
			tmp2[i] = (Atom)ca2[focusRes2[i]].clone();
			if (tmp1[i].getCoords() == null){
				System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]);
			}
			if (tmp2[i].getCoords() == null){
				System.err.println("tmp1 got null: " +i + " pos: " + focusRes2[i]);
			}
			//XX
			//tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone());
		}
		double rmsd = 99;
		try {
			rmsd = getRmsd(tmp1,tmp2);

		} catch (Exception e){
			e.printStackTrace();
		}
		return rmsd;

	}
366630
public static Matrix3d getRotationMatrix(Matrix4d transform) {

		Matrix3d rot = new Matrix3d();
		transform.setRotationScale(rot);
		return rot;
	}
1123927
def get_dual_rmetric( self, invert_h = False, mode_inv = 'svd' ):
        
        if self.H is None:
            self.H, self.G, self.Hvv, self.Hsvals, self.Gsvals = riemann_metric(self.Y, self.L, self.mdimG, invert_h = invert_h, mode_inv = mode_inv)
        if invert_h:
            return self.H, self.G
        else:
            return self.H
477831
@Override
	public List<Metric> transform(QueryContext queryContext, List<Metric> metrics, List<String> constants) {
		if (constants == null || constants.isEmpty()) {
			return transform(queryContext, metrics);
		}

		if (constants.size() == 1) {
			if (constants.get(0).toUpperCase().equals(FULLJOIN)){
				fulljoinIndicator=true;
				return transform(queryContext, metrics);
			}else if(constants.get(0).toUpperCase().equals(INTERSECT)) {
				fulljoinIndicator=false;
				return transform(queryContext, metrics);
			}
		}
		return mapping(metrics, constants);
	}
1142090
@Override
    public DescriptorValue calculate(IAtomContainer atomContainer) {
        IAtomContainer container;
        try {
            container = (IAtomContainer) atomContainer.clone();
            container = AtomContainerManipulator.removeHydrogens(container);
        } catch (CloneNotSupportedException e) {
            DoubleArrayResult result = new DoubleArrayResult(5);
            for (int i = 0; i < 5; i++)
                result.add(Double.NaN);
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                    getDescriptorNames(), new CDKException("Error during cloner: " + e.getMessage(), e));
        }

        try {
            double[] w = listConvertion(container);
            int natom = container.getAtomCount();
            int[][] distancematrix = TopologicalMatrix.getMatrix(container);
            double[] masSum = new double[5];

            for (int k = 0; k < 5; k++) {
                for (int i = 0; i < natom; i++) {
                    for (int j = 0; j < natom; j++) {

                        if (distancematrix[i][j] == k) {
                            masSum[k] += w[i] * w[j];
                        } else
                            masSum[k] += 0.0;
                    }
                }
                if (k > 0) masSum[k] = masSum[k] / 2;

            }
            DoubleArrayResult result = new DoubleArrayResult(5);
            for (double aMasSum : masSum) {
                result.add(aMasSum);
            }

            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                    getDescriptorNames());

        } catch (IOException | ClassNotFoundException ex) {
            DoubleArrayResult result = new DoubleArrayResult(5);
            for (int i = 0; i < 5; i++)
                result.add(Double.NaN);
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                    getDescriptorNames(), new CDKException("Error while calculating the ATS_mass descriptor: "
                            + ex.getMessage(), ex));
        }
    }
1157269
public Vector3d transformDirection(Vector3d dest) {
        dest.set(m00 * dest.x + m10 * dest.y + m20 * dest.z,
                 m01 * dest.x + m11 * dest.y + m21 * dest.z,
                 m02 * dest.x + m12 * dest.y + m22 * dest.z);
        return dest;
    }
1363588
public static double getRmsd(Point3d[] fixed, Point3d[] moved) {
		superposer.setCentered(false);
		return superposer.getRmsd(fixed, moved);
	}
600729
public void extractScaleTransform(Transformation2D scale,
			Transformation2D rotateNshearNshift) {

		scale.setScale(Math.sqrt(xx * xx + xy * xy),
				Math.sqrt(yx * yx + yy * yy));
		rotateNshearNshift.setScale(1.0 / scale.xx, 1.0 / scale.yy);
		rotateNshearNshift.multiply(this);
	}
1117957
@Override
    public DescriptorValue calculate(IAtomContainer atomContainer) {
        IAtomContainer ac = null;
        try {
            ac = (IAtomContainer) atomContainer.clone();
        } catch (CloneNotSupportedException e) {
            return getDummyDescriptorValue(e);
        }

        int carbonCount = 0;
        int heteroCount = 0;
        for (IAtom atom : ac.atoms()) {
            if (!Elements.HYDROGEN.getSymbol().equals(atom.getSymbol())) {
                if (Elements.CARBON.getSymbol().equals(atom.getSymbol())) {
                    carbonCount++;
                } else {
                    heteroCount++;
                }
            }
        }
        double mLogP = 1.46 + 0.11 * carbonCount - 0.11 * heteroCount;

        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(mLogP),
                getDescriptorNames());
    }
1115176
public double distance(Vector2D vector2d) {
		double a = vector2d.x - x;
		double b = vector2d.y - y;
		return Math.sqrt(a * a + b * b);
	}
1073488
public void getImageRelativeToViewAbsoluteTransform(Matrix outMatrix) {
    outMatrix.setRectToRect(IDENTITY_RECT, mTransformedImageBounds, Matrix.ScaleToFit.FILL);
  }
681852
public static double distance( LasRecord r1, LasRecord r2 ) {
        double distance = NumericsUtilities.pythagoras(r1.x - r2.x, r1.y - r2.y);
        return distance;
    }