Converts an Earth-Centered Earth-Fixed (ECEF) coordinate to ENU.

@param cEcef the ECEF coordinate.
@return the ENU coordinate.
@throws MatrixException
766847
public Coordinate ecefToEnu( Coordinate cEcef ) {
        double deltaX = cEcef.x - _ecefROriginX;
        double deltaY = cEcef.y - _ecefROriginY;
        double deltaZ = cEcef.z - _ecefROriginZ;

        double[][] deltas = new double[][]{{deltaX}, {deltaY}, {deltaZ}};
        RealMatrix deltaMatrix = MatrixUtils.createRealMatrix(deltas);

        RealMatrix enuMatrix = _rotationMatrix.multiply(deltaMatrix);
        double[] column = enuMatrix.getColumn(0);

        return new Coordinate(column[0], column[1], column[2]);
    }
183402
@SuppressWarnings({ "unchecked", "rawtypes" })
    public Enum<?> findEnumValue(final String enumRef) {
        int sep = enumRef.lastIndexOf('/');
        if (sep == -1) {
            throw new JsiiException("Malformed enum reference: " + enumRef);
        }

        String typeName = enumRef.substring(0, sep);
        String valueName = enumRef.substring(sep + 1);
        try {
            Class klass = resolveJavaClass(typeName);
            return Enum.valueOf(klass, valueName);
        } catch (final ClassNotFoundException e) {
            throw new JsiiException("Unable to resolve enum type " + typeName, e);
        }
    }
494583
protected void addNamespaceContext() {
        NamespaceMap prefixmap = new NamespaceMap();
        NamespacePrefixList npl = getXsd().getNamespaceContext();
        if (npl == null) {
            /* We get an NPE if we don't add this. */
            prefixmap.add("", XMLConstants.W3C_XML_SCHEMA_NS_URI);
        } else {
            for (int i = 0; i < npl.getDeclaredPrefixes().length; i++) {
                prefixmap.add(npl.getDeclaredPrefixes()[i],
                        npl.getNamespaceURI(npl.getDeclaredPrefixes()[i]));
            }
        }
        prefixmap.add(getCOXBNamespacePrefix(), getCOXBNamespace());
        getXsd().setNamespaceContext(prefixmap);

    }
240960
@Pure
	@SuppressWarnings("checkstyle:cyclomaticcomplexity")
	public static Class<? extends MapElement> fromESRI(ShapeElementType type) {
		switch (type) {
		case MULTIPOINT:
		case MULTIPOINT_M:
		case MULTIPOINT_Z:
			return MapMultiPoint.class;
		case POINT:
		case POINT_M:
		case POINT_Z:
			return MapPoint.class;
		case POLYGON:
		case POLYGON_M:
		case POLYGON_Z:
			return MapPolygon.class;
		case POLYLINE:
		case POLYLINE_M:
		case POLYLINE_Z:
			return MapPolyline.class;
			//$CASES-OMITTED$
		default:
		}
		throw new IllegalArgumentException();
	}
1259653
private Intrinsic solveForCalibration(DMatrixRMaj w) {
		Intrinsic calib = new Intrinsic();

//		CholeskyDecomposition_F64<DMatrixRMaj> chol = DecompositionFactory_DDRM.chol(false);
//
//		chol.decompose(w.copy());
//		DMatrixRMaj R = chol.getT(w);
//		R.print();

		if( zeroSkew ) {
			calib.skew = 0;
			calib.fy = Math.sqrt(w.get(1,1));

			if( knownAspect ) {
				calib.fx = calib.fy/aspectRatio;
			} else {
				calib.fx = Math.sqrt(w.get(0,0));
			}
		} else if( knownAspect ) {
			calib.fy = Math.sqrt(w.get(1,1));
			calib.fx = calib.fy/aspectRatio;
			calib.skew = w.get(0,1)/calib.fy;
		} else {
			calib.fy = Math.sqrt(w.get(1,1));
			calib.skew = w.get(0,1)/calib.fy;
			calib.fx = Math.sqrt(w.get(0,0) - calib.skew*calib.skew);
		}
		return calib;
	}
