You are viewing an archived page from the original site. Go to the new numericalmethod.com →

Changeset 1420 in algoquant


Ignore:
Timestamp:
5/3/2013 11:21:33 PM (7 months ago)
Author:
haksunli
Message:

CHG: renamed "Combination" to "CartesianProduct?"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/src/main/java/com/numericalmethod/algoquant/model/factormodel/famafrench1992/portfolio/FactorRanking.java

    r1366 r1420  
    3131import com.numericalmethod.algoquant.model.factormodel.famafrench1992.portfolio.FactorRanking.FactorRanks; 
    3232import static com.numericalmethod.nmutils.collection.CollectionUtils.*; 
    33 import com.numericalmethod.suanshu.misc.algorithm.Combination; 
     33import com.numericalmethod.suanshu.misc.algorithm.CartesianProduct; 
    3434import com.numericalmethod.suanshu.number.DoubleUtils; 
    3535import java.util.*; 
    … …  
    110110        public int[] computeBucketSizes(int nItems, int nBuckets); 
    111111    } 
     112 
    112113    private final List<Factor> factors; 
    113114    private final Map<Factor, Integer> factor2nBuckets; 
    … …  
    116117 
    117118    public FactorRanking(List<Factor> factors, Map<Factor, Integer> factor2nBuckets, 
    118         FactorValueLookup factorValueLookup) { 
     119                         FactorValueLookup factorValueLookup) { 
    119120        this(factors, factor2nBuckets, factorValueLookup, new MoreOnMiddleBucketsAllocation()); 
    120121    } 
    … …  
    131132     */ 
    132133    public FactorRanking( 
    133         List<Factor> factors, 
    134         Map<Factor, Integer> factor2nBuckets, 
    135         FactorValueLookup factorValueLookup, 
    136         BucketSizeAllocation allocation) { 
     134            List<Factor> factors, 
     135            Map<Factor, Integer> factor2nBuckets, 
     136            FactorValueLookup factorValueLookup, 
     137            BucketSizeAllocation allocation) { 
    137138        this.factors = factors; 
    138139        this.factor2nBuckets = factor2nBuckets; 
    … …  
    169170                public int compare(Equity o1, Equity o2) { 
    170171                    return Double.compare( 
    171                         factorValueLookup.getValue(o1, factor), 
    172                         factorValueLookup.getValue(o2, factor)); 
     172                            factorValueLookup.getValue(o1, factor), 
     173                            factorValueLookup.getValue(o2, factor)); 
    173174                } 
    174175            }); 
    … …  
    189190 
    190191    private Map<FactorRanks, Set<Equity>> assignEquitiesToSets(Set<Equity> equities, 
    191         Map<Equity, List<Integer>> equity2Ranks) { 
     192                                                               Map<Equity, List<Integer>> equity2Ranks) { 
    192193        Map<FactorRanks, Set<Equity>> ranks2Equities = newHashMap(); 
    193         for (List<Integer> ranks : computeRankCombination(factors, factor2nBuckets)) { 
     194        for (List<Integer> ranks : computeRankProduct(factors, factor2nBuckets)) { 
    194195            ranks2Equities.put(new FactorRanks(ranks), new HashSet<Equity>()); 
    195196        } 
    … …  
    201202    } 
    202203 
    203     private static Combination<Integer> computeRankCombination(List<Factor> factors, 
    204         Map<Factor, Integer> factor2nBuckets) { 
     204    private static CartesianProduct<Integer> computeRankProduct(List<Factor> factors, 
     205                                                                Map<Factor, Integer> factor2nBuckets) { 
    205206        Integer[][] sets = new Integer[factors.size()][]; 
    206207        for (int i = 0; i < sets.length; ++i) { 
    … …  
    211212        } 
    212213 
    213         Combination<Integer> combination = new Combination<Integer>(sets); 
    214         return combination; 
     214        CartesianProduct<Integer> product = new CartesianProduct<Integer>(sets); 
     215        return product; 
    215216    } 
    216217} 
Note: See TracChangeset for help on using the changeset viewer.