cartesian-product Questions

3

Solved

I'm mostly convinced that there is an answer to this problem, but for the life of me can't figure out how to do it. Let's say I have three sets: A = [ 'foo', 'bar', 'baz', 'bah' ] B = [ 'wibble',...
Stela asked 30/3, 2012 at 14:27

9

Solved

I've a List of this type List> that contains this List<int> A = new List<int> {1, 2, 3, 4, 5}; List<int> B = new List<int> {0, 1}; List<int> C = new List<int> {...
Gamba asked 13/2, 2009 at 12:7

2

My code uses a cartesian product of a list like this: import itertools cartesian_product = itertools.product(list('ABCDEF'), repeat=n) n can be any value between 0 and 4. numba currently does ...
Repugnant asked 20/7, 2019 at 22:14

3

Solved

So I am writing a function allCoords that returns a list of every possible coordinate in a grid of width w and height h Both width and height must be non-negative integers in order to return a sens...
Mousetail asked 18/9, 2020 at 12:1

6

Solved

I've been trying to do a function that returns the Cartesian Product of n sets,in Dr Scheme,the sets are given as a list of lists,I've been stuck at this all day,I would like a few guidelines as wh...
Alfy asked 20/3, 2010 at 23:47

5

Solved

Say I have two arrays, import numpy as np x = np.array([1, 2, 3, 4]) y = np.array([5, 6, 7, 8]) What's the fastest, most Pythonic, etc., etc. way to get a new array, z, with a number of elemen...

6

Solved

Suppose I have a list die_faces = [1, 2, 3, 4, 5, 6]. I want to generate all 36 possible results for rolling two dice: (1, 1), (1, 2), (2, 1) etc. If I try using permutations from the itertools sta...
Westberg asked 23/6, 2010 at 8:17

3

Solved

I have a list of arrays and I would like to get the cartesian product of the elements in the arrays. I will use an example to make this more concrete... itertools.product seems to do the tr...
Leigh asked 13/6, 2010 at 21:34

3

Solved

I'm trying to get the Cartesian product of multiple arrays but the arrays are pretty large and I am trying to optimize memory usage. I have tried implementing a generator by using the below code bu...
Mossback asked 8/5, 2020 at 17:59

4

Solved

I have two lists of strings: letters = ['abc', 'def', 'ghi'] numbers = ['123', '456'] I want to for loop through them to create a list of strings that is not parallel, so zip() doesn't wor...
Plating asked 8/5, 2020 at 11:49

7

Solved

I have array1 = [1,2,3,4,5]; array2 = ["one","two","three","four","five"]; I want to get array3 where all elements of array1 with first (and others) element of array2 and etc. For example: arr...
Squeak asked 16/1, 2016 at 10:51

2

Solved

I'm am trying to get all possible combinations of 11 values repeated 80 times but filter out cases where the sum is above 1. The code below achieves what I'm trying to do but takes days to run: im...
Claudetteclaudia asked 15/1, 2020 at 9:45

10

Solved

I'm trying to run over the parameters space of a six-parameter function to study its numerical behavior before trying to do anything complex with it, so I'm searching for an efficient way to do thi...

5

Solved

I have an unknown number of buckets(collections), and each bucket having an unknown number of entities I need to produce a cartesian product of all the entities, so that I endup with a single COLL...
Jane asked 6/12, 2014 at 4:11

4

Solved

I have two vectors x and y, of respective lengths n and p. Is there a built-in way to create a np x 2 matrix which would be x[1] y[1] x[1] y[2] ... x[1] y[p] x[2] y[1] ... x[n] y[p] I can do tha...
Indeterminate asked 30/3, 2015 at 13:31

10

Solved

I have several data that looks like this: Vector1_elements = T,C,A Vector2_elements = C,G,A Vector3_elements = C,G,T ..... up to ... VectorK_elements = ... #Note also that the member of eac...

2

Solved

I need to generate a complete set of variants based on a list of N attributes, while keeping the attribute name intact. var input = [ { 'colour' : ['red', 'green'] }, { 'material' : ['cotton', '...
Spoonfeed asked 23/9, 2013 at 11:20

4

Solved

I'm looking for a clear, basic explanation of the concept of theta join in relational algebra and perhaps an example (using SQL perhaps) to illustrate its usage. If I understand it correctly, the t...
Conflagrant asked 27/9, 2011 at 1:58

2

Solved

Im trying to create some tool to create a list of types based on combinations of other types. Lets say we have three types struct A{}; struct B{}; struct C{}; I want to get a list of tuples wh...

2

Solved

I've got the following code that combines two vectors of arbitrary types into a combinatorial, i.e. std::vector<std::tuple<A, B>>. template<class A, class B> std::vector<std::...
Cathrine asked 8/11, 2018 at 22:12

7

I have a number of ArrayList with each ArrayList having objects and each one can have different length. I need to generate permutation like in the below example: Suppose I have 2 ArrayList: ArrayL...
Bracket asked 10/11, 2011 at 16:13

5

Solved

I have two arrays A and B. How do I combine them into a new array C, which is their Cartesian product? For example, given: A=( 0 1 ) B=( 1 2 ) Desired output: C=( 0:1 0:2 1:1 1:2 )
Zobkiw asked 31/12, 2009 at 16:29

5

Solved

Given x number of arrays, each with a possibly different number of elements, how can I iterate through all combinations where I select one item from each array? Example: [ ] [ ] [ ] foo cat 1 b...
Gounod asked 10/8, 2009 at 17:6

1

Solved

I am working on pair RDDs. My aim is to calculate jaccard similarity between the set of rdd values and cluster them according to the jaccard similarity threshold value.Structure of my RDD is : v...
Biotope asked 9/3, 2018 at 1:56

1

Solved

Suppose I need to zip three lists to get a list of triplets. I can write it like that: import cats._ import cats.data._ import cats.implicits._ (List(1, 2) |@| List(3, 4) |@| List(5, 6)) map {cas...
Perimeter asked 13/6, 2018 at 16:45

© 2022 - 2024 — McMap. All rights reserved.