662624
private static Map<byte[], byte[]> createCfRenameMap(Configuration conf) {
    Map<byte[], byte[]> cfRenameMap = null;
    String allMappingsPropVal = conf.get(CF_RENAME_PROP);
    if(allMappingsPropVal != null) {
      // The conf value format should be sourceCf1:destCf1,sourceCf2:destCf2,...
      String[] allMappings = allMappingsPropVal.split(",");
      for (String mapping: allMappings) {
        if(cfRenameMap == null) {
            cfRenameMap = new TreeMap<byte[],byte[]>(Bytes.BYTES_COMPARATOR);
        }
        String [] srcAndDest = mapping.split(":");
        if(srcAndDest.length != 2) {
            continue;
        }
        cfRenameMap.put(srcAndDest[0].getBytes(), srcAndDest[1].getBytes());
      }
    }
    return cfRenameMap;
  }
1149171
def c_to_n(self, c_interval):
        """"""

        if self.cds_start_i is None:    # cds_start_i defined iff cds_end_i defined; see assertion above
            raise HGVSUsageError(
                "CDS is undefined for {self.tx_ac}; cannot map from c. coordinate (non-coding transcript?)"
                .format(self=self))

        # start
        if c_interval.start.datum == Datum.CDS_START and c_interval.start.base < 0:
            rs = c_interval.start.base + self.cds_start_i + 1
        elif c_interval.start.datum == Datum.CDS_START and c_interval.start.base > 0:
            rs = c_interval.start.base + self.cds_start_i
        elif c_interval.start.datum == Datum.CDS_END:
            rs = c_interval.start.base + self.cds_end_i
        # end
        if c_interval.end.datum == Datum.CDS_START and c_interval.end.base < 0:
            re = c_interval.end.base + self.cds_start_i + 1
        elif c_interval.end.datum == Datum.CDS_START and c_interval.end.base > 0:
            re = c_interval.end.base + self.cds_start_i
        elif c_interval.end.datum == Datum.CDS_END:
            re = c_interval.end.base + self.cds_end_i

        if rs <= 0 or re > self.tgt_len:
            raise HGVSError("The given coordinate is outside the bounds of the reference sequence.")

        n_interval = hgvs.location.BaseOffsetInterval(
            start=hgvs.location.BaseOffsetPosition(
                base=rs, offset=c_interval.start.offset, datum=Datum.SEQ_START),
            end=hgvs.location.BaseOffsetPosition(
                base=re, offset=c_interval.end.offset, datum=Datum.SEQ_START),
            uncertain=c_interval.uncertain)
        return n_interval
138663
@Override
	public AFPChain align(Atom[] ca1, Atom[] ca2, Object param) throws StructureException{
		if ( ! (param instanceof CeParameters))
			throw new IllegalArgumentException("CE algorithm needs an object of call CeParameters as argument.");

		params = (CeParameters) param;

		// we don't want to rotate input atoms, do we?
		ca2clone = new Atom[ca2.length];

		int pos = 0;
		for (Atom a : ca2){
			Group g = (Group)a.getGroup().clone(); // works because each group has only a CA atom

			ca2clone[pos] = g.getAtom(a.getName());

			pos++;
		}

		calculator = new CECalculator(params);

		//Build alignment ca1 to ca2-ca2
		AFPChain afpChain = new AFPChain(algorithmName);
		afpChain = calculator.extractFragments(afpChain, ca1, ca2clone);
		calculator.traceFragmentMatrix( afpChain,ca1, ca2clone);
		calculator.nextStep( afpChain,ca1, ca2clone);

		afpChain.setAlgorithmName(getAlgorithmName());
		afpChain.setVersion(version);

		// Try to guess names

		if (ca1.length!=0 && ca1[0].getGroup().getChain()!=null && ca1[0].getGroup().getChain().getStructure()!=null)
			afpChain.setName1(ca1[0].getGroup().getChain().getStructure().getName());

		if (ca2.length!=0 && ca2[0].getGroup().getChain()!=null && ca2[0].getGroup().getChain().getStructure()!=null)
			afpChain.setName2(ca2[0].getGroup().getChain().getStructure().getName());

		if ( afpChain.getNrEQR() == 0)
		   return afpChain;

		// Set the distance matrix

		int winSize = params.getWinSize();
		int winSizeComb1 = (winSize-1)*(winSize-2)/2;
		double[][] m = calculator.initSumOfDistances(ca1.length, ca2.length, winSize, winSizeComb1, ca1, ca2clone);
		afpChain.setDistanceMatrix(new Matrix(m));
		afpChain.setSequentialAlignment(true);

		return afpChain;
	}
