bugGNU Octave - Bugs: bug #53311, Need a function to directly...


bug #53311: Need a function to directly compute npr.

Submitter:  jack Bonz <vitalityz>
Submitted:  Fri 09 Mar 2018 04:39:13 PM UTC
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sat 31 Mar 2018 11:51:49 PM UTC, comment #9: 

I agree with Mike here. This is a trivial function, if somebody needs it as a function they can generate a function handle when needed.

I also suggest closing it as "wont fix".

Juan Pablo Carbajal <juanpi>
Group Member
Tue 13 Mar 2018 06:06:10 PM UTC, comment #8: 

No problem,I will be Always there.
If there comes compatibility issue or any issue,
I,myself will try to fix that.Actually I need the patch to be merged.Welcome any suggestions.

Dildar Sk <hodor123456>
Tue 13 Mar 2018 05:40:47 PM UTC, comment #7: 

I am only offering my opinion as a member of the Octave community. I am leaving this open for now for others to weigh in.

My opinion is that this function should not be added to Octave, mainly for compatibility reasons.

There are two compatibility reasons to consider:

1. When Octave invents a new function that is not already in Matlab, there is a potential for Matlab to create a function in the future that conflicts with it.

The mitigation for this is that Octave chooses names that are not likely to be used by Matlab. For this case, I would suggest a name like "num_ordered_subsets" or "num_sequences_without_repetition".

2. Matlab does not provide the function that you are looking for, so anyone familiar with Matlab or who wants to write scripts that are compatible with Matlab already must express this in terms of factorial, nchoosek, or pochhammer. Since Octave already supports all of those functions, we are fully compatible. If Octave introduces a new function, users who want to remain Matlab compatible will have to avoid using it.

Additionally, I am not a mathematician, but I gather there is some naming confusion about permutations vs ordered subsets vs sequences without repetition. If this function were added to Octave, it would probably be best to avoid using the word permutation for this function, because permutations are orderings of the complete set, not subsets, i.e. factorial(n).

Mike Miller <mtmiller>
Group Member
Tue 13 Mar 2018 02:35:05 AM UTC, comment #6: 

Here I am submitting a raw version of that function.
Attached a patch.

(file #43533)

Dildar Sk <hodor123456>
Sat 10 Mar 2018 12:02:10 AM UTC, comment #5: 

Thank you Dildar.Your code serves my purpose but I think this function should be implemented as built in.
And I don't think there is any compatibility issue in implementing this function.There is many trivial functions,which is 'simple' to calculate.

jack Bonz <vitalityz>
Fri 09 Mar 2018 10:31:20 PM UTC, comment #4: 

As you told the function is too simple and repetitive,
I changed it.And can't we implement functions if Matlab
do not so.Attached a m-file.

(file #43501)

Dildar Sk <hodor123456>
Fri 09 Mar 2018 06:32:38 PM UTC, comment #3: 

I don't believe Matlab has a function for the number of permutations without repetition. And since it is such a simple expression to calculate based on nchoosek, I doubt there is a need for us to invent a function where Matlab hasn't already done so.

Leaning towards closing as wont fix.

Mike Miller <mtmiller>
Group Member
Fri 09 Mar 2018 04:50:14 PM UTC, comment #2: 

Sorry,the previous file was not properly written.
I edited that(for credibility issue).

(file #43499)

Dildar Sk <hodor123456>
Fri 09 Mar 2018 04:43:40 PM UTC, comment #1: 

I doubt it,
Whatever if there is no inbuilt function available
please add my m-file what implemented.
m-file is attached.

(file #43498)

Dildar Sk <hodor123456>
Fri 09 Mar 2018 04:39:13 PM UTC, original submission:  

There is a function available to compute ncr i.e nchoosek(n,r);
but there is not function available to directly compute npr.
It would be helpful if there was a function available.

jack Bonz <vitalityz>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #43533:  npermutek.patch added by hodor123456 (2KiB - text/x-patch)
file #43501:  npermuter.m added by hodor123456 (2KiB - text/x-objcsrc)
file #43499:  npermuter.m added by hodor123456 (1KiB - text/x-objcsrc)
file #43498:  npermuter.m added by hodor123456 (74B - text/x-objcsrc)


Depends on the following items: None found

   patch dependencies.


Carbon-Copy List
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by hodor123456 (Updated the item)
  • -email is unavailable- added by vitalityz (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-09 mtmiller StatusNone Wont Fix
        Open/ClosedOpen Closed
    2018-03-13 hodor123456 Attached File- Added npermutek.patch, #43533
    2018-03-13 mtmiller Dependencies- patch #9591 is dependent
    2018-03-09 hodor123456 Attached File- Added npermuter.m, #43501
    2018-03-09 mtmiller Severity3 - Normal 1 - Wish
    2018-03-09 hodor123456 Attached File- Added npermuter.m, #43499
    2018-03-09 hodor123456 Attached File- Added npermuter.m, #43498

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code