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.
41,009
questions
0
votes
2
answers
26
views
I am using python for some matrix related program how can I display it in the form of a matrix. (The ends match indentation regardless of digits)
I am using python for some matrix related program how can I display it in the form of a matrix. (The ends match indentation regardless of digits) like it should not be:
[1,304,67]
[387,378,2]
[6783,2,...
-3
votes
0
answers
13
views
How to start learning coding with great achievements [closed]
I need some ideas that make me aware about the concepts of coding languages and how to learn it with great achievements.
I have tried multiple coding platforms for leering loop like for, while, if, ...
0
votes
0
answers
22
views
Procedural genaration in c++ [closed]
I have a problem that i have a project to make a game in c++, but i got stuck in random mp generation.I need to create a matrix that is basically a procedurally generated dungenon map, with rooms and ...
-1
votes
0
answers
11
views
How would I apply per-frame translation for animation?
Working on implementing animation and im slightly confused about something. I have a position offset which is an offset from the parent joint, together they form a bone. I have a per-frame translaton ...
2
votes
2
answers
38
views
How can I draw a spiral pattern using Python? (Matrices)
This is not a homework assignment, just me preparing for my final programming exam. We were introduced this problem just to think, not to solve, but I would like to know how to deal with this type of ...
-1
votes
0
answers
14
views
Multiplying two matrices using Aparapi - not working in 3D range
Currently working on a Java library for matrix operations and ML.
I use Aparapi to utilize the GPU.
I've written this code to multiply two matrices:
public static NDmatrix matMul(float[][] a, float[...
0
votes
1
answer
35
views
Add two matrices
I have a problem "Index was outside the bounds of the array." and can't understand where is a problem
static void Main(string[] args)
{
Console.WriteLine("If you want add elemenets of ...
0
votes
0
answers
10
views
I'm trying to create a matrix using a loop to try an work out True Diversity
I'm trying to use the ‘d’ function to estimate qD for q=0,1 and 2 and as this function only takes one community and one value of q at a time, trying to write a short loop to work out everything but I ...
0
votes
0
answers
8
views
Matrix Client-Server API: easiest way to get message count by room?
I'm a member of a Matrix instance. I would like to get a count of how many messages have been sent in a specific room. I've been looking around the API documentation, and I don't see an obvious way to ...
0
votes
0
answers
26
views
Python Matrix calculator GUI using Tkinter
Please, help me understand how to fix my code.
The "=" button is not displaying in the show_matrix_rank_page() function.
Here is my code.
def matrix_rank_input():
clear_frame(main_frame)
...
0
votes
0
answers
32
views
perspective divide and clipping
EDIT:
Restated question. If you look at the first image in this original question, the problem might be restated as: "what coordinates of the image are at the corners of the axis-aligned bounding ...
0
votes
0
answers
43
views
Where is the issue in this code segment that's resulting in the matrix being printed as one row?
I am writing a c program that should take the data in a file called "input.csv" and write it into a matrix, then create a file called"output_print.txt" that prints said matrix in ...
-1
votes
1
answer
30
views
How to generate all possible 3x3 matrices with fixed first row and column with entries from 0,1,2
I want to fix the first row and first column of the matrices to be 0 1 2..only such matrices is to be filtered among all possible 3x3 matrices with entries from 0,1,2. Later I have to check one ...
-1
votes
0
answers
17
views
Creation of a Transitional Probability Matrix in Python or R: How to proceed?
I need to create a transitional matrix, but I've never done this before and I would like to do it on Python or R.
I am used to work with stata, so I am beginner in Python and R.
So, to give a bit of ...
0
votes
1
answer
61
views
Tensor (5-dim matrix) in python pandas?
I have a CSV file that looks like
time
Col_A
Col_B
Col_C
Col_D
Price
123
A1
B1
C2
D6
23.43
124
A5
B3
C7
D1
14.63
125
A3
B2
C3
D2
343.43
126
A2
B1
C2
D6
43.43
127
A1
B1
C7
D2
6.63
Now I want to ...
0
votes
0
answers
19
views
Object is not suscriptable when using a matrix from another class
I have this code with a class called Board that contains a method called generateSuccessors that goes through an array and generates the children of a Board object, which are all the arrays with ...
0
votes
0
answers
15
views
Making a transition matrix monotonic
I have transition matrices containing ratings that I need to make monotonic. The counts need to decrease monotonically either side of the diagonal.
I have tried using SAS, but without access to IML I ...
0
votes
1
answer
66
views
Manually perform predictions using the model weights and biases (Keras)
I'd like to manually predict data (regression task) using the model weights and biases in Keras (i.e., Z = f(WX+B), where Z is the output of a layer, W is the weight matrix, X is the input vector, and ...
5
votes
2
answers
130
views
Find Faster R Computation for Iterative Matrix Computations
I have the following code that lives inside an optimization routine. Hence, while it's reasonably fast, profiling shows the line producing the result called res to be the largest bottleneck in my code....
0
votes
0
answers
15
views
Algorithm or method for matrix decomposition of a unitary complex matrix
I am trying to decompose a matrix T into the form u1*v*u2*v...v*u_n, where v=F*H*F is a given matrix, here F is just the Discrete Fourier Transform matrix (a unitary complex matrix) and H is unitary ...
2
votes
0
answers
45
views
How to implement Cannon's algorithm in Go using channels?
I am implementing Cannon's algorithm in go using channels, but channels synchronisation makes it sequential. How to achieve concurrency to make it faster?
package algorithms
import (
"fmt&...
0
votes
2
answers
41
views
What is the fastest way of finding non-empty cells in a matrix
I am working with Office.js development, you don't need to know anything about it since the question relates more to Javascript. In Excel you can get a matrix of formulas with a function, that is an ...
0
votes
0
answers
26
views
Pairwise comparisons of submatrices in a loop in R
I study song learning in birds. I have one matrix for each male bird and his father, comparing all the songs of the 2 individuals, the male has the rows and the father has the columns. Each song has ...
2
votes
2
answers
33
views
Use matplotlib plot_surface to plot a matrix that contains NaN values
I would like to plot a matrix that contains a combination of float and NaN values. This is a 3D plot where X and Y are the matrix coordinates and Z is the value within the matrix.
NaN values should be ...
0
votes
2
answers
22
views
Is there an R function (in terra?) that takes a raster (representing a map) and returns a raster of the areas of the patch to which each cell belongs?
I've written an R function that takes a raster-based map, and counts the area and perimeter of patches of a given habitat type. However, it's vectorised, hence painfully slow on large maps. I need ...
1
vote
1
answer
66
views
How to accelerate convolving function?
I have written a convolving function like this:
import numpy as np
import numba as nb
# Generate sample input data
num_chans = 111
num_bins = 47998
num_rad = 8
num_col = 1000
rng = np.random....
0
votes
0
answers
4
views
How to transform a matrix into a list but keep the row and column identifiers in excel or R
I have a matrix that has two rows and two columns as identifiers which I need to keep in to do further analysis, I can turn it into a list with only one row and one column labels but not with both ...
2
votes
1
answer
32
views
How to produce a 3D plot of a 2D numpy matrix in python/matplotlib?
I have a 2D numpy matrix that I would like to plot as a 3D surface plot using matplotlib.
For each X between X0 and Xend and Y between Y0 and Yend, I would like to plot a dot with a Z-value equal to ...
0
votes
1
answer
28
views
(Google Sheets) How to find column 1 and row 1 values for a matrix of occurrences in which both are present in data
( edit: Rough idea of what I'm trying to do: https://docs.google.com/spreadsheets/d/12rIUiuE-TSB0E3XRSnQ0YU9BCpuTsHfrUZXgCvxOE44/edit#gid=2100307022 )
I feel like this should have a really simple ...
0
votes
1
answer
32
views
Train ML Classification Mode
I am trying to train a model to determine the position of a person and his stance by coordinates. I need Multi-output classification model.
So I have csv data:
import pandas as pd
from sklearn....
0
votes
1
answer
89
views
Step by Step sudoku solver in python
import sys
def main():
with open(sys.argv[1], 'r') as f:
s1 = f.read()
s2 = s1.split()
for i in range(len(s2)):
s2[i] = int(s2[i])
grid = [s2[i:i+9] for ...
0
votes
1
answer
38
views
Cropping a circle from a matrix in R
I have a large matrix mydata (~2000 X 2000) from which I want to crop some data. I need to get all the values of the cells around a "center cell" in some radius and set all other cells to be ...
-1
votes
0
answers
27
views
I'm trying to copy an array with random unique numbers inside a matrix but it only works when num of rows=number of cols in python
I need to fill a matix with random unique numbers then sort them without using built in functions
but this code here works on a matrix which number of rows=number of cols
thanks everyone I found the ...
-3
votes
0
answers
25
views
working with matrix data with text values [closed]
to convert the values into unique values and place them as column headers and get the respective count in each column against each row as shown in the picture.
this picture has sample data, Categories,...
0
votes
1
answer
22
views
Generate in Excel 365 a matrix from rows and columns with one array function
Suppose we want to make in Excel a matrix from a row of values and a column of values (or labels). For years a way to write a single formula to fill this matrix was to write an absolute column ...
-1
votes
1
answer
77
views
Why can't I fill a matrix with incrementing numbers in C? [closed]
I'm trying to fill a 5*5 matrix with numbers ranging from 1 to 25. It works well enough until 22 afterwich I get seemingly random numbers.
Here is my code:
int main()
{
int board[5][5];
for(...
0
votes
0
answers
71
views
animation matrix in C
Why does the animation work incorrectly when N > 5 or when there are more than 2 rows (that meet the condition 0)?
How can this be fixed or how can the animation be modified?
I understand that it ...
-1
votes
1
answer
60
views
Problems with matrix in JavaScript (JS) [duplicate]
I want to asign values to a matrix each time that a conditions are comply.
I declarate it as let sortedPieces=[[]]
When is the time for asign values to the second row, debug console shows me this ...
0
votes
1
answer
24
views
Why are the x and y axes not colored black after applying the matrix?
I work with Manim to visualize linear transformations. After applying a matrix to my coordinate system, I want to color the x and y axes black. However, the color of the axes remains unchanged. Here ...
1
vote
2
answers
81
views
keep only the rows l, l+1, ... ,r in the matrix and deallocate the rest
I want to keep only the rows l, l+1, ... r in the matrix and deallocate the rest
ex:
1 2 3 4
5 6 7 8
9 0 1 2
for l=1 and r=2 the output is:
5 6 7 8
9 0 1 2
This is what I tried:
void select_rows(...
-2
votes
0
answers
21
views
How to Shrink a Square Matrix That Has Some Zero Rows and Columns [closed]
I am studying civil engineering and in a subject of structures by matrix analysis the professor allows us to use a graphing calculator which I have a Texas Instrument and it uses the Ti Basic language,...
1
vote
1
answer
71
views
Printing 2D array using recursion (C programming)
I'm currently practicing recursion so I can use it in the Tideman CS50 problem. Specifically, I'd like to learn to traverse a matrix (2D array) using recursion.
For practice purposes, I've created a ...
0
votes
0
answers
66
views
Better segment tree query function for matrix multiplication
I have this segtree function to query for a matrix multiplication at a specific range
Matrix *Segtree::query(int a, int b, int p, int l, int r) {
if (b < l || r < a)
return this->...
-3
votes
0
answers
125
views
search element(tuple) return index of list of list(matrix)
I have a matrix (list of list)the dimension is 701(row)*576(column) which the elements are tuple:
matrix=[[(1.5,5.5),(1.5,5.6),(1.5,5.7),
(1.7,5.8),(1.7,5.5),(1.7,5.6),
...
0
votes
0
answers
29
views
how to write an fscanf argument that properly stores values and works with varying matrix sizes?
i have a 15 x 5 grid of ones and zeros in a file. how do i store them in a t[15][5] block?
the first line of the file is the dimensions of the matrix, then starting from the next one its the grid. ive ...
0
votes
1
answer
60
views
Calculating distance from a camera to a plane of a cube in opengl
I am trying to get transparency blending to work properly on my cube and I have hit a bit of a roadblock. I have gotten blending to work on multiple cubes by simply drawing them in the correct order ...
0
votes
0
answers
8
views
Font issue with matrix in rdl file - Power BI paginated report
In Power BI Paginated Report we have selected the font type for the rows in the Matrix.
When we export the Excel file from Power BI the matrix is collapsed like this, and the font is the right one ...
-1
votes
1
answer
60
views
Logical error in matrix calculation code in C. error suspected in scope of Arrays
I was expected to write a C code where we initialize Two matrices, both of size 100 by 100. the user is to input the sizes of the matrices that he wants to multiply and input the values too.
The ...
0
votes
1
answer
69
views
Significant correlations between two dataframes
I want to find a significant correlation between two large dataframes (FDR < 0.05). How do I modify the code to run faster? The cor.mtest(cor) has taken several hours.
Running on a small dataset ...
1
vote
1
answer
69
views
Find the number of unique nodes in a graph in Python
Given a graph with the format (source, destination, weight):
graph = [
(1, 2, 2),
(1, 3, 7),
(2, 3, 1),
]
I need to assign num_nodes to be the number of unique nodes in the given graph. ...