perms
产生所有可能的排列
语法
P = perms(v)
P =perms(v),这里v是一个长度为n的行向量,此函数产生v中这n个元素的全排列矩阵,每行为一个排列。矩阵P包含有n!行和n列。
举例
命令perms(2:2:6) 返回数字2、4和6的所有排列:
6
4
2
6
2
4
4
6
2
4
2
6
2
4
6
2
6
4
局限
此函数值只能适用于n < 15的情况下。
相关函数
nchoosek, permute, randperm
--------------------------------------------------
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:
6
4
2
6
2
4
4
6
2
4
2
6
2
4
6
2
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
产生所有可能的排列
语法
P = perms(v)
P =perms(v),这里v是一个长度为n的行向量,此函数产生v中这n个元素的全排列矩阵,每行为一个排列。矩阵P包含有n!行和n列。
举例
命令perms(2:2:6) 返回数字2、4和6的所有排列:
局限
此函数值只能适用于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:
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