Mathematica: Finding ideal generators as fast as possible

In summary, the conversation discusses the process of finding ideal generators for integer mod groups quickly and efficiently. It is a two-step process that involves finding orbits for all combinations of a generator set and then selecting the ideal generators. The longest step is locating the orbits in a list. The conversation also includes code that is currently used for this process and a request for suggestions on how to optimize it for faster performance. The expert suggests using vectorization techniques, built-in functions, and parallel processing to improve the efficiency of the code.
  • #1
jackmell
1,807
54
Hi,

I'd like to find ``ideal'' generators for integer mod groups as quickly as possible and am running into timing problems when the number is large. It's a two-step process: (1) find orbits for all combinations of a generator set, and (2) select which generators are ideal. For (1), the step that takes the longest is to locate in a list, where the orbits are for a set of generators. For example, here are small sections of the orbitList with the generator in the first column, order of generator in second, and the orbit list in third. The second table is a small section of genSet listing in each row, 4-generator pairs. The objective is to locate in orbitList, where the 4-pair generators are so that I can then obtain the orbit lists for the generator pairs.

orbitList:
##
\left(
\begin{array}{ccc}
5 & 6 & \{5,25,125,121,101,1\} \\
11 & 6 & \{11,121,155,25,107,1\} \\
13 & 2 & \{13,1\} \\
17 & 6 & \{17,121,41,25,89,1\} \\
19 & 6 & \{19,25,139,121,115,1\} \\
23 & 6 & \{23,25,71,121,95,1\} \\
29 & 2 & \{29,1\} \\
31 & 6 & \{31,121,55,25,103,1\} \\
37 & 6 & \{37,25,85,121,109,1\} \\
41 & 2 & \{41,1\} \\
\end{array}
\right)
##
genSet:
##
\left(
\begin{array}{cccc}
13 & 29 & 41 & 5 \\
13 & 29 & 41 & 11 \\
13 & 29 & 41 & 17 \\
13 & 29 & 41 & 19 \\
13 & 29 & 41 & 23 \\
\end{array}
\right)
##
With Length[orbitList]=45, and Length[genSet]=81900 and I'm using the following code to find the locations of the 81900 generator pairs:
Code:
orbitIndex=Flatten[Map[Position[orbitList[[All,1]],#,1,1]&,#]]&/@ genSet;
So for the first genrator set of (13,29,41,5), that code would return the locations in orbitList of (3,7,10,1), the locations of these generators in orbitList. To do all 81900, takes about 2.8 seconds at 2.2 GHz but that's just a small one and I'd like to optimize the code as I plan to work on larger ones too and other parts of the code takes a lot of time as well so I was wondering if someone could suggest a faster way of doing just this part first or is this as fast as I can run it?

Ok thanks for reading,
Jack
 
Physics news on Phys.org
  • #2


Dear Jack,

Thank you for reaching out with your question. I understand your desire to optimize the code for finding the ideal generators for integer mod groups as quickly as possible. After reviewing the code you provided, I have a few suggestions that may help to improve the efficiency of this process.

1. Use vectorization techniques: Instead of using Map and Position functions, which can be slow for large data sets, consider using vectorization techniques. Vectorization allows you to perform operations on entire arrays at once, rather than one element at a time. This can significantly speed up the process.

2. Use built-in functions: Mathematica has many built-in functions that are optimized for speed and efficiency. For example, instead of using Map and Flatten, you can use the built-in function PositionIndex to create an index of the orbitList, which can then be used to quickly find the locations of the generator pairs in the genSet.

3. Consider parallel processing: If you have access to a multi-core processor, you can use Mathematica's built-in parallel processing capabilities to speed up the calculations. This allows you to divide the workload among multiple cores, significantly reducing the time it takes to complete the calculations.

I hope these suggestions help to improve the speed of your code. If you have any further questions, please don't hesitate to reach out.
Scientist
 

1. How does Mathematica help with finding ideal generators?

Mathematica has built-in functions and algorithms specifically designed for finding ideal generators in a fast and efficient manner. These functions utilize advanced mathematical techniques and optimizations to quickly compute and display the ideal generators for a given problem.

2. Can Mathematica find ideal generators for any type of problem?

Yes, Mathematica has the ability to find ideal generators for a wide range of mathematical problems, including linear algebra, number theory, and algebraic geometry. Its powerful functionality allows for the handling of complex and high-dimensional problems.

3. What makes Mathematica a better option for finding ideal generators compared to other software?

Mathematica's extensive collection of built-in functions and its ability to handle a variety of mathematical problems makes it a more comprehensive and efficient tool for finding ideal generators. It also has a user-friendly interface and provides detailed documentation for its functions.

4. How accurate are the results obtained from Mathematica for finding ideal generators?

The results obtained from Mathematica are highly accurate and precise. It uses rigorous mathematical techniques and algorithms to ensure that the ideal generators obtained are the optimal solutions for the given problem.

5. Is Mathematica suitable for both beginners and experienced researchers in finding ideal generators?

Yes, Mathematica is suitable for both beginners and experienced researchers. It has a user-friendly interface and provides step-by-step guidance for beginners, while also offering advanced options and customization for experienced users to fine-tune their ideal generator search. Additionally, Mathematica has a strong user community and resources for support and learning.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
14
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
3
Views
2K
  • Advanced Physics Homework Help
Replies
11
Views
1K
  • Precalculus Mathematics Homework Help
Replies
1
Views
533
  • Programming and Computer Science
Replies
2
Views
319
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
19
Views
981
Replies
7
Views
845
Back
Top