public Scalar<?> calculatePortfolioVariance(final PrimitiveMatrix assetWeights) {

        PrimitiveMatrix tmpLeft;
        PrimitiveMatrix tmpRight;

        if (assetWeights.countColumns() == 1L) {
            tmpLeft = assetWeights.transpose();
            tmpRight = assetWeights;
        } else {
            tmpLeft = assetWeights;
            tmpRight = assetWeights.transpose();
        }

        return tmpLeft.multiply(myCovariances.multiply(tmpRight)).toScalar(0, 0);
    }
public Scalar < ? > calculatePortfolioVariance ( final PrimitiveMatrix assetWeights ) { PrimitiveMatrix tmpLeft ; PrimitiveMatrix tmpRight ; if ( assetWeights . countColumns ( ) == 1L ) { tmpLeft = assetWeights . transpose ( ) ; tmpRight = assetWeights ; } else { tmpLeft = assetWeights ; tmpRight = assetWeights . transpose ( ) ; } return tmpLeft . multiply ( myCovariances . multiply ( tmpRight ) ) . toScalar ( 0 , 0 ) ; }
Calculates the portfolio variance using the input instrument weights.