Main Content

72 results in File Exchange

VChooseK

Version 1.0.0.0 by Jan

Choose K elements from a vector - MEX: 100 times faster than NCHOOSEK

's NCHOOSEK, except that NCHOOSEK replies the number of combinations for a scalar V: VChooseK(-1, 1) replies [-1]: One element taken out of a set of length one. NCHOOSEK(-1, 1) fails at calculating

  • 3.1K (All time)
  • 3 (Last 30 days)
  • 4.9 / 5
  • Community
  • 23 Dec 2009

The Computation of Pi by Archimedes

Version 1.20.0.0 by Bill McKeeman

Archimedes wrote 3 1/7 > pi > 3 10/71. This is how he did it.

- nchoosek: binomial coefficient, nchoosek
  • 3.3K (All time)
  • 2 (Last 30 days)
  • 5.0 / 5
  • Community
  • 4 Mar 2016

Unique random permutations

Version 1.0.0.0 by Ged Ridgway

Random sample (without replacement) from unique permutations of a vector or row-perms of a matrix

routines are also included to provide faster solutions in special cases of permutation test: simple correlation (perms_m); one-sample t-test (signs_m); and two-sample t-test (nchoosek_m). See

- nchoosek_m: efficiently compute the mth combination of nchoosek(1:n, k)
  • 1.5K (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 21 Apr 2010

Performance of Differential Amplify-and-Forward Relaying in Multi-Node Wireless Communications

Version 1.1.0.0 by matlabsharecodes

Performance of Differential Amplify-and-Forward Relaying in Multi-Node Wireless Communications

  • 818 (All time)
  • 5 (Last 30 days)
  • 5.0 / 5
  • Community
  • 18 Aug 2014

A fast NCHOOSEK alternative for engineers who like fast NCHOOSEK alternatives

Version 1.1.0.0 by Jose

This code recursively generates K-subsets of an N-set.

. It is a recursive alternative to the NCHOOSEK command that is extremely fast (O(1)), at the expense of slightly more user interaction. (You do get something that NCHOOSEK does not give you forthis

  • 425 (All time)
  • 1 (Last 30 days)
  • 3.5 / 5
  • Community
  • 27 Jan 2014

Variable Precision Integer Arithmetic

Version 1.45 by John D'Errico

Arithmetic with integers of fully arbitrary size. Arrays and vectors of vpi numbers are supported.

large arguments, or large factorials, or convert binary numbers with thousands of digits to decimal (vpi) form.For example, the existing nchoosek function in matlab gets upset for even reasonably small

- binomfactors: list all factors of the binomial coefficient nchoosek(n,k)
  • 18.9K (All time)
  • 14 (Last 30 days)
  • 4.8 / 5
  • Community
  • 27 Jan 2015

nchoosek_enum

Version 1.0.1 by Bruno Luong

nchoosek with enumerate selection. This function never build the full combination array in memory

1:chunksize;norepetition = false;while true if norepetition c = nchoosek_enum(n, k, i); else c = nchoosek_enum(n+k-1, k, i); c = c - (0:k-1); end for r=1:size(c,1) cr = c(r

  • 13 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 27 Apr 2021

Real-Time-Speech-Brain-Entrainment-Neurofeedback-Toolbox

Version 1.0.3 by Francisco Carrera Arias

EEG brain-computer interface system for providing real-time speech entrainment neurofeedback

- Multinomial coefficient
  • 740 (All time)
  • 9 (Last 30 days)
  • -- / 5
  • Community
  • 14 Apr 2021

aide mémoire Matlab (seconde édition)

Version 1.0.0.0 by Jean-Thierry

les m-fichiers de l'aide mémore Matlab seconde édition

  • 876 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 22 Jan 2008

Linear Fit

Version 1.0.0 by HS Ding

2D, 3D Fit

  • 20 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 25 May 2024

Calibration (Interpolation)

Version 1.0.0 by HS Ding

Calibration using linear interpolation

  • 24 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 25 May 2024

Quick Jacobi polynomials for non-negative integer a,b

Version 1.0.0 by Marcis Bleiders

Quick calculation of Jacobi polynomials in case of non-negative integer parameters a,b

- Summary of this function goes here
  • 33 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 28 Jul 2021

nCk(n,k)

Version 1.0.0.0 by Eyal Ben-Hur

Vectorized version of nchoosek function for multiple k's

  • 35 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 30 Jan 2017

Joint source-channel coding of images

Version 1.0.0.0 by Nikola Sprljan

Transmission of SPIHT encoded images over unreliable channels

  • 1.1K (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 27 Apr 2012

GPstuff

Version 4.6.0.0 by Aki Vehtari

Gaussian process models for Bayesian analysis

- Multinomial coefficient
  • 1.2K (All time)
  • 1 (Last 30 days)
  • 4.0 / 5
  • Community
  • 30 Dec 2022

binomfactors

Version 1.0.0.0 by John D'Errico

Returns a factored form for very large binomial coefficients

- binomfactors: list all factors of the binomial coefficient nchoosek(n,k)
  • 326 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 16 Feb 2010

ONECOMB

Version 1.0.0.0 by Darren Rowland

Obtain a single combination of N numbers taken K at a time.

comb = ONECOMB(N,K,M) returns the M-th combination of the sorted list of all combinations from NCHOOSEK. Makes use of a fast algorithm for the generation of a single combination.NCHOOSEK(1:4,3) = [ 1

- ONECOMB - obtain the M-th combination from NCHOOSEK(1:N,K)
  • 985 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 22 Feb 2009

ChooseK

Version 1.3.0.0 by Bruno Luong

All pairs intersecting on k-1 tuples from all possible k-tuples of n objects

- Recursive NCHOOSEK
  • 377 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 4 Jan 2011

nchoose2

Version 3.2.0.1 by Jos (10584)

all combinations of two elements

NCHOOSE2 - all combinations of two elements Y = NCHOOSE2(X) returns all combinations of two elements of the array X. It is the fast, vectorized version of NCHOOSEK(X,2). X can be any type of array

  • 2.7K (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 28 Feb 2019

Estimating Time-varying Neural Interactions

Version 1.0.0.0 by Hideaki Shimazaki

Matlab code for estimating time-varying interactions of neurons from spike data.

- TH is the matrix that converts the theta-coordinate into the p-coordinate.
  • 606 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 2 Jul 2012

nchoosekcom

Version 1.0.1 by Jos (10584)

NCHOOSEK with its complementary combinations

NCHOOSEKCOM Binomial coefficient or all combinations, and its complementWith one output argument, C = NCHOOSEKCOM (..) is the same as C = NCHOOSEK(..). For a vector V, C = NCHOOSEKCOM(V, K) returns a

  • 33 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 28 Apr 2019

COMBINATOR -combinations AND permutations

Version 1.3.0.0 by Matt Fig

Returns 1 of 4 different samplings on the set 1:N, taken K at a time.

  • 11.5K (All time)
  • 3 (Last 30 days)
  • 5.0 / 5
  • Community
  • 9 Sep 2010

permn

Version 6.2.0.0 by Jos (10584)

Permutations with repetition, all or a subset

matrix % permn can be used generate a binary table, as in B = permn([0 1],5) NB Matrix sizes increases exponentially at rate (n^N)*N. See also perms, nchoosek allcomb

  • 19.2K (All time)
  • 14 (Last 30 days)
  • 4.9 / 5
  • Community
  • 10 Jan 2019

nsumk

Version 1.7.0.0 by Peter Cotton

Returns the number and listing of n-tuples of non-negative integers adding up to k.

Little more than syntactic sugar for nchoosek, this small but surprisingly controversial function returns the number of (ordered) n-tuples of non-negative integers adding up to k, and if supplied a

  • 1.1K (All time)
  • 3 (Last 30 days)
  • 4.0 / 5
  • Community
  • 15 Aug 2010

N_PERMUTE_K

Version 1.4.0.0 by Matt Fig

All possible permutations of the elements of set N, taken K at a time, with repetition.

  • 10.6K (All time)
  • 2 (Last 30 days)
  • 4.9 / 5
  • Community
  • 31 Aug 2012

allcomb(varargin)

Version 4.2.0.0 by Jos (10584)

All combinations of input (v4.2, apr 2018)

. See also nchoosek, perms, ndgrid and nchoose, combn, kthcombn (matlab Central FEX)

  • 25.5K (All time)
  • 12 (Last 30 days)
  • 5.0 / 5
  • Community
  • 30 Apr 2018

Generate binomial table

Version 1.2.0.0 by David Holdaway

Very simple function to generate a table of all possible binomial coefficients below a cut off

Uses a recursion relation to generate all the binomial coefficients nchoosek(n,k) for a range n<=nmax, k<= n. This is much faster than using nchoosek to make this table. The idea of this

  • 231 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 17 Jan 2012

nchoose

Version 3.0 by Jos (10584)

all combinations of the elements of a set

elements of S as being unique. One could use nchoose(UNIQUE(S)) to avoid that. - Loosely speaking, nchoose(S) collects all output of multiple calls to NCHOOSEK(S, K) where K is looping from 1 to

  • 3.5K (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 8 Feb 2019

PERMPOS

Version 3.0.1 by Jos (10584)

all possible ordered permutations of M values in N positions

' 'XX' 'b' ; 'XX' 'a' 'b'} See also nchoosek, perms, randperm, true, false On the file Exchange: permn, PERMNK, permsk, allcomb, ballatsq, nones, nextpermpos

  • 3.7K (All time)
  • 2 (Last 30 days)
  • 4.7 / 5
  • Community
  • 14 May 2019

VChooseKR

Version 1.0.0.0 by Jan

Choose K elements from a vector with repetitions and without order [MEX]

  • 1K (All time)
  • 2 (Last 30 days)
  • 5.0 / 5
  • Community
  • 5 Jan 2010

VChooseKRO

Version 1.0.0.0 by Jan

Choose K elements from a vector with repetitions and order [MEX]

  • 1.3K (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 1 Jan 2010

Random combinatorics

Version 1.0.0.0 by Marc Lalancette

Random sets of distinct permutations, combinations and subsets

without repetition (out of nchoosek(n, k) possible).Distinct random subsets (combinations without repetition) out of n elements (out of 2^n possible).Can force to include the "identity" or "null" element

  • 73 (All time)
  • 2 (Last 30 days)
  • 5.0 / 5
  • Community
  • 29 Jun 2016

NextVector toolbox

Version 1.1.0.0 by Ben Petschel

files for iterating over permutations, combinations, subsets and vectorized for/while loops

The NextVector toolbox is a collection of files useful for doing iterations over all permutations, combinations, subsets and tuples.This is useful when the results of perms or nchoosek are too large

  • 1.7K (All time)
  • 2 (Last 30 days)
  • 5.0 / 5
  • Community
  • 11 Aug 2009

multinom

Version 1.0.0.0 by Damith Senaratne

Computes coefficients powers for a multinomial expansion of the form (a_1+...+a_M)^N

nchoosek(N+M-1,N).'c' is a Kx1 vector of coeficients'p' is a KxM matrix of powers, with k^th row containing the powers p(k,1) through p(k,M).

  • 229 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 19 Aug 2011

nchoosecrit(S, FUN)

Version 2.0.0.0 by Jos (10584)

returns those subsets (= combinations of elements of a set) that fulfill a specific criterion

nchoosek, perms nchoose, permn, allcomb on the file Exchange

  • 815 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 6 Feb 2018

Next Combination/Permutation

Version 1.0.0.0 by Matt Fig

Produces one comb/perm at a time. Both with/without repetition.

  • 4.3K (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 17 Jun 2009

NMULTICHOOSEK

Version 1.0.0.0 by Peter (PB) Bodin

Fast unordered samples with or without repetition.

NMULTICHOOSEK(N,K) finds the number of multisets of length k on n symbols. NMULTICHOOSEK can take vector or scalar input.NMULTICHOOSEK(N,K,'single') is the same as NCHOOSEK (unordered samples WITHOUT

  • 1.9K (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 17 Nov 2005

Choosenk.m

Version 1.0.0.0 by Faryad

number of ways of choosing k objects from n objects

% This code does the same job of "nchoosek(n,k)" builtin code for % the number of ways of choosing k objects from n distinct objects.% The mathematical definition is C=n!/(n-k)!/k!% This code is

  • 160 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 1 Jul 2014

NoverK

Version 1.2.1 by Jan

Fast and accurate N over K

times slower, less accurate nchoosek(n, k) 20 times slower, less accurate: nchoosek(61, 17) 536830054536826 (14 valid digits only) NoverK(61, 17) 536830054536825 The accuracy

  • 26 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 22 Feb 2022

RANDSUBSET

Version 1.2.0.0 by Bruno Luong

Return a random subset of k elements of the set of n elements

A = RANDSUBSET(N, K) is equivalent toALLSUBSETS = NCHOOSEK(1:N,K);A = ALLSUBSETS(RANDI(NCHOOSEK(N,K)));% orA = RANDPERM(N);A = SORT(A(1:k)); This function can also be used to generate random sampling

  • 403 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 29 Jun 2010

KCOMBSN

Version 1.2.0.0 by Eric Schols

Returns k random combinations of p unique integers between 1 and N.

. There are at most nchoosek(N,p) combinations of p unique integers between 1 and N, therefor k <= nchoosek(N,p).Example: The following code: N = 9; k = 3; p = 4; C = kcombsn(N,k,p);could return the

  • 47 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 13 Jan 2016

nCtwo

Version 1.0.0.0 by Simone Scaringi

All combinations of N elements taken two at the time.

MATLAB function NCHOOSEK(dat,2) but much faster.

  • 1.1K (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 29 May 2008

nextcombi

Version 1.0.0.0 by Dan Stowell

Given a set of N items, iterate over all the combinations of size R (R<N)

Given a set of N items, we want to do something with all possible subsets of that set which have size K. This method iterates over those subsets in a deterministic fashion. Unlike "nchoosek" (which

  • 431 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 3 Oct 2008

VChooseKO

Version 1.0.0.0 by Jan

Choose K elements from a vector without repetitions and with order [MEX]

  • 1.7K (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 17 Jan 2010

Find and return Binomial Coefficients (BCs) in a matrix up to N.

Version 1.2.0.0 by Bruce Raine

This function can return N choose K (K <= N) as well as a BC matrix up to N choose N.

lower-triangular Pascal matrix and does a simple lookup to get the desired BC. BINOMIND is much faster than NCHOOSEK at creating matrices of BCs if you set SPEED to TRUE and also has a basic integrity check to

  • 191 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 30 Dec 2011

pauseButton

Version 1.0.0.0 by Murphy O'Brien

Allows user to pause MATLAB simulation.

time.Useful if e.g. you are running a long simulation and suddenly decide you want to know how many five card poker hands are in a pack.Click the pause button, enter nchoosek(52,5) at the command window prompt

  • 2.4K (All time)
  • 1 (Last 30 days)
  • 4.3 / 5
  • Community
  • 10 Oct 2006

nextperm(V, K)

Version 3.0.0.0 by Jos (10584)

Next (lexicographic) permutation of values

returns the permutations in sorted order. V = 1:3 ; % 3 distinct values -&gt; 6 permutations W1 = perms(V) W2 = nextperm(V, 0:5) See also perms, nchoosek

  • 271 (All time)
  • 3 (Last 30 days)
  • 5.0 / 5
  • Community
  • 16 Mar 2018

KTHCOMBN

Version 1.1.0.0 by Jos (10584)

K-th combination(s) of elements

dec2bin(K-1,N)-'0' See also nchoosek, permsand combn, allcomb, nchoose on the File Exchange

  • 283 (All time)
  • 1 (Last 30 days)
  • 5.0 / 5
  • Community
  • 17 Jan 2012

Combin2Rank

Version 1.1.0.0 by Paulo Fonte

Calculates the rank (sequential ordinal) of nCk combinations

Example:Combs=nchoosek(1:5,3)Combs = 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5

  • 609 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 19 Jan 2009

Compute the Maximum Points Value in Optimum triangular area (update:07-29-07)

Version 1.0.0.0 by Ali OZGUL

optimization analysis with cyclic-permutation

main function as -nchoosek-. Plainly, If you selected more 100 point than solution time possible be few minute. This program's low-order-level of run-time not depent is my program's base-algorithm.for

  • 1.3K (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 30 Jul 2007

nchoose3

Version 1.0.2 by Sebastian Schlecht

All combinations of three elements.

NCHOOSE3 - all combinations of three elements Y = NCHOOSE3(X) returns all combinations of three elements of the array X. It is the fast, vectorized version of NCHOOSEK(X,3). X can be any type of

  • 17 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 12 Dec 2018

Combinatorial numbering rank and unrank

Version 1.0.0.0 by Brian Butler

Translate between standard numbering and combinatorial numbering of n choose k.

The sequence of combinations defined by N-choose-k (no ordering, no replacement) form a sequence that can be lengthy. These routines provide a way to translate between this sequence and the standard

  • 108 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 13 Nov 2015

bfs_202

Version 1.0.0 by Rohit

.

clc;close all;a=[-1,1,1,0;1,1,0,1];b=[1;2];c=[1,2,0,0];[m n]=size(a);nCm=nchoosek(n,m);pair=nchoosek(1:n,m);sol=[];for i=1:nCm y=zeros(n,1); B=a(:,pair(i,:)); x=B\b; if all(x&gt;=0

  • 0 (All time)
  • 0 (Last 30 days)
  • -- / 5
  • Community
  • 20 Feb 2023

NEXTPERMPOS

Version 1.0.0.0 by Jos (10584)

the next combination of values in specific positions (extension of PERMPOS)

([0 1 0]) % c2 = [0 0 1], tf = true [c3, tf] = nextpermpos (c2) % c3 = [1 0 0], tf = false See also permpos (matlab File Exchange), nchoosek

  • 242 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 10 Oct 2012

24 Game Solver

Version 1.1.0.0 by Raj Sodhi

Solves Chinese Math Game of 24

it found all possible solutions. For a deck of 13 cards, it turns out that there are nchoosek(16,4) four card combinations, or 1820. From the Wikipedia page, I saw that Cheng Chang published all

  • 418 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 24 Jan 2012

Control Loop for Cognitive Decision Making.

Version 1.0.1 by Karen Haigh

A control loop to drive a cognitive decision maker with in-mission learning. Project in "Cognitive EW: An AI Approach" by Haigh & Andrusenko

by memory and time (in addition to Adequacy)5. Add n-choose-k ablation trialsThe scenario driver corresponds to Algorithm 10.1, Figure 10.13,and Project 11.6.12 of the second edition, or Figure 10.2 of

  • 22 (All time)
  • 2 (Last 30 days)
  • -- / 5
  • Community
  • 5 Aug 2025

bfs2_202

Version 1.0.0 by Rohit

.

variable[m,n]=size(A);if n&gt;=mnv=nchoosek(n,m);t=nchoosek(1:n,m); % it forms pairs according to the value of m sol=[]; % it will store the solutionfor i=1:nv y=zeros(n,1); B=A(:,t(i

  • 2 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 20 Feb 2023

permsk

Version 1.1 by Jos (10584)

All permutations of K elements from an array (set)

K &gt; N, P will be empty.See also perms, nchoosek, randperm, permute. permn, nchoose, nchoose2 (file Exchange)

  • 69 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 22 Apr 2019

Laurrenge gaussian modes

Version 1.0.0 by pratheeb N.P

pratheeb

1/(1 + 1i*z/zR) .* exp(-r.^2/w0^2./(1 + 1i*z/zR));w = w0 * sqrt(1 + z.^2/zR^2);R = sqrt(2)*r./w;% Lpl from OT toolbox Lpl = nchoosek(p+l,p) * ones(size(R)); % x = R(r, z).^2for m = 1:p Lpl = Lpl +

  • 181 (All time)
  • 1 (Last 30 days)
  • -- / 5
  • Community
  • 24 May 2019

Chebfun - current version

Version 5.6.0.0 by Chebfun Team

Numerical computation with functions

- Choose function for CHEBFUN objects.
  • 11.3K (All time)
  • 73 (Last 30 days)
  • 4.9 / 5
  • Community
  • 1 Aug 2024

Load more