48 questions
0
votes
0
answers
80
views
C code for fusing multiple array transpositions into one pass
Suppose that A is a one-dimensional NumPy array and s, n_y, n_x,
blk_y, and blk_x are integers > 0 and s divides both blk_y and
blk_x. The number of elements in A is equal to both n*s*s and
ny*...
0
votes
0
answers
27
views
bijection between n and k letter alphabet
What is bijection between strings over n and k letter alphabet, k,n positive integers ?
I'm about to construct a bijection for sentences and binary strings, but I've failed .
Can I construct a ...
1
vote
1
answer
392
views
Return set of all bijections on the input set
the method: public static Set<Function<T,T>> bijectionsFinder(Set<T> d)
say d= {1,2,3}. We are supposed to find all bijections from d -> d and return a set of those bijections.
Im ...
1
vote
2
answers
995
views
How to get combination by index from a list of unique combinations
The following is what I am trying to achieve:
alpha = 'abcdefghijklmnopqrstuvwxyz0123456789'
items = ['item-a','item-b'...'item-n']
my_map = defaultdict()
for i, item in enumerate(items):
...
3
votes
4
answers
85
views
Sort or remove elements from corresponding list in same way as in reference list
I have two lists in python of same length:
listA = [7,6,3,2,1,4,5]
listB = [a,b,c,d,e,f,g]
is their some way (probably easy function) to sort listA and change the values of listB in the same way. ...
0
votes
1
answer
291
views
Set of functions using Function interface [closed]
Let there be a set A = {1,2,3}. The goal is to compute all bijections on AxA. It should be of type Set<Function<T,T>> so that in the driver code, we can use the "apply" function.
...
3
votes
1
answer
556
views
Bidirectional Dict in Julia
I have some problem where I need to define a one-to-one mapping from one variable to another. I am using a Dictionary like this:
mapping = Dict('I'=>1, 'V'=>5, 'X'=>10)
I also want to map it ...
0
votes
2
answers
541
views
Construct a bijective function to map arbitrary integer from [1, n] to [1, n] randomly
I want to construct a bijective function f(k, n, seed) from [1,n] to [1,n] where 1<=k<=n and 1<=f(k, n, seed)<=n for each given seed and n. The function actually should return a value from ...
0
votes
0
answers
21
views
Represent a 1-1 relationship [duplicate]
I have come to a need to represent a one to one relationship in python.
The easiest thing to do is have a list of tuples. [(thing_one, thing_two]. But this would get you O(N) translation/deletion/...
0
votes
2
answers
2k
views
Short URL with unique but random generated string?
So I have been trying to build a URL shortner but I am unable to generate unique but random strings. I have look everywhere for a solution but couldn't find one thus posting it here.
I have a table ...
0
votes
1
answer
121
views
Removing bijective columns automatically from the data frame identified using whichAreBijection command from dataPreparation package using r
I am having trouble doing a simple task:
Say I use these libraries and have this data frame:
library(tidyverse)
library(dataPreparation)
df <- data.frame(col1 = 1, col2 = rnorm(1e1), col3 = ...
0
votes
0
answers
225
views
Retrieve schema from parquet-avro messages pulled from kafka
Using samples from various sources I have written this method (relevant section shown below) where I am pulling parquet-avro messages from kafka for a test application. Based on the code I could find ...
1
vote
1
answer
614
views
31-bit Bijective (Perfect) Hash algorithm
What I need
I need an algorithm that produces a bijective output. I have a 31-bit input and need a pseudo-random 31-bit output.
What I have considered
CRCs are bijective within their bit-width.
I ...
2
votes
1
answer
515
views
How do you efficiently compute a bijective base-k numeral (and/or its inverse) in R or any other freely-available programming language?
Although this question already has partial answers on StackOverflow, those answers are not associated with questions that have the proper name of the process / concept (bijective (base-k) numeration) ...
3
votes
1
answer
265
views
Bijection between (n choose k) and bitstrings of length n with k bits set
While I know how to generate all (n choose k) bitstrings of size n with exactly k bits set to one, I'm struggling finding a bijection, that gets as input a number i between 1 and (n choose k) and ...