matrix Questions

4

Solved

I'm implementing Strassen's Matrix Multiplication using python. In divide step, we divide a larger matrix into smaller sub-matrices. Is there a built-in numpy function to split a matrix?
Cosgrove asked 19/6, 2012 at 16:33

3

I am trying to create a randomized matrix in R. It needs to be a presence/absence matrix, such that all values in the matrix are either 0 or 1. But I also need to specify row and column totals, for...
Parapodium asked 17/4, 2023 at 23:2

2

Solved

all, I have a correlation matrix of 21 industry sectors. Now I want to split these 21 sectors into 4 or 5 groups, with sectors of similar behaviors grouped together. Can experts shed me some light...
Schmit asked 12/10, 2018 at 21:53

6

I have several vectors of unequal length and I would like to cbind them. I've put the vectors into a list and I have tried to combine the using do.call(cbind, ...): nm <- list(1:8, 3:8, 1:5) do...
Darlleen asked 3/4, 2011 at 18:12

2

Solved

I am trying to make a fixed-size matrix class. The intent is to make it inherit or utilize a std::array of std::array: template <size_t Rows, size_t Columns, class T=double> struct Matrix : p...
Fayre asked 2/8, 2020 at 0:7

3

Solved

I have a dataset, X, with n rows and d columns. I want to take the dot product with each row to the transpose of itself. In R code this would be x %*% t(x), and this gives a d by d matrix. I then t...
Counterweigh asked 10/4, 2023 at 12:28

6

Solved

I have a numeric matrix with 25 columns and 23 rows, and a vector of length 25. How can I multiply each row of the matrix by the vector without using a for loop? The result should be a 25x23 matri...
Colcothar asked 4/9, 2010 at 18:51

5

Given the following matrix lets assume I want to find the maximum value in column two: mat <- matrix(c(1:3,7:9,4:6), byrow = T, nc = 3) mat [,1] [,2] [,3] [1,] 1 2 3 [2,] 7 8 9 [3,] 4 5 6 I ...
Iraidairan asked 13/4, 2009 at 11:13

9

Solved

It is wanted of me to implement the following function: void calc ( double* a, double* b, int r, int c, double (*f) (double) ) Parameters a, r, c and f are input and b is output. “a” and “b”...
Schizo asked 27/3, 2015 at 23:14

15

Solved

I'm trying to come up with a solution that takes in a matrix like this: [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16]] and returns an array traversing the array as a spiral, so in this e...
Glycerol asked 18/6, 2015 at 4:19

4

Solved

I have a nx1 matrix I want to convert this to a nxn diagonal matrix in R
Adapter asked 25/12, 2013 at 23:51

3

Solved

Suppose I have a matrix foo as follows: foo <- cbind(c(1,2,3), c(15,16,17)) > foo [,1] [,2] [1,] 1 15 [2,] 2 16 [3,] 3 17 I'd like to turn it into a list that looks like [[1]] [1] 1 15 ...
Araldo asked 18/3, 2010 at 15:45

6

Solved

Is there a quick way to "unpivot" an Excel matrix/pivot-table (in Excel or elsewhere), without writing macros or other code ? Again, I can write code (C# or VBA or whatever) that does that myselfs...
Fowliang asked 20/8, 2015 at 10:1

1

Solved

I'd like to write a %*% method for a base matrix subclass. My subclass is an S3 class and the documentation of help("%*%") says that %*% is a S4 generic and that S4 methods need to be wri...
Endocrine asked 31/3, 2023 at 0:49

25

Solved

I've got an array of arrays, something like: [ [1,2,3], [1,2,3], [1,2,3], ] I would like to transpose it to get the following array: [ [1,1,1], [2,2,2], [3,3,3], ] It's not difficult to...
Intra asked 2/7, 2013 at 14:43

1

I want to implement non-negative matrix factorization using PyTorch. Here is my initial implement: def nmf(X, k, lr, epochs): # X: input matrix of size (m, n) # k: number of latent factors # lr:...

5

Solved

I have an existing covariance matrix and I would like to convert it to become block diagonal based on which groups the individual columns belong to (e.g. 1st 2 rows/columns are group 1, next are gr...
Playa asked 17/3, 2023 at 18:9

2

Solved

Is there a function to get an index (row number and column number) for a matrix? Suppose that I have a simple matrix: a <- matrix(1:50, nrow=5) Is there an easy way to get back something li...
Enrollment asked 1/12, 2009 at 22:35

2

Solved

I am currently trying to speed up my large sparse (scipy) matrix multiplications. I have successfully linked my numpy installation with OpenBLAS and henceforth, also scipy. I have run these tests w...
Intermittent asked 2/8, 2014 at 19:32

4

Solved

In python, suppose I have a square numpy matrix X, of size n x n and I have a numpy vector a of size n. Very simply, I want to perform a broadcasting subtraction of X - a, but I want to be able t...
Brahmanism asked 7/9, 2016 at 4:41

2

Solved

The writematrix command can write matrices to text files. For example, for a matrix like the following A = [1, 2, 3, 4]; It can be written to file a.txt using the writematrix command A = [1, 2, 3,...
Paulo asked 26/3, 2022 at 3:33

8

Solved

I'm trying to ask the user to enter the number of columns and rows they want in a matrix, and then enter the values in the matrix... I'm going to let them insert numbers one row at a time. How can...
Rosenblatt asked 5/5, 2010 at 20:7

4

Solved

I have a matrix that contains economic information on industries for several countries. I want to do a series of calculations that depend on the positioning of the element in the matrix and the cor...
Mirk asked 20/2, 2023 at 11:8

6

Solved

How do I create a rotation matrix using pitch, yaw, roll with Eigen library?
Izettaizhevsk asked 28/1, 2014 at 17:9

3

Solved

What is the quickest way to convert the non-diagonal elements of a square symmetrical numpy ndarray to 0?
Fenner asked 5/12, 2017 at 7:14

© 2022 - 2024 — McMap. All rights reserved.