当前位置: 首页>>代码示例>>Java>>正文


Java DenseMatrix64F.wrap方法代码示例

本文整理汇总了Java中org.ejml.data.DenseMatrix64F.wrap方法的典型用法代码示例。如果您正苦于以下问题:Java DenseMatrix64F.wrap方法的具体用法?Java DenseMatrix64F.wrap怎么用?Java DenseMatrix64F.wrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ejml.data.DenseMatrix64F的用法示例。


在下文中一共展示了DenseMatrix64F.wrap方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillInMeanForTaxon

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
private InversionResult fillInMeanForTaxon(final WrappedVector output, final DenseMatrix64F precision, final int taxon) {

        final double[] observed = observedIndicators[taxon];
        final Parameter Y = traitParameter.getParameter(taxon);

        // Solve for a value \mu_i s.t. P_i \mu_i = (L D_i Y_i)

        final double[] tmp = new double[numFactors];
        final double[] tmp2 = new double[numFactors];

        for (int row = 0; row < numFactors; ++row) {
            double sum = 0;
            for (int k = 0; k < dimTrait; ++k) {
                sum += loadings.getParameterValue(k, row) *
                        observed[k] * traitPrecision.getParameterValue(k) *
                        Y.getParameterValue(k);
            }
            tmp[row] = sum;
        }

        DenseMatrix64F B = DenseMatrix64F.wrap(numFactors, 1, tmp);
        DenseMatrix64F X = DenseMatrix64F.wrap(numFactors, 1, tmp2);

        InversionResult ci = safeSolve(precision, B, X, true);

        for (int row = 0; row < numFactors; ++row) {
            output.set(row, X.unsafe_get(row, 0));
        }

        return ci;
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:32,代码来源:IntegratedFactorAnalysisLikelihood.java

示例2: sampleToEigenSpace

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Converts a vector from sample space into eigen space.
 *
 * @param sampleData Sample space data.
 * @return Eigen space projection.
 */
public double[] sampleToEigenSpace( double[] sampleData ) {
    if( sampleData.length != A.getNumCols() )
        throw new IllegalArgumentException("Unexpected sample length");
    DenseMatrix64F mean = DenseMatrix64F.wrap(A.getNumCols(),1,this.mean);

    DenseMatrix64F s = new DenseMatrix64F(A.getNumCols(),1,true,sampleData);
    DenseMatrix64F r = new DenseMatrix64F(numComponents,1);

    CommonOps.subtract(s, mean, s);

    CommonOps.mult(V_t,s,r);

    return r.data;
}
 
开发者ID:droiddeveloper1,项目名称:android-wear-gestures-recognition,代码行数:21,代码来源:PCA.java

示例3: eigenToSampleSpace

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Converts a vector from eigen space into sample space.
 *
 * @param eigenData Eigen space data.
 * @return Sample space projection.
 */
public double[] eigenToSampleSpace( double[] eigenData ) {
    if( eigenData.length != numComponents )
        throw new IllegalArgumentException("Unexpected sample length");

    DenseMatrix64F s = new DenseMatrix64F(A.getNumCols(),1);
    DenseMatrix64F r = DenseMatrix64F.wrap(numComponents,1,eigenData);

    CommonOps.multTransA(V_t,r,s);

    DenseMatrix64F mean = DenseMatrix64F.wrap(A.getNumCols(),1,this.mean);
    CommonOps.add(s,mean,s);

    return s.data;
}
 
开发者ID:droiddeveloper1,项目名称:android-wear-gestures-recognition,代码行数:21,代码来源:PCA.java

示例4: response

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Computes the dot product of each basis vector against the sample.  Can be used as a measure
 * for membership in the training sample set.  High values correspond to a better fit.
 *
 * @param sample Sample of original data.
 * @return Higher value indicates it is more likely to be a member of input dataset.
 */
public double response( double[] sample ) {
    if( sample.length != A.numCols )
        throw new IllegalArgumentException("Expected input vector to be in sample space");

    DenseMatrix64F dots = new DenseMatrix64F(numComponents,1);
    DenseMatrix64F s = DenseMatrix64F.wrap(A.numCols,1,sample);

    CommonOps.mult(V_t,s,dots);

    return NormOps.normF(dots);
}
 
开发者ID:droiddeveloper1,项目名称:android-wear-gestures-recognition,代码行数:19,代码来源:PCA.java

示例5: computeStep

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
@Override
protected void computeStep(double[] step)
{
	final double[] d1 = gradientProcedure.d1;
	final double[] d2 = gradientProcedure.d2;

	if (solver != null)
	{
		// Solve the Jacobian. This is an implementation of the Newton-Raphson method
		// for systems of non-linear equations (see Numerical Recipes in C++, 2nd Ed, section 9.6)
		// XXX This does not work.
		// The the first order derivatives "are not n independent, arbitrary functions,
		// rather they obey so-called integrability conditions that are highly restrictive".
		// This code is deprecated and may be removed.
		for (int i = 0; i < step.length; i++)
			step[i] = -d1[i];
		jacobianGradientProcedure.getJacobianLinear(jacobian);
		DenseMatrix64F m = DenseMatrix64F.wrap(d1.length, d1.length, jacobian);
		System.out.println(m.toString());
		System.out.println(Arrays.toString(d2));
		if (solver.solve(jacobian, step))
		{
			// XXX - debug the difference
			double[] step2 = new double[d1.length];
			for (int i = 0; i < step.length; i++)
				step2[i] = -d1[i] / d2[i];
			System.out.printf("[%d] Jacobian Step %s vs %s\n", tc.getIterations(), Arrays.toString(step),
					Arrays.toString(step2));
			return;
		}
	}

	// Simple Newton-Raphson update step as per Smith et al, (2010), SI Eq. 13:
	// parameter -> new parameter + delta
	// => new parameter = parameter - delta  
	for (int i = 0; i < step.length; i++)
		step[i] = -d1[i] / d2[i];
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:39,代码来源:FastMLESteppingFunctionSolver.java

示例6: sampleToEigenSpace

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Converts a vector from sample space into eigen space.
 *
 * @param sampleData Sample space data.
 * @return Eigen space projection.
 */
public double[] sampleToEigenSpace( double[] sampleData ) {
   if( sampleData.length != A.getNumCols() )
      throw new IllegalArgumentException("Unexpected sample length");
   DenseMatrix64F mean = DenseMatrix64F.wrap(A.getNumCols(),1,this.mean);

   DenseMatrix64F s = new DenseMatrix64F(A.getNumCols(),1,true,sampleData);
   DenseMatrix64F r = new DenseMatrix64F(numComponents,1);

   CommonOps.sub(s,mean,s);

   CommonOps.mult(V_t,s,r);

   return r.data;
}
 
开发者ID:frank0631,项目名称:semantic-web-scraper,代码行数:21,代码来源:PrincipleComponentAnalysis.java

示例7: eigenToSampleSpace

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Converts a vector from eigen space into sample space.
 *
 * @param eigenData Eigen space data.
 * @return Sample space projection.
 */
public double[] eigenToSampleSpace( double[] eigenData ) {
   if( eigenData.length != numComponents )
      throw new IllegalArgumentException("Unexpected sample length");

   DenseMatrix64F s = new DenseMatrix64F(A.getNumCols(),1);
   DenseMatrix64F r = DenseMatrix64F.wrap(numComponents,1,eigenData);
   
   CommonOps.multTransA(V_t,r,s);

   DenseMatrix64F mean = DenseMatrix64F.wrap(A.getNumCols(),1,this.mean);
   CommonOps.add(s,mean,s);

   return s.data;
}
 
开发者ID:frank0631,项目名称:semantic-web-scraper,代码行数:21,代码来源:PrincipleComponentAnalysis.java

示例8: response

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Computes the dot product of each basis vector against the sample.  Can be used as a measure
 * for membership in the training sample set.  High values correspond to a better fit.
 *
 * @param sample Sample of original data.
 * @return Higher value indicates it is more likely to be a member of input dataset.
 */
public double response( double[] sample ) {
   if( sample.length != A.numCols )
      throw new IllegalArgumentException("Expected input vector to be in sample space");

   DenseMatrix64F dots = new DenseMatrix64F(numComponents,1);
   DenseMatrix64F s = DenseMatrix64F.wrap(A.numCols,1,sample);

   CommonOps.mult(V_t,s,dots);

   return NormOps.normF(dots);
}
 
开发者ID:frank0631,项目名称:semantic-web-scraper,代码行数:19,代码来源:PrincipleComponentAnalysis.java

示例9: wrap

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
public static DenseMatrix64F wrap(final double[] source, final int offset,
                                          final int numRows, final int numCols,
                                          final double[] buffer) {
    System.arraycopy(source, offset, buffer, 0, numRows * numCols);
    return DenseMatrix64F.wrap(numRows, numCols, buffer);
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:7,代码来源:MissingOps.java

示例10: compute

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Compute the coefficients given the spline node value at interpolated points. The value should be interpolated at
 * [0,1/3,2/3,1] in each dimension.
 *
 * @param value
 *            the value (packed in order : i = z*16+4*y+x) for x,y,z in [0,1,2,3])
 * @return the coefficients (or null if computation failed)
 */
public double[] compute(double[] value)
{
	DenseMatrix64F B = DenseMatrix64F.wrap(64, 1, value);
	solver.solve(B, B);
	return B.data;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:15,代码来源:CubicSplineCalculator.java

示例11: toA

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Create a new DenseMatrix from the input matrix a. Modifications to the matrix are passed through to the input
 * array!
 * <p>
 * This is provided as a bridge method between the functions that accept primitive arrays and those that accept
 * DenseMatrix.
 *
 * @param a
 *            the matrix
 * @param n
 *            the number of columns/rows
 * @return the dense matrix
 */
public static DenseMatrix64F toA(double[] a, int n)
{
	return DenseMatrix64F.wrap(n, n, a);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:18,代码来源:EJMLLinearSolver.java

示例12: toB

import org.ejml.data.DenseMatrix64F; //导入方法依赖的package包/类
/**
 * Wrap the input array b in a DenseMatrix. Modifications to the matrix are passed through to the input array.
 * <p>
 * This is provided as a bridge method between the functions that accept primitive arrays and those that accept
 * DenseMatrix.
 *
 * @param b
 *            the array
 * @return the dense matrix
 */
public static DenseMatrix64F toB(double[] b)
{
	return DenseMatrix64F.wrap(b.length, 1, b);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:15,代码来源:EJMLLinearSolver.java


注:本文中的org.ejml.data.DenseMatrix64F.wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。