Example #1
0
  BasicMatrix getAssetWeights() {

    if (myAssetWeights == null) {

      final int tmpSize = myComponents.size();

      final Builder<PrimitiveMatrix> tmpWeights = MATRIX_FACTORY.getBuilder(tmpSize, 1);

      for (int i = 0; i < tmpSize; i++) {
        tmpWeights.set(i, 0, this.getWeight(i));
      }

      myAssetWeights = tmpWeights.build();
    }

    return myAssetWeights;
  }
Example #2
0
  public BasicMatrix getCovariances() {

    if (myCovariances == null) {

      final int tmpSize = myComponents.size();

      final Builder<PrimitiveMatrix> tmpCovaris = MATRIX_FACTORY.getBuilder(tmpSize, tmpSize);

      for (int j = 0; j < tmpSize; j++) {
        for (int i = 0; i < tmpSize; i++) {
          tmpCovaris.set(i, j, this.getCovariance(i, j));
        }
      }

      myCovariances = tmpCovaris.build();
    }

    return myCovariances;
  }