matlab函数perms:排列产生函数

perms

产生所有可能的排列

语法

P = perms(v)

P =perms(v),这里v是一个长度为n的行向量,此函数产生v中这n个元素的全排列矩阵,每行为一个排列。矩阵P包含有n!行和n列。

举例

命令perms(2:2:6) 返回数字2、4和6的所有排列:
 
                  2
                    4
                    2
                    6
                    6
                    4

局限

此函数值只能适用于n < 15的情况下。

相关函数

nchoosek, permute, randperm

【jink2005译】


--------------------------------------------------
perms

All possible permutations

Syntax

P = perms(v)

P = perms(v), where v is a row vector of length n, creates a matrixwhose rows consist of all possible permutations of the n elementsof v. Matrix P contains n! rows and n columns.

Examples

The command perms(2:2:6) returns all the permutations of thenumbers 2, 4, and 6:   
                    2
                    4
                    2
                    6
                    6
                    4

Limitations

This function is only practical for situations where n is less thanabout 15.

See Also

nchoosek, permute, randperm



the original url :http://blog.sina.com.cn/s/blog_5fba9d0d0100fi8j.html
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值