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.

0
votes
2answers
21 views

How do i convert an R matrix to Excel so that all values in the R-matrix are in separate cells in Excel?

I cannot export an R matrix to Excel with the values of the R-matrix exported in separate cells in Excel. When I use the write.csv or write.table functions and try to open the output in Excel, the ...
0
votes
3answers
26 views

perform calculation on all combinations of columns of a matrix

I am trying to apply a function to a very large matrix I want to eventually create a (40,000 by 40,000) matrix (where only one side of the diagonal is completed) or create a list of the results. The ...
1
vote
0answers
11 views

How to do this function about scale ,rotate and translate use matrix with flutter

Can you help me with this function? Single finger control image rotation/zoom/panning is achieved using matrix4 on the flutter platform. Rendings show: https://upload-images.jianshu.io/upload_images/...
1
vote
2answers
40 views

How to iterate through a Matrix without 2 for-loops

I have an exercize that demands an iteration through the elements of a matrix 'm', the difficulty is that the running time is supposed to be linear, meaning that if I use forloops, only one is allowed....
0
votes
0answers
10 views

Term for the following matrix operation?

Given a square matrix A whose dimension is n x n, I want to create a vector v whose dimension is n such that v[i] = A[i:] * A[:i] where i = [1, ..., n]. Is there a term for this type of matrix ...
0
votes
3answers
16 views

How to find the Verticle Average of a Martrix?

Given a 2 dimensional array ie. array m = [[1,2], [2,4], [6,6]] How would one take the verticle average of said array, producing something like: //[(1+2+6)/ 3, (2+4+6)/3] ...
1
vote
2answers
43 views

Find Maximum abs. value for each group of row index, Arrange max. values diagonally in matrix, non diagonal values as per indexes,find determinant

I am new to Python. I want to find the largest values from all the columns for group of same row indexes (i.e. 5 to 130, beignning with 5), and also show its row and column index label in output. ...
0
votes
0answers
5 views

Which package for ahp (with multiple decision makers, 3 criteria, 11 sub-criteria and 5 alternatives) ? How to load data?

