定制 th3n3rd/cartesian-product 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

th3n3rd/cartesian-product

最新稳定版本:v0.3.0

Composer 安装命令:

composer require th3n3rd/cartesian-product

包简介

Memory efficient Cartesian Product implementation

README 文档

README

Latest Version Software License Build Status HHVM Status Total Downloads

Memory efficient Cartesian Product implementation.

It uses iterators in order to store only a specific tuple at time being able to compute even large combinations without affecting the memory footprint.

Install

Via Composer

$ composer require th3n3rd/cartesian-product

Usage

use Nerd\CartesianProduct\CartesianProduct;

$cartesianProduct = new CartesianProduct();

$cartesianProduct
    ->appendSet(array('a', 'b', 'c'))
    ->appendSet(array('d', 'e'))
    ->appendSet(array('f', 'g', 'h'))
    ->appendSet(array('i', 'j'))
    ->appendSet(array('k', 'l'))
    ->appendSet(array('m', 'n'))
    ->appendSet(array('o'))
    ->appendSet(array('p'))
    ->appendSet(array('q', 'r', 's', 't'))
    ->appendSet(array('u', 'v', 'w'))
    ->appendSet(array('x', 'y'))
    ->appendSet(array('z'))
;

foreach ($cartesianProduct as $index => $product) {
    printf("[%s] (%s)\n", $index, implode(',', $product));
}

// or (not recommended)
$result = $cartesianProduct->compute();

foreach ($result as $index => $product) {
    printf("[%s] (%s)\n", $index, implode(',', $product));
}

Testing

$ phpunit

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 99.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 0
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-12