Home > By category > Scripts >Development Tools > VChooseKO



VChooseKO

  • Downloads: 
  • Views: 
  • Rating:

VChooseKO(V, K) creates a matrix, which rows are all permutations of choosing K elements of the vector V with order and without repetitions.

INPUT:
V: Array of class DOUBLE, SINGLE, (U)INT8/16/32/64, LOGICAL, CHAR.
K: Number of elements to choose.

OUTPUT:
Y: [N!/(N-K)!, K] matrix with N is the number of elements of V.
Y has the same class as the input V.
The rows are sorted in lexicographical order: smaller indices at first.

EXAMPLES:
Choose 2 elements from [1, 2, 3]:
VChooseKO(1:3, 2) % ==> [1,2; 1,3; 2,1; 2,3; 3,1; 3,2]
For speed cast the input to integer types or SINGLE whenever possible:
Y = VChooseKO(uint8(1:100), 3); % 5 times faster than:
Y = VChooseKO(1:100, 3);
To get the permutations of cell arrays, permute the index:
C = {'a', 'b', 'c', 'd'};
C2 = C(VChooseKO(uint8(1:4), 2))
==> C2 = {'a','b'; 'a','c'; 'a','d'; 'b','a'; 'b','c'; 'b','d'; ...
'c','a'; 'c','b'; 'c','d'; 'd','a'; 'd','b'; 'd','c'}
Equivalent to PERMS:
isequal(sortrows(perms(1:5)), VChooseKO(1:5, 5)) % TRUE
For an output with sorted values (not indices!), sort the input:
X = [3, 1, 2]; VChooseKO(sort(X), 3)
==> [1,2,3; 1,3,2; 2,1,3; 2,3,1; 3,1,2; 3,2,1]

The output of VCHOOSEKO(V, K) is equivalent to COMBINATOR(NUMEL(V), K, 'p'), but is remarkably faster (see screenshot). The lexicographical output of VCHOOSEKO can be a benefit also, because a time-consuming SORTROWS can be omitted.

Tested: Matlab 6.5, 7.7, 7.8, WinXP, 32 bit, Compilers: BCC5.5, LCC2.4/3.8, Open Watcom 1.8
The unit-test function TestVChooseKO is included to test the validitiy and compare the speed with PICK, COMBINATOR and Matlab's PERMS.

Precompiled mex: http://www.n-simon.de/mex
See also:
VChooseK (no repetitions, no order): FEX #26190
VChooseKRO (repetitions, order): FEX #26242
VChooseKR (repetitions, no order): FEX #26277

I'd appreciate suggestions for improvements and bug reports sent through email - thanks.

Free download from Shareware Connection - VChooseKO(V, K) creates a matrix, which rows are all permutations of choosing K elements of the vector V with order and without repetitions.

Publisher: Jan Simon | License: Shareware
Version: 1.0 | Size: 20 KB | Platform: Matlab, Scripts
Released Date: 23-04-2013 | Rating: 0 | Title: VChooseKO

Author Url: http://www.mathworks.com
Program Info Url: http://www.mathworks.com
Download Url: http://www.mathworks.com/matlabcentral/fx_files/26397/1/VChooseKO.zip

More downloads from VChooseKO publisher Jan Simon:

ScaleTime - ScaleTime - fast linear matrix interpolation

DateStr2Num - DATESTR2NUM - Fast conversion of DATESTR to DATENUM

FilterM - FilterM, FiltFiltM: Fast digital filter

strncmpr - Compare last N chars of strings or cell strings

Patch FILTFILT - If applied to a matrix, the function FILTFILT (Signal Processing Toolbox) calls itself recursively for each column.

VChooseKO keywords:
VChooseKO related downloads:

Quantum Systems Simulator - The Quantum Systems Simulator gives you time-dependent quantum computations (and other QM systems); an easy, intuitive interface for building complex Hamiltonians out of simple ones; and SPEED: 2-3x faster than Matlab on tested problems.

System Information Class for Windows - Recently, we just got an interesting question about how to measure the CPU usage of current MATLAB process

Hamming Encoder-Decoder - Hamming Encoder-Decoder - Two M files implementing a Hamming (12,9) Encoder-Decoder algorithm.

