code: @Nonnull
    @ReturnsMutableCopy
    public Matrix solve (@Nonnull final Matrix aMatrix)
    {
      if (aMatrix.getRowDimension () != m_nDim)
        throw new IllegalArgumentException ("Matrix row dimensions must agree.");
      if (!m_bIsSPD)
        throw new IllegalStateException ("Matrix is not symmetric positive definite.");
  
      // Copy right hand side.
      final double [] [] aArray = aMatrix.getArrayCopy ();
      final int nCols = aMatrix.getColumnDimension ();
  
      // Solve L*Y = B;
      for (int k = 0; k < m_nDim; k++)
      {
        final double [] aDataK = m_aData[k];
        final double [] aArrayK = aArray[k];
        for (int j = 0; j < nCols; j++)
        {
          for (int i = 0; i < k; i++)
          {
            aArrayK[j] -= aArray[i][j] * aDataK[i];
          }
          aArrayK[j] /= aDataK[k];
        }
      }
  
      // Solve L'*X = Y;
      for (int k = m_nDim - 1; k >= 0; k--)
      {
        final double [] aDataK = m_aData[k];
        final double [] aArrayK = aArray[k];
        for (int j = 0; j < nCols; j++)
        {
          for (int i = k + 1; i < m_nDim; i++)
          {
            aArrayK[j] -= aArray[i][j] * m_aData[i][k];
          }
          aArrayK[j] /= aDataK[k];
        }
      }
  
      return new Matrix (aArray, m_nDim, nCols);
    }
docs: Solve A*X = B
  
  @param aMatrix
  A Matrix with as many rows as A and any number of columns.
  @return X so that L*L'*X = B
  @exception IllegalArgumentException
  Matrix row dimensions must agree.
  @exception RuntimeException
  Matrix is not symmetric positive definite.