## Using the elements of one Matrix to form a new Matrix with specified rules

Given a matrix [a], how to get matrices [b] and [c] based on the following two rules?

1. rule [a]->[b]: Strike out corresponding term in [a] and take product of the remaining two terms in the same column.
2. rule [a]->[c]: Strike out the row and column containing the corresponding term in [a] and take sum of cross products in the 2×2 matrix remaining.

x,y,z can be replaced with 1,2,3; For example, $$a_{xy},a_{yz}$$ can be replaced with a12,a23; [a] can be replace with:

a = {{a11, a12, a13}, {a21, a22, a23}, {a31, a32, a33}} 

Thank you

Matrix [a]

Matrix [b]

Matrix [c]

## Minimum pair-wise XOR of elements from two sets

I have two sets, $$A$$ and $$B$$, which both contain a large amount of hashed values. What is the most efficient way of computing:

$$\min_{i,j} A_i \otimes B_j$$

## How do I input a 2d matrix when no spacing is given in adjacent elements while taking the input in c++?

Thanks for looking over, so I’m trying to take a nxn matrix as input where in the input is in the following format example :

4 1123 3442 5632 2444 

you see the input format that’s my problem I don’t want those elements to be stuck together and c++ is reading the rows as if each of the row is a number which means “cin” is reading only n elements and I expect it to read all n×n elements to be read separately. Pardon me if the question wasn’t upto the mark as this is my first question.

## Selecting k rows and k columns from a matrix to maximize the sum of the k^2 elements

Suppose $$A$$ is an $$n \times n$$ matrix, and $$k \ge 1$$ is an integer. We want to find $$k$$ distinct indices from $$\{1, 2, \ldots, n\}$$, denoted as $$i_1, \ldots, i_k$$, such that

$$\sum_{p, q = 1}^k A_{i_p, i_q}$$

is maximized. In words, we seek $$k$$ rows and the corresponding $$k$$ columns, such that the intersected $$k^2$$ elements of $$A$$ have the largest sum.

This problem can be formulated as a quadratic assignment problem, which is NP-hard and admits no polynomial time algorithm with constant approximation bound. I’m just wondering if for this specific problem (as a special case of quadratic assignment), there exists a poly-time algorithm with constant approximation bound. Thank you.

## Finding largest sum of $k$ elements below threshold

I was working on a project and am stuck in the middle unable to find an optimal method to solve this problem. Consider an array $$A$$ of $$n$$ elements. I have to choose $$k$$ elements such that the sum of indices is maximal under the constraint of being less than a given element $$x$$. My approach for this is the naive $$O(n^k)$$ algorithm, but this would take a lot of time for large $$n$$.

This is isn’t a homework problem.

## Prove that if you pair arbitrarily pair up the elements of an array A of size n to get n/2 pairs,

then you discard pairs of unequal elements and keep just one from the pairs of matching elements. Then the resulting collection will have a majority if and only if A had a majority, i.e. there exists an element with more than floor(n/2) occurrences.

I am very confused about how to go about proving this. It is from a textbook DPV problem 2.23. I am trying to prove it but I end up disproving it.

I.e. Suppose we have an array of n elements A[], that has a majority of element x. that means A.count(x) > floor(n/2). Now suppose that if we add two different elements, [a, b] to array A, x is no longer the majority. Then: A.count(x) <= floor(n/2) + 1 -> A.count(x) = floor(n/2) + 1. But now if we apply the same procedure and pair [a, b] together, then by definition the resulting array should have a majority, even though the original [….] o [a, b] did not.

## How to live edit CSS for dynamic javascript elements usign developer tools Style Editor?

I have to style javascript element that is available only then I use the mouse. When I try to select element using Firefox Development Toolbar, it disappears.

Is there a way to inspect elements that are dynamically generated?

## Pick out elements from a list of lists using criteria

Consider a list of lists in this form (with a shape $$m \times n \times 3$$):

{  {{a1, R1, c11}, {a2, R1, c12}, {a3, R1, c13}, ..., {an, R1, c1n}},  {{a1, R2, c21}, {a2, R2, c22}, {a3, R2, c23}, ..., {an, R2, c2n}},  ...,  {{a1, Rm, cm1}, {a2, Rm, cm2}, {a3, Rm, cm3}, ..., {an, Rm, cmn}} } 

where in each outer list, the 2nd element $$R_i$$ is fixed ($$i = 1, 2, …, m$$), and the 1st element changes from $$a_1$$ to $$a_n$$, the 3rd element $$c_{ij}$$ is normally a complex and its imaginary part can change from positive to negative or from negative to positive for several times. Here is a sample data for test.

I want to pick out the neighbor lists whenever the imaginary part of $$c_{ij}$$ changes its sign, say, for $$R_2$$, the selected lists are something like $$\{a_j, R_2, c_{2j}\}$$ and $$\{a_{j+1}, R_2, c_{2,j+1}\}$$, where $$\text{Im} c_{2,j} < 0$$ and $$\text{Im} c_{2,j+1} > 0$$. More generally, for $$R_p$$ I pick out $$\{a_j, R_p, c_{pj}\}$$ and $$\{a_{j+1}, R_p, c_{p,j+1}\}$$, and then to plot a curve with ListLinePlot[{{R1, a01}, {R2, a02}, ..., {Rp, a0p}, ..., {Rm, a0m}}], in which $$a_{0j} = (a_j + a_{j+1}) / 2$$. In other words, I what to plot a parameter curve w.r.t the 1st and 2nd elements, across which the imaginary part of the 3rd element changes sign.

I tried Cases, Select and ParametricPlot, but I am still having trouble to find all the pairs of the neighboring lists when the imaginary part of $$c_{ij}$$ changes its sign.