cartesian-product Questions
12
Solved
I would like a list of 2d NumPy arrays (x,y) , where each x is in {-5, -4.5, -4, -3.5, ..., 3.5, 4, 4.5, 5} and the same for y.
I could do
x = np.arange(-5, 5.1, 0.5)
y = np.arange(-5, 5.1, 0.5)...
Spectator asked 25/8, 2015 at 15:41
5
Solved
Using Python, I'd like to compare every possible pair in a list.
Suppose I have
my_list = [1,2,3,4]
I'd like to do an operation (let's call it foo) on every combination of 2 elements from...
Merete asked 3/6, 2009 at 0:21
3
Solved
I have a function for finite lists
> kart :: [a] -> [b] -> [(a,b)]
> kart xs ys = [(x,y) | x <- xs, y <- ys]
but how to implement it for infinite lists? I have heard something ab...
Nephrotomy asked 11/12, 2013 at 10:17
0
Let's say I have the following database schema:
class A(Base):
__tablename__ = "a_table"
id = Column(Integer, primary_key=True, autoincrement=True)
version = Column(Integer, primary_k...
Trine asked 19/8, 2021 at 7:52
3
I want to retrieve k,v-pairs from a HashMap.
The entrys are like this:
a = 3,4
b = 5,6
and so on. I need combinations of these values.
a=3, b=5
a=3, b=6
a=4, b=5
a=4, b=6
I don't know how many ke...
Fascista asked 16/3, 2011 at 9:0
11
Solved
I have the following collection type:
Map<String, Collection<String>> map;
I would like to create unique combinations of each of map.size() from a single value in the collection for ...
Floyfloyd asked 21/8, 2015 at 3:38
3
Solved
Say I have several List<T>s, I will put them into another list or other collections, so I don't know how many list<T> I have until I call List<List<T>>.size()
Take below Lis...
Moujik asked 18/11, 2014 at 13:9
5
Solved
Let's say I have 2 groups of numbers:
{1, 2, 3},
{4, 5}
I'd like to create an algorithm (in Java) that outputs the following 6 combinations:
1,4
1,5
2,4
2,5
3,4
3,5
There can be an arbitrary ...
Slip asked 21/4, 2012 at 19:21
2
I have map like below:
{"A" : ["A1", "A2", "A3"], "B" : ["B1", "B2", "B3"]}
And I would like to get data like ...
Gone asked 31/1, 2018 at 1:27
4
Solved
I have n Sets. Each Set has different number of elements. I would like to write an algorithm which give me all possible combinations from the sets. For example, let's say we have:
S1={1,2}, S2={A,B...
Defibrillator asked 14/5, 2013 at 18:1
3
Solved
I want to find cartesian product of set of elements. Here's an example
example 1:
sets : (ab) (bc) (ca)
cartesian product is:
abc aba acc aca bbc bba bcc bca
example 2:
sets : (zyx) b c
cartesia...
Bluebell asked 3/7, 2011 at 14:51
9
Solved
I'm basically looking for a python version of Combination of List<List<int>>
Given a list of lists, I need a new list that gives all the possible combinations of items between th...
Moreno asked 28/4, 2009 at 16:44
2
Solved
I need a function similar to expand.grid but without the combinations of duplicate elements.
Here is a simplified version of my problem.
X1 = c("x","y","z")
X2 = c(&qu...
Isomorph asked 19/6, 2021 at 13:15
1
I'm trying to conjure up a cartesian product from two potentially infinite streams that I then limit via limit().
This has been (approximately) my strategy so far:
@Test
void flatMapIsLazy() {
Str...
Sandra asked 24/5, 2021 at 4:55
3
Here is the simplified version of the problem I have. Suppose I have a vector
p=[1 5 10]
and another one
q=[.75 .85 .95]
And I want to come up with the following matrix:
res=[1, .75;
1, .85;
1...
Oleoresin asked 23/3, 2012 at 4:41
7
I have two lists of numbers and I'd like to find all possible pairs of numbers. For example, given the lists [1, 2, 3] and [3, 4] the result should be:
[(1, 3), (1, 4), (2, 3), (2, 4), (3, 3), (3, ...
Gracielagracile asked 14/2, 2017 at 7:18
7
Solved
I'm trying to find the dplyr function for cartesian product. I've two simple data.frame with no common variable:
x <- data.frame(x = c("a", "b", "c"))
y <- data....
Foreleg asked 5/4, 2017 at 10:21
11
Solved
Given an unknown amount of lists, each with an unknown length, I need to generate a singular list with all possible unique combinations.
For example, given the following lists:
X: [A, B, C]
Y: [W...
Spermatogonium asked 19/6, 2013 at 13:40
3
Solved
I would like to create a method which creates a stream of elements which are cartesian products of multiple given streams (aggregated to the same type at the end by a binary operator). Please note ...
Pain asked 17/9, 2015 at 13:30
2
Solved
How can I implement a function using Java 8 to take some number of streams, and produce a stream in which each element is a list consisting of one member of the Cartesian product of the streams?
I'...
Roorback asked 8/1, 2017 at 1:19
10
Solved
I want to compute the cartesian product of an arbitrary number of nonempty sets in Java.
I've wrote that iterative code...
public static <T> List<Set<T>> cartesianProduct(List&l...
Mapp asked 12/11, 2009 at 2:56
3
Solved
I want to create a DataStructure which will be similar to the cartesian product of three List.
I've also referred the existing answer by Jurgen which suggest to use flatMap. I tried in that way as ...
Dejected asked 13/8, 2020 at 15:18
2
I have 2 PCollections:
PCollection<List<String>> ListA =
pipeline.apply("getListA", ParDo.of(new getListA()))
PCollection<List<String>> ListB =
pipeline.apply(&q...
Prytaneum asked 5/2, 2021 at 15:20
2
Solved
I would like to generate a rather large but finite Cartesian product in Haskell, which I need to then iterate on (think partition function of a mean-field model). The natural thing to do uses seque...
Sentence asked 12/4, 2012 at 11:44
6
Solved
I want to do permutation in Perl. For example I have three arrays: ["big", "tiny", "small"] and then I have ["red", "yellow", "green"] and also ["apple", "pear", "banana"].
How do I get:
["big", ...
Grayback asked 16/3, 2010 at 18:34
© 2022 - 2024 — McMap. All rights reserved.