Permutation multiplication (Fortran90)

In summary, to multiply two permutations in Fortran, you need to break them down into their cycle decomposition forms and then combine the cycles to get their product.
  • #1
relianne
1
0
Hi all, I'm trying to create a program which allows the user to input two permutations of sizes <10 and then multiply two of these together.

I need some help on how to get two permutations to multiply each other in Fortran. A snippet of what I've written so far..

Code:
Module Permutations
Implicit None
Integer:: I,n
Type Perm
  Integer, Allocatable, Dimension (:) :: A
End Type
Type Perm :: A1
End Module Permutation

Program Permutations
Use Permutation
Implicit None

Print *, “Insert first permutation size”
Read *, n
Allocate (A1%A(1:n))
 DO i=1,n
 Print *, I, “maps to”
 Read *, A1%A(i)
 END DO
END Program Permutations
Thanks!
 
Last edited:
Physics news on Phys.org
  • #2
The best way to multiply two permutations in Fortran is to use the concept of cycle decomposition. Cycle decomposition is a method of representing a permutation as a composition of disjoint cycles. For example, if we have a permutation p = (1,2,3,4) then it can be represented as a composition of two cycles, (1,2)(3,4).To multiply two permutations, you first need to break them down into their cycle decomposition forms, and then multiply them together by combining the cycles. For example, if we have two permutations p1 = (1,2,3,4) and p2 = (2,3,4,5) then their cycle decomposition forms are (1,2)(3,4) and (2,3)(4,5). To get their product, we combine these two cycles to get (1,2,3,4,5).This method can be extended to larger permutations as well.
 

What is permutation multiplication?

Permutation multiplication is a mathematical operation in which two permutations (or arrangements) of a set of objects are combined to form a new permutation. It involves rearranging the elements of one permutation according to the order specified by the other permutation.

How is permutation multiplication performed?

In Fortran90, permutation multiplication can be performed using the MATMUL function. This function takes two permutation matrices as input and returns the product matrix, which represents the combined permutation.

What are some applications of permutation multiplication?

Permutation multiplication has many applications in mathematics and computer science. It is used in cryptography, combinatorics, and graph theory to solve various problems. In computer science, permutation multiplication is used in algorithms for sorting, searching, and data compression.

Can permutation multiplication be used for non-numeric data?

Yes, permutation multiplication can be used for both numeric and non-numeric data. In Fortran90, the MATMUL function can be used for any type of data, as long as the input matrices are of the same type. This makes it a versatile tool for various applications.

What are some advantages of using Fortran90 for permutation multiplication?

Fortran90 is a high-level programming language that is specifically designed for scientific and engineering applications. It has built-in functions for performing complex mathematical operations, such as permutation multiplication, efficiently and accurately. It also supports parallel processing, making it suitable for handling large datasets.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
  • Linear and Abstract Algebra
Replies
15
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Back
Top