I have to run AHP on the data I collected. My data are now in a spreadsheet in form of pairwise comparison matrixes (PCMs) for each of 11 decision makers (DMs) (160 total matrixes because 11 decision ...
-1
votes
1answer
14 views

Wrong output when converting matrix to raster

I'm testing some codes of converting matrix to NetCDF file. But the output produces a strange raster/matrix that was in a completely different order. Any idea of the cause? This is the matrix mx <...
1
vote
2answers
24 views

Visualize intersection of dataframes in table or matrix

I have three dataframes, and I want to visualize the intersection between each other. Say I have three dataframes as shown below: length(df1) length(df2) length(df3) [1] 283 [1] 290 [1] 295 I ...
0
votes
0answers
4 views

apply matrix to bundler out

I have a bundle .out file from photogrammetry and I manage to align this file to the 3D model of the object which is based on real life measurement. The alignment (done with another software) produces ...
-2
votes
0answers
22 views

About matrix, how can i write?

Im doing Tasks for trainning Python. But i couldnt this Quiz...so anyone help me? →Read two matrices from a file named 'matrix.txt'. File will be formatted like this, First line will hold row number ...
0
votes
1answer
17 views

in which memory address is stored an element in a multidimensional matrix?

If the arrays are stored per rows and char a[100][100][100] is a multidimensional array of characters with a[0][0] which has address 0x1000, which is the address of a[5][5][10]? The solution is ...
1
vote
1answer
21 views

Return Index Row Number of N Minimum/Maximum Value for Each Column of Matrix

An extension of this post: Return Index of Minimum Row for Each Column of Matrix Suppose I have a matrix like the example below called m1: m1<-matrix(6:1,nrow=3,ncol=2) [,1] [,2] [1,] 6 ...
0
votes
1answer
33 views

C - Printing elements of a 2d array inside a struct array

Im trying to make a function that sets the values of a 2D array, and then another function that prints those values. For some reason, with my current implementation, if I create a 3x3 matrix and I ...
0
votes
0answers
24 views

Plotting an expression involving matrix multiplication

My goal is to produce a plot of the following one-variable function where n, the c's and t's are fixed inputs, and y is my scalar variable. In the editor I created a function price_obli.m which ...
0
votes
0answers
35 views

How to do padding for a matrix

I am trying to do the padding for a basic matrix. For example, I have a 3 * 3 matrix and I want to pad it to 7 * 7 matrix: 3x3 Matrix 1 2 3 4 5 6 7 8 9 Is there ...
2
votes
1answer
70 views

Find largest value from multiple colums in each group of row index in Python, arrange those values diagonally in matrix, and find determinant

I am new to Python. I want to find the largest values from all the columns for repetitive row indexes (i.e. 5 to 130), and also show its row and column index label in output.The largest values should ...
0
votes
2answers
43 views

Matrix with dynamic dimension in matlab [on hold]

In a do-while loop until its end, in each iteration a new column should be added to a predefined matrix. I couldn't find how to define such a matrix in matlab? is there a standard method for defining ...
0
votes
0answers
40 views

How to increment value in a struct matrix in c?

I've calloc'd a correlation matrix in a struct but am unable to increment/set values in that matrix. The struct is typedef struct matrixStruct{ char** word; int numberOfWords; int** ...
2
votes
1answer
45 views

How to create a binary matrix with rand() and a specific proportion of ones?

I am setting up my mathematical model, but now I am struggling with manipulating the data. I want to create a random binary matrix (0,1) where the ratio of 1 over the total is equal to some specific ...
0
votes
1answer
26 views

How to create a heatmap matrix in R with preserving the structure of the matrix?

I want to create a correlation heatmap matrix. I followed this tutorial. Here is the code: mydata <- mtcars[, c(1,3,4,5,6,7)] cormat <- round(cor(mydata),2) # Get upper triangle of the ...
-1
votes
0answers
13 views

For the adjacent matrix graph how to transpose graph [on hold]

i have a homework is about adjacent matrix directed graph algorithm, i am a little confused about how to transpose the graph, can anyone give me a c++ pseudocode please....
0
votes
2answers
39 views

Replace with 0 when retrieving data from a matrix

I am filling in the values ​​of a column in a data frame from the values ​​present in a matrix. The search for the value is performed from two columns called e1 and e2. But it is possible that in any ...
1
vote
2answers
67 views

How to “Inflate” (like in rectangle) or scale a hexagon

I'm currently working a project with a grid filled with hexagons. Every hexagon has the exact same size and I'm painting a border for every of them.
0
votes
1answer
34 views

How to find 2 largest values from group of rows in multiple columns in Python and also show its row and column index without duplicates

I am new to Python. I want to find the largest values from all the columns for repetitive row elements (i.e. 5 to 150), and also show its row and column index label in output.The largest values should ...
-1
votes
0answers
30 views

Strassen’s Algorithm vs Optimal Parenthesisation

If I have 100 square matrices, each having 40000 elements. What method should I use for multiplying the matrices- Strassen’s algorithm(O(n2.8)) OR via Matrix Parenthesisation(O(n3)) to get smallest ...
3
votes
1answer
45 views

How in numpy get elements of matrix between two indices arrays?

Let's say I have a matrix: >> a = np.arange(25).reshape(5, 5)` >> a [[ 0 1 2 3 4] [ 5 6 7 8 9] [10 11 12 13 14] [15 16 17 18 19] [20 21 22 23 24]] and two vectors of indices ...
1
vote
1answer
24 views

Dynamically get the values from a matrix

I want to add a new column to my data frame based on values from a transition matrix. I tried this solution [R extract values from matrix given dataframe of x and y but it seems to work for numbers ...
1
vote
2answers
52 views

Pythagorean Theorem to check whether a cell is inside the radius

I have the dimensions of a matrix and a given cell with radius. So let's take a look at this example: The matrix has 5 rows and 6 columns. We are given the cell (2, 3) with radius 2. It has an ...
1
vote
1answer
30 views

Sympy: get a column of a matrix power

This seems to be a simple question. My code reads import sympy as sp D1 = sp.symbols('D1') D2 = sp.symbols('D2') m1 = sp.diag(*[2 * D1, 2 * D1, 2 * D2, 2 * D2]) b = sp.sqrt(m1) m1.col(0) b.col(0) I....
1
vote
3answers
43 views

How to calculate percentages for rows and columns in a cross-tab?

I have a 3 level contingency table for which I'm trying to calculate the percentages for each cell of the table as a function of the sum row total for each row and then a function of the sum column ...
0
votes
1answer
61 views

Matrix column comparison

I have to compare matrix columns. I tried many variations, but as far as I got, is when I compare "next to each other" columns. // N rows // M columns #include <iostream> using namespace std;...
2
votes
3answers
46 views

Getting items from a numpy matrix, that indexes are in an array

I'm trying to convert a matlab code into python and I faced a code like : a=[1 2 3;4 5 6;7 8 9] b=[1, 4, 8] a(b) //output : ans : 1 4 8 this actually getting indexes from b and doing a.item(x) ...
-2
votes
2answers
28 views

Building an upper triangular matrix recursively

Ive been breaking my head over trying to come up with a recursive way to build the following matrix in python. It is quite a challenge without pointers. Could anyone maybe help me out? The recursion ...
0
votes
0answers
11 views

Assigning matrix values with array indices [duplicate]

I want to access a numpy array M with an array index of length D and store to that same array M with another matrix N of dimension DxD. So I've tried the following things. I really won't want to loop ...
0
votes
3answers
95 views

I need some assistance with creating a function

I am new, not that good with functions, and I am trying to solve this question: Suppose A, B, C are arrays of integers of size [M], [N], and [M][N], respectively. The user will enter the values ...
-1
votes
0answers
17 views

Error while computing the fisher's exact test in r

I am trying to compute the fisher's excat test in a matrix in r and I have this reccurrent error "Error in fisher.test(ir_matrix_albo) : all entries of 'x' must be nonnegative and finite" ... ...
1
vote
1answer
53 views

Return the indices of arrays in a 2D numpy array that meet a condition

I have a large 2D numpy array and want to find the indices of the 1D arrays inside it that meet a condition: e.g., have at least a value greater than a given threshold x. I already can do it the ...
0
votes
1answer
36 views

Struct or matrix for a register?

I want to have a register containing 4 bytes of address and 4 bytes of data. For that, I thought about building it in an array of structures (containing address and data as members) or in a matrix. ...
1
vote
1answer
34 views

How to create a matrix from product of all elements in two arrays?

I was reading the documentation for matlab on element-wise multiplication and I came across this example: Create a row vector a and a column vector b, then multiply them. The 1-by-3 row vector ...
-5
votes
0answers
39 views

extract matching rows from a matrix and average them and produce a new matrix

I have two matrices which contain unique rows. Also, I have another matrix which doesn't have unique rows. I have to select unique rows from the second matrix with respect to the first matrix and if ...
1
vote
1answer
24 views

Replace values from a certain row onwards column-wise

I have a 10x5 double matrix mat. I also have a 1x5 row vector start_rows. In mat I would like to replace all numbers from specific rows onwards using start_rows. I could use a loop and replace all the ...
3
votes
1answer
107 views

Square with Maximum Sum

I am learning C#, and I am doing Multidimensional Arrays at the moment. I want to write a program that reads a matrix and then finds the biggest sum of 2x2 submatrix and prints it. int[] dimensions = ...
0
votes
1answer
34 views

Create Matrix Of Row

I have a vector like this: {1, 2, 3, 4} How would I make it so it prints out a matrix or returns it into a row like this: { {1} {2} {3} {4} } I have a function that creates a matrix that takes a ...
0
votes
0answers
28 views

make loop of requests in kotlin with callbacks and returned objects

I am using an open source sdk called matrix to build chat app The structure of it is to make request to get all joined rooms by user, this request will only retrieve roomId, then you have to make ...
1
vote
1answer
42 views

OpenGL Make Object Stick to Camera

In my adventures to better understand what exactly is going on with matrices and vertex math with OpenGL, I wanted to see if I could get an object to "stick" in front of my "camera". I have been ...
-1
votes
0answers
18 views

How Can I use Bing Maps Distance Matrix API in mvc? [on hold]

I want to specify a set of origins and destinations on the Microsoft Bing map and get a matrix including the time between the origins and the destinations. How can I do that in mvc? Can someone help ...
1
vote
2answers
46 views

How to read a matrix from the console and print the sum of all matrix elements

I'm learning C#, and now I am on Multidimensional Arrays. I want to write a program that reads a matrix from the console and print: Count of rows Count of columns Sum of all matrix elements So, on ...
1
vote
1answer
42 views

Is there an R function for finding complex numbers and counting them?

I generated 1000 2x2 matrices whose elements are random numbers that range between -10 and 10. I provided the codes I have so far. But I'm not sure if this is the right code to find whether my list ...

http://mssss.yulina-kosm.ru