How to create a set (of matrices) which will be used as an finite group to minimize a function?

I’m new here so I’m a little lost.

I need to minimize a function considering that the minimizing parameter belongs to a preestablished set. It all involves matrices.It’s something like this:

enter image description here

Where G is the set I need to create and enter image description here represents an element of the set. All the other parameters are given.

How can I direct sum matrices into the middle of one another another?

I would like to execute the mathematical operation of the direct sum of matrices in the case where the matrices are not appended one after the other along the diagonal, but instead mixed among one another. This must be generalizable to any permutation of mixing indices along the diagonal.

For example, say we have matrix A, B and C $ $ A=\begin{equation} \begin{bmatrix} cos (t) & sin(t) \ -sin(t) & cos(t) \end{bmatrix} \end{equation}$ $

$ $ B=\begin{equation} \begin{bmatrix} 1 & 0 \ 0 & 1 \end{bmatrix} \end{equation}$ $

$ $ C=\begin{equation} \begin{bmatrix} cos (u) & sin(u) \ -sin(u) & cos(u) \end{bmatrix} \end{equation}$ $

$ A ? B ? C=\begin{equation} \begin{bmatrix} cos (t) & sin(t) & 0 & 0 & 0 & 0\ -sin(t) & cos(t) & 0 & 0 & 0 & 0\ 0 & 0 & 1 & 0 & 0 & 0\ 0 & 0 & 0 & cos(u) & 0 & sin(u)\ 0 & 0 & 0 & 0 & 1 & 0\ 0 & 0 & 0 & -sin(u) & 0 & cos(u) \end{bmatrix} \end{equation}$

How would this be done in a generalizable way in Mathematica? One could use a permutation matrix, $ P=\begin{equation} \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0\ 0 & 1 & 0 & 0 & 0 & 0\ 0 & 0 & 1 & 0 & 0 & 0\ 0 & 0 & 0 & 0 & 1 & 0\ 0 & 0 & 0 & 1 & 0 & 0\ 0 & 0 & 0 & 0 & 0 & 1 \end{bmatrix} \end{equation}$ where, $ A?B?C=P[A⊕B⊕C]P^T$ , but how could I create such a matrix P in mathematica knowing only what the mapping is? In this case, the index mapping being: (1,2,3,4,5,6)->(1,2,3,5,4,6)

Finding a boolean submatrix isomorphic to a specific set of other boolean matrices

Given a matrix $ M$ of certain size $ h\times w$ , where $ h\leq w$ , for example $ 5\times 6$ , are also given the following set $ A$ of (a)dditional matrices:

$ $ \begin{matrix} Matrices: & \begin{bmatrix} % 2 x 5 1 & 1 & 1 & 1 & 1\ 1 & 1 & 1 & 1 & 1 \end{bmatrix} & \begin{bmatrix} % 3 x 4 1 & 1 & 1 & 1\ 1 & 1 & 1 & 1\ 1 & 1 & 1 & 1 \end{bmatrix} & \begin{bmatrix} % 4 x 3 1 & 1 & 1\ 1 & 1 & 1\ 1 & 1 & 1\ 1 & 1 & 1 \end{bmatrix} & \begin{bmatrix} % 5 x 2 1 & 1\ 1 & 1\ 1 & 1\ 1 & 1\ 1 & 1 \end{bmatrix}\ Sizes: & 2 \times w – 1 & 3 \times w – 2 & 4\times w – 3 & 5\times w – 4 \end{matrix} $ $

As you can see, this specific set of matrices follows the pattern of containing only $ 1$ s, with sizes starting from $ 2\times w – 1$ up to $ h\times w – h + 1$ .

The problem is finding a submatrix of $ M$ that is isomorphic with any of the matrices in the set $ A$ . In case there is more than one solution, the result is any submatrix of maximum height first, and in case there’s again multiple candidates, any submatrix with maximum width.

The problem have the following properties:

  • $ 2 \leq h \leq w$ .
  • Each row of $ M$ has at least one $ 0$ .
  • Deduced from the way $ A$ is generated, for each $ a\in A$ of size $ a_h\times a_w$ , it happens that $ a_h + a_w – 1 = w$ .
  • The operations you can apply to $ M$ to check for homomorphism are the usual ones, you can swap rows between them, or columns betweem them, but you cannot sum or substract rows or columns between them as in lineal algebra.

I have spend already a couple of days trying to construct a polynomial-time algorithm for this problem but I don’t see it clearly. Is this problem NP-hard, taking into account all of the restrictions it has?

I’m looking for any strategy that implies to "normalize" $ M$ by applying a set of row or column swapping in a way that, in case there’s a solution, it’s in the "top left" corner of $ M$ . I have also explore the possibility of using the rank of $ M$ to see if there’s some pattern regarding its potential solution, etc. I have also try to sort the columns and rows by number of $ 1$ s and that kind of things, but my background on lineal algebra in very limited, and so it is my set of mathematical "tricks" to characterize $ M$ regarding $ A$ .

NOTE: The maximum subarray problem is similar to this one, but take notice that my best solution is not neccesarily the maximum one. If, for example, the solution submatrices of size $ 3\times 4$ and $ 5\times 2$ exists, the "best solution" is $ 5\times 2$ , because it has a bigger height, although it’s has less number of $ 1$ s.

