# Questions tagged [matrix]

In mathematics, a matrix (plural matrices) is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. The individual items in a matrix are called its elements or entries.

33,610
questions

**0**

votes

**0**answers

6 views

### Generating Correlated Random Samples

I read this tutorial http://scipy-cookbook.readthedocs.io/items/CorrelatedRandomSamples.html on how to get a matrix C so that C*C^T = R, with R being a given covariance matrix. The code example ...

**0**

votes

**1**answer

15 views

### Why is 'scipy.sparse.linalg.spilu' less efficient than 'scipy.linalg.lu' for sparse matrix?

I posted this question on http://scicomp.stackexchange.com, but received no attention. As long as I get answer in one of them, I will inform in the other.
I have a matrix B which is sparse and try ...

**0**

votes

**0**answers

16 views

### fast computation of matrix trace norm in R

I have a square symmetric real matrix S of dimension 31. I want to compute its trace (nuclear) norm, Frobenius (Hilbert--Schmidt) norm and operator (spectral) norm. I am using eigen:
x <- eigen(...

**0**

votes

**0**answers

7 views

### Find the reflection transformation matrix between two cloud points

I have two 3D cloud points (that i am sure they are mirrored) and I need to find the reflection transformation matrix. Using SVD algorithm, i am able to find a transformation matrix T, but it is not a ...

**0**

votes

**1**answer

13 views

### What cause the “Poly object has no attribute 'expand' ” error?

I have a 4x4 sympy matrix of polynomials:
S = Matrix([[Poly(alpha**4 + alpha**3, alpha, modulus=2), Poly(alpha**4 + alpha**3 + alpha + 1, alpha, modulus=2),Poly(alpha**3 + alpha**2 + alpha, alpha, ...

**0**

votes

**1**answer

24 views

### How would I find the top 10 values of a row every 100 values?

So I have a 1 x 7000 matrix and I am wanting to to find the top 10 values of for every 100th 'sample' group of values, and replace all other values with a zero.
I have a code that works for finding ...

**0**

votes

**0**answers

14 views

### How to construct matrix from idx and idy in R? [duplicate]

I have a dataset be like this:
idx idy value
1 1 137959 1
2 1 71936 1
3 1 351198 1
4 1 484804 1
5 1 470068 1
6 1 294349 1
7 1 410560 1
8 1 ...

**0**

votes

**3**answers

48 views

### Question about the difference between Integer triple pointer and float triple pointer

I'm doing a project for school and they force us to use a type float triple pointer in a function that multiply two matrices,
and for the last day i can't figure out why when I'm using int triple ...

**0**

votes

**0**answers

5 views

### Fastest implementation to convert a matrix to LAPACK

I have a function that converts a matrix to what LAPACK routines in SciPy requires. The function is
def convert_matrix_lapack(Amat,out):
for ii in range(Nz):
out[(2*Nz-2-ii):(3*Nz-...

**0**

votes

**2**answers

54 views

### Minimization problem with linking constraints in R

How should I incorporate the linking constraints into the optimization problem formulation in equations 1 - 4 where Y_i's are binary variables?
minimize
22X11 + 20.5X12 + 21X13 + 19X14 + 21X21 + ...

**0**

votes

**1**answer

13 views

### Convert multiple columned dataframe to 3D matrix in R

I have a dataframe similar to the one below:
trial Card1_colour Card1_number Card1_shape Card2_colour Card2_number Card2_shape ......
1 1 1 0 0 1 ...

**0**

votes

**0**answers

44 views

### Matrix Multiplication doesn't work for inner dimensions greater than outer in C

I am writing a code to multiply matrices of any dimensions. I noticed it works fine for square matrices as well as when the outer dimensions are greater than inner. However, I can't get it to work for ...

**1**

vote

**2**answers

22 views

**0**

votes

**1**answer

26 views

### I want to combine a list of tuples in python [duplicate]

I have a list of tuples of x and y coordinates such as:
[(1,2), (3,4), (5,6)]
and I want to manipulate the list to become a 2xN matrix(depending on how many numbers) so that I have a list of just ...

**0**

votes

**1**answer

7 views

### How to generate a non square matrix m*n in python? Given length L and if L is not a perfect square m > n

I am trying to generate a grid symmetric or asymmetric based on the given length L
when L is a perfect square
L = 4, m=n=2
L = 9, m=n=3
but if L is not a perfect square
L = 6, m=3,n=2
L = 7, m=4,n=2
...