cartesian-product Questions

2

Solved

For list of strings, define the multiplication operation in as concatenating here: l1 = ['aa', 'bb', 'cc'] l2 = ['11', '22'] l3 = l1 op l2 Expected output: l3 = ['aa11', 'aa22', 'bb11', '...
Prakrit asked 4/6, 2018 at 22:34

3

Solved

I was given a puzzle as a present. It consists of 4 cubes, arranged side by side. The faces of each cube are one of four colours. To solve the puzzle, the cubes must be orientated so that all four...
Bernard asked 26/7, 2010 at 11:37

2

Solved

Given multiple list of possibly varying length, I want to iterate over all combinations of values, one item from each list. For example: first = [1, 5, 8] second = [0.5, 4] Then I want th...
Woollyheaded asked 5/5, 2013 at 11:36

1

I need to do a Cartesian product from 3 lists. Here is the code. XList<T> combine() { XList<T> returnList = new XList<>(); List<T> list = new ArrayList(this.coll); List&...
Continental asked 18/4, 2018 at 14:20

2

Solved

Given n sorted lists A1, A2, ..., An of integers in decreasing order, is there an algorithm to efficiently generate all elements of their cartesian product in decreasing tuple sum order ? For exam...
Featherstone asked 21/3, 2018 at 22:30

3

Solved

I have 3 numpy arrays and need to form the cartesian product between them. Dimensions of the arrays are not fixed, so they can take different values, one example could be A=(10000, 50), B=(40, 50),...

6

Solved

Given two lists, I can produce a list of all permutations the Cartesian Product of these two lists: permute :: [a] -> [a] -> [[a]] permute xs ys = [ [x, y] | x <- xs, y <- ys ] Exampl...
Mudskipper asked 2/8, 2010 at 11:43

6

Solved

Lets say, I have two lists of non-type template parameteres (which might have a different type) a template foo that takes one value of each of those lists as a parameter How can I create a va...

4

Solved

From a previous question I learned something interesting. If Python's itertools.product is fed a series of iterators, these iterators will be converted into tuples before the Cartesian product begi...
Pathetic asked 23/8, 2012 at 13:58

1

Solved

I'm a total begginer in Relational Algebra and I don't manage to fully understand how cartesian product works. I want to know what happen in cartesian product when my two table have common attribu...
Sillabub asked 20/9, 2017 at 12:1

5

Solved

Problem Say you have n lists of integers, where each list only includes integers in the range from 1 to n. For example, for n = 4, we might have: a_1 = [1, 2] a_2 = [3] a_3 = [4, 1, 1] a_4 = [2, ...
Condyle asked 25/8, 2017 at 13:24

3

Solved

I am trying to generate all possible combinations of n numbers. For example if n = 3 I would want the following combinations: (0,0,0), (0,0,1), (0,0,2)... (0,0,9), (0,1,0)... (9,9,9). This post ...
Carmelocarmen asked 29/1, 2016 at 12:43

1

Solved

Consider the following function, whose output is supposed to be the cartesian product of a sequence of iterables: def cart(*iterables): out = ((e,) for e in iterables[0]) for iterable in iterabl...
Footpad asked 13/7, 2017 at 10:20

10

Solved

Say that I have an array like the following: Array ( [arm] => Array ( [0] => A [1] => B [2] => C ) [gender] => Array ( [0] => Female [1] => Male ) [location] =>...
Blocking asked 10/6, 2011 at 20:35

2

Of course, producing a Cartesian product of heterogeneous lists can be done in a number of way in Haskell, such as: [(x,y) | x <- [1,2,3], y <- [4,5,6]] or (,) <$> [1,2,3] <*>...
Helmer asked 24/2, 2017 at 12:14

1

I have a large dataset of string ids, that can fit into memory on a single node in my spark cluster. The issue is that it consumes most of the memory for a single node. These ids are about 30 char...
Textual asked 6/2, 2017 at 14:20

2

Solved

I want to get all combinations of the values in a dictionary as multiple dictionaries (each containing every key of the original but only one value of the original values). Say I want to parametriz...
Mclellan asked 21/12, 2016 at 2:33

1

Solved

I have to compare coordinates in order to get the distance. Therefor i load the data with sc.textFile() and make a cartesian product. There are about 2.000.000 lines in the textfile thus 2.000.000 ...
Pucida asked 8/8, 2016 at 11:31

3

I need to concatenate 2 different lists of strings in python. for example: list1 = ['A','B','C'] list2 = ['D', 'E'] I want to obtain list3 = ['AD', 'AE', 'BD', 'BE', 'CD', 'CE'] I've t...
Perissodactyl asked 27/4, 2016 at 9:35

3

Solved

I'm trying to reproduce APL code for the game of life function in J. A YouTube video explaining this code can be found after searching "Game of Life in APL". Currently I have a matrix R which is: ...
Barron asked 21/3, 2016 at 20:12

1

Solved

From python's Documentation: https://docs.python.org/2/library/itertools.html#itertools.combinations see combinations_with_replacement: "# combinations_with_replacement('ABC', 2) --> AA AB A...

4

Solved

There is a Tuple as a Product of any number of types and there is an Either as a Sum of two types. What is the name for a Sum of any number of types, something like this data Thing a b c d ... = T...
Forethoughtful asked 25/1, 2016 at 15:13

2

Solved

I am really confused about this. I searched a lot of tutorials but i couldnot find a clear answer. A B B D 1 X x 5 2 x y 6 x 4 I want to cross this two tables.A , B, B,d are attributes. A B B...
Bettyebettzel asked 26/11, 2015 at 15:31

4

Solved

This question pops up quite often in one form or another (see for example here or here). So I thought I'd present it in a general form, and provide an answer which might serve for future reference....

4

Solved

Right now I can only implement the Cartesian product of two collections, here is the code: public static <T1, T2, R extends Collection<Pair<T1, T2>>> R getCartesianProduct( Colle...

© 2022 - 2024 — McMap. All rights reserved.