1118002
public final long previousCE(UVector32 offsets) {
        if(ceBuffer.length > 0) {
            // Return the previous buffered CE.
            return ceBuffer.get(--ceBuffer.length);
        }
        offsets.removeAllElements();
        int limitOffset = getOffset();
        int c = previousCodePoint();
        if(c < 0) { return Collation.NO_CE; }
        if(data.isUnsafeBackward(c, isNumeric)) {
            return previousCEUnsafe(c, offsets);
        }
        // Simple, safe-backwards iteration:
        // Get a CE going backwards, handle prefixes but no contractions.
        int ce32 = data.getCE32(c);
        CollationData d;
        if(ce32 == Collation.FALLBACK_CE32) {
            d = data.base;
            ce32 = d.getCE32(c);
        } else {
            d = data;
        }
        if(Collation.isSimpleOrLongCE32(ce32)) {
            return Collation.ceFromCE32(ce32);
        }
        appendCEsFromCE32(d, c, ce32, false);
        if(ceBuffer.length > 1) {
            offsets.addElement(getOffset());
            // For an expansion, the offset of each non-initial CE is the limit offset,
            // consistent with forward iteration.
            while(offsets.size() <= ceBuffer.length) {
                offsets.addElement(limitOffset);
            };
        }
        return ceBuffer.get(--ceBuffer.length);
    }
426259
private static void addEcc(int[] fullstream, int[] datastream, int version, int data_cw, int blocks) {

        int ecc_cw = QR_TOTAL_CODEWORDS[version - 1] - data_cw;
        int short_data_block_length = data_cw / blocks;
        int qty_long_blocks = data_cw % blocks;
        int qty_short_blocks = blocks - qty_long_blocks;
        int ecc_block_length = ecc_cw / blocks;
        int i, j, length_this_block, posn;

        int[] data_block = new int[short_data_block_length + 2];
        int[] ecc_block = new int[ecc_block_length + 2];
        int[] interleaved_data = new int[data_cw + 2];
        int[] interleaved_ecc = new int[ecc_cw + 2];

        posn = 0;

        for (i = 0; i < blocks; i++) {
            if (i < qty_short_blocks) {
                length_this_block = short_data_block_length;
            } else {
                length_this_block = short_data_block_length + 1;
            }

            for (j = 0; j < ecc_block_length; j++) {
                ecc_block[j] = 0;
            }

            for (j = 0; j < length_this_block; j++) {
                data_block[j] = datastream[posn + j];
            }

            ReedSolomon rs = new ReedSolomon();
            rs.init_gf(0x11d);
            rs.init_code(ecc_block_length, 0);
            rs.encode(length_this_block, data_block);

            for (j = 0; j < ecc_block_length; j++) {
                ecc_block[j] = rs.getResult(j);
            }

            for (j = 0; j < short_data_block_length; j++) {
                interleaved_data[(j * blocks) + i] = data_block[j];
            }

            if (i >= qty_short_blocks) {
                interleaved_data[(short_data_block_length * blocks) + (i - qty_short_blocks)] = data_block[short_data_block_length];
            }

            for (j = 0; j < ecc_block_length; j++) {
                interleaved_ecc[(j * blocks) + i] = ecc_block[ecc_block_length - j - 1];
            }

            posn += length_this_block;
        }

        for (j = 0; j < data_cw; j++) {
            fullstream[j] = interleaved_data[j];
        }
        for (j = 0; j < ecc_cw; j++) {
            fullstream[j + data_cw] = interleaved_ecc[j];
        }
    }