NOTE: The graph homomorphism problem is also similar, but take notice that $ M$ is not equivalent to an adjacency matrix because it’s not square or symmetrical.

Address issue of matrices in C [closed]

A matrix X [-15 . . . 10, 15 . . . 40] is given.Each memory address holds 1 byte of memoryFind the address of X[10][40].

Note: The notation of the matrix is rather orthodox and confusing. It says that these are the indices of the matrix. I have come across comments that this does not look like a matrix. But I came across this and I can assure hundreds of other people also do, so it will be helpful to clear this for once and for all. The simple question here is if the X[10][40] will be accessible or not as from the indices we get that there are 26 rows and 26 columns. The calculation for the number of rows in done below. My confusion is if said in one line is that as there are 26 rows and 26 columns, then [1][26] will occupy one byte of memory.In the lieu of that will [1][27] also hold 1 byte of memory. Because I haven’t declared it to have 1 byte of memory. And following this will [10][40] also hold 1 byte of memory.I hope my question is now clear. However, if any doubt is still there,I would be more than happy to address it.:).

Lr = Lower limit of row/start row index of a matrix, if not given assume 0 (zero)

Lc = Lower limit of column/start column index of a matrix, if not given assume 0 (zero)

If the beginning location is 1500 determine the location of X[10][40] for both row-major and column-major order.

Every element of the matrix requires 1 byte of storage.

The question is solved by this ugly looking formula.

Number or rows say M = (Ur – Lr) + 1

Number or columns say N = (Uc – Lc) + 1

Row Major Wise Calculation:

Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]

Column Major Wise Calculation :

Address of A [ I ][ J ] = B + W * [ ( I – Lr ) + M * ( J – Lc ) ]

B = Base address

I = Row subscript of the element whose address is to be found

J = Column subscript of the element whose address is to be found

W = Storage Size of one element stored in the array (in byte)

Lr = Lower limit of row/start row index of a matrix, if not given assume 0 (zero)

Lc = Lower limit of column/start column index of a matrix, if not given assume 0 (zero)

M = Number of rows of the given matrix

N = Number of columns of the given matrix

The question is [10][40] valid or out of bounds here.Can we calculate its address?

Here i proceeded like this:

For X[10][40]:

Row-major:1500+1* [26 * (10 – (-15))) + (40 – 15)]=2175

Column-major:1500 + 1 * [(10– (-15)) + 26 * (40 – 15)]=2175

Is minimising the total number of one entries in binary matrices $CA$ and $C^TB$ NP-HARD?


Given a two rectangular binary matrices $ A$ and $ B$ with dimensions $ c\times a$ and $ c \times b$ respectively, does there exist an invertible binary matrix C with dimensions $ c \times c$ such that the total number of 1 entries in $ CA$ and $ C^TB$ is below a target threshold $ t$ ?

Here we are working in $ GF(2)$ , where multiplication and addition are AND and XOR respectively.

What is the hardness of this problem? Are there approximation algorithms to this problem?

We know this problem is in $ NP$ , as a valid $ C$ can be used as a certificate. Also, we know how to find $ C$ when there exists the a solution for $ t = a+b$ , by using Gaussian Elimination.

Complexity of finding choice of entries of matrices

Suppose I have a matrix with entries either $ x$ or $ y$ , where the number of rows = number of columns = $ n$ . If I want to select/circle $ n$ entries such that for each row, only exactly one is circled, for each column, also exactly one is circled, and such that all entries circled are only $ x$ (if such a circling of entries exists), what complexity class does this belong to? Thanks!

Simplify expression with abstract matrices

After defining a commutator function

Commutator[X_, Y_] := X.Y - Y.X; 

I would like to be able to simplify abstract matrix algebra expressions such as

Simplify[Commutator[A + B, Commutator[A + B, A - B]] -    Commutator[A - B, Commutator[A + B, A - B]]] 

instead of just printing out

-(A - B).(-(A - B).(A + B) + (A + B).(A - B)) + (A +      B).(-(A - B).(A + B) + (A + B).(A - B)) + (-(A - B).(A + B) + (A +         B).(A - B)).(A -      B) - (-(A - B).(A + B) + (A + B).(A - B)).(A + B) 

Is there a way to do this without downloading a non-commutative algebra package?

Vertex skinning, calculating the bone matrices (for bind pose) and then animating them

I am attempting to do HW skinning in Opengl. Please note that I am purposefully doing it in a not-game ready optimized way, because I need this to scale. I wrote the following code to ‘apply’ the skinning:

  mat4 BoneXForm;    for (int i = 0; i < maximumInfluence; i++) {     BoneXForm += globalAnimMats[blendWeights[i * gl_VertexID].blendId] * blendWeights[i * gl_VertexID].blendValue;   }    vec4 VertPoseLong = BoneXForm * vec4(vertPos, 1.0);    // Set the vertex postion   gl_Position = MVP * VertPoseLong; 

This code uses ‘globalAnimMats’ a mat4 x bones, and an array of skinning indices/value combos:

struct { int BoneIndex; float Influence; }; 

My issue is, I am not sure what the value of each matrix should be in the matrix buffer. Per each bone on the CPU, I have local space pos/rot and global space pos/rot. My goal here is so also apply an animation to the skeleton.

The position is a vec3 and the rotation is a quat. I have tried doing global pos/rot as a mat4 but the whole model moves above the skeleton.