计算所有组合减去向量的所有值

时间:2018-11-17 14:30:18

标签: r matrix vector combinations

给定一个向量c(3,4,5),向量的长度是可变的,我将返回所有元素均小于向量中值的组合矩阵 做这样的:

 [x_1] [x_2] [x_3] 
[1,]  3    4     5
[2,]  2    4     5
[3,]  1    4     5 
[4,]  3    3     5
[5,]  3    2     5
[6,]  3    1     5
[7,]  2    3     5
[8,]  1    2     5
[9,]  1    4     4
[10,] 1    4     3
[11,] 1    4     2
..... 

这只是所有可能组合的一部分,但我会拥有所有可能的组合。

1 个答案:

答案 0 :(得分:1)

我相信就是这样。

<?php
echo "test";
require_once 'phpword/autoload.php';

$PHPWord = new \PhpOffice\PhpWord\PhpWord();
$section = $PHPWord->addSection();

$fontStyle1= array('name' => 'mysh', 'size' => 48);//字体样式1
$paraStyle1= array('align'=>'center','spacing'=>10);

$fontStyle2= array('name' => 'mysh', 'size' => 18);//字体样式2
$paraStyle2= array('align'=>'center','spacing'=>5);

$section->addTextBreak(18);
$section->addText("COVER",$fontStyle1,$paraStyle1);
$section->addPageBreak();

$section->addText("Introduction",$fontStyle2,$paraStyle2);


$section2 = $PHPWord->addSection();
$footer = $section2->addFooter();
$footer->addPreserveText("{PAGE}/{NUMPAGES}",array('color'=>'ff0000','size'=>24),array('alignment' =>'center'));//\PhpOffice\PhpWord\SimpleType\Jc::CENTER
$section->addPageBreak();

$PHPWord->save('C:/Users/wsco/Desktop/test.docx');