533949
public static AffineTransformation getWorldToRectangle( Envelope worldEnvelope, Rectangle pixelRectangle ) {
        int cols = (int) pixelRectangle.getWidth();
        int rows = (int) pixelRectangle.getHeight();
        double worldWidth = worldEnvelope.getWidth();
        double worldHeight = worldEnvelope.getHeight();

        double x = -worldEnvelope.getMinX();
        double y = -worldEnvelope.getMinY();
        AffineTransformation translate = AffineTransformation.translationInstance(x, y);
        double xScale = cols / worldWidth;
        double yScale = rows / worldHeight;
        AffineTransformation scale = AffineTransformation.scaleInstance(xScale, yScale);

        int m00 = 1;
        int m10 = 0;
        int m01 = 0;
        int m11 = -1;
        int m02 = 0;
        int m12 = rows;
        AffineTransformation mirror_y = new AffineTransformation(m00, m01, m02, m10, m11, m12);

        AffineTransformation world2pixel = new AffineTransformation(translate);
        world2pixel.compose(scale);
        world2pixel.compose(mirror_y);
        return world2pixel;
    }
1298045
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "geocentricCRSRef")
    public JAXBElement<GeocentricCRSRefType> createGeocentricCRSRef(GeocentricCRSRefType value) {
        return new JAXBElement<GeocentricCRSRefType>(_GeocentricCRSRef_QNAME, GeocentricCRSRefType.class, null, value);
    }
1105840
public static void elementExp(DMatrixD1 A , DMatrixD1 C ) {

        if( A.numCols != C.numCols || A.numRows != C.numRows ) {
            throw new MatrixDimensionException("All matrices must be the same shape");
        }

        int size = A.getNumElements();
        for( int i = 0; i < size; i++ ) {
            C.data[i] = Math.exp(A.data[i]);
        }
    }
300226
Envelope2D getEnvelope2D() {
		Envelope2D env = new Envelope2D();
		env.setEmpty();
		VertexIterator vert_iter = queryVertexIterator();
		Point2D pt = new Point2D();
		boolean b_first = true;
		for (int ivertex = vert_iter.next(); ivertex != -1; ivertex = vert_iter
				.next()) {
			getXY(ivertex, pt);
			if (b_first)
				env.merge(pt.x, pt.y);
			else
				env.mergeNE(pt.x, pt.y);

			b_first = false;
		}

		return env;
	}
579920
def laea2cf(area):
    """"""
    proj_dict = area.proj_dict
    args = dict(latitude_of_projection_origin=proj_dict.get('lat_0'),
                longitude_of_projection_origin=proj_dict.get('lon_0'),
                grid_mapping_name='lambert_azimuthal_equal_area',
                )
    return args
2479
@Nonnull
    public static String[] mapToEnv(@Nonnull Map<String,String> m) {
        String[] r = new String[m.size()];
        int idx=0;

        for (final Map.Entry<String,String> e : m.entrySet()) {
            r[idx++] = e.getKey() + '=' + e.getValue();
        }
        return r;
    }
681239
public static <E extends Enum<E>> EnumCliParam<E> fromDef(EnumParamDef<E> def) {
        return new EnumCliParam<>(def.getIdentifier(), def.getDefaultValueSupplier(), def.isNullable(), def.getEnumClass());
    }