Screenshot MATLAB in Physics - Symbolic Computation and Differential Equations - MATLAB in Physics is a four lecture series in MATLAB that is offered to first year physics undergraduate students

art1s.zip - Adaptive Resonance Theory (ART) Neural Network art1.zip contains: art1s.m - M-file for simulation of ART1 NN letno.m - M-file for generating input binary patterns (letters A-Z) for use with art1s.m noisy.

Shareware Connection periodically updates pricing and software information of 'VChooseKO' from company source 'Jan Simon' , so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft,  Using 'VChooseKO' crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of VChooseKO.

New Reviews

DataLocker SkyCrypt - Storing data in external hard drive is what any PC user can resort to but Cloud storage is gaining popularity with time. It gives you more flexibility and you can avail free and cheaply priced data storage in cloud as well. The only aspect that ...

Sony Movie Studio 13 Platinum - Sony enjoys a prime position in consumer level media software development and its Movie Studio has a large fan following. However, in recent years competition from Adobe and Corel has caught up. The recent overhaul of Sony’s video editor ...

Eset Cyber Security Pro - There was a time Mac users were simply oblivious to the existence of malware and viruses, partially encouraged by Apple’s claim that Mac’s do not fall prey to malicious code. In last few years, that perception has been shattered owing ...

Apple Aperture - It is quite true that Macintosh users generally get fewer tools to pick from than Windows users but they have some solid and impressive software to work with. One such example is Apple’s professional image editing and organizing tool, ...

CyberGhost VPN - There are so many ways available to browse the web nowadays. You can use a plethora of devices and pick from various service providers to get online. However, tech savvy users resort to additional measures to access the internet without being ...

CyberFence - Technological innovations play a pivotal role in changing human lives but they also come with their pitfalls. Perhaps, nothing can be a bigger example of this than the web. You need the internet for education, work, monetary transactions and ...

TrustPort Tools - Nowadays, PC users need to deal with several types of third party apps to ensure security and privacy of data. From encrypting files to getting rid of sensitive data, the needs can be numerous. There are many such tools that can be used in this ...

Screenpresso Pro - Capturing screenshots and webcam streams can become a necessity at times for PC users. There was a time most users resorted to Windows bundled print screen utility but now there are so many choices to pick from. If you want a feature rich and ...

CleanMyDrive - PC experts unanimously agree that using Macs tend to be a smoother and faster experience than running Windows based PCs but the Apple laptops and desktops also need maintenance and performance tweaking, occasionally. Regular web browsing, ...

Reallusion iClone - Nowadays, there is no scarcity of 3D animation and modeling software in market. However, not all such apps are user friendly and easy on wallet. If you want an intuitive and capable tool for making 3D animations without requiring much time, give ...




New Downloads

Free Audio Editor

Edit audio files visually;
Record audio from a microphone
or any other available input
device; Apply various effects;
...

Spiral Generator

Archimedean,Logarithmic,Fermat
,Hyperbolic,Lituus,Spherical
and Polynomial Spirals

Return a p-value from a
given z (standardized
distribution)

One tail and two tail p-value.

Quote Scroller for Graphics
and Animations

Quote Scroller script shows an
array of quotes flowing across
the screen at several
different speeds and colours.

Kwartz

Kwartz is a template system
which realized the concept
"Independence of Presentation
Logic".

getOdC

Based on Physica A 375 (2007)
365 373.

3D Object Rotate

3D Object Rotate is a Flash VR
tool taht allows you to create
high quality presentations.

IDBlogNetwork Ads

IBNadds is a plugin to install
Ad IDBlogNetwork on your
WordPress blog

STL File Reader

In addition to the STLREAD
import function

WP-PostRatings

WP-PostRatings adds an AJAX
rate system to your WordPress
blog

PARAFAC2

This m-file fits the PARAFAC2
model which is similar yet
more flexible than the
ordinary PARAFAC model.

Ingle & Proakis Chapter 3
Solutions

It contains answers to
selected problems from Ingle &
Proakis "Digital Signal
Processing Using Matlab v4.0"
Chapter 3