Category "matrix"

Using a matrix plot (matplot) as map and positions as locations

I'm interested in using a matrix plot as a field map and certain locations in matrix as specific plants (locations within field). I'm using this data: Field<

How to implement outer product of two vectors in Scheme?

I want to define a function in Scheme that will compute the outer product of two vectors. for example: (outerProduct '(1 2 3) '(4 5)) the output is supposed to

How can I apply fisher.test in R to a large matrix, and extract p-values to a new matrix?

I have a large matrix (12 rows, 53 columns) with counts of how many times genes in my clusters "A", "B", "C", etc. overlap with clusters created by someone else

Python Numpy - Treat really small numbers as zero

I want to calculate the Determinant of a Singular Matrix (which has a 0 determinant) with Numpy and when I print the determinant it shows a really small number

Why is numpy.linalg.pinv() preferred over numpy.linalg.inv() for creating inverse of a matrix in linear regression

If we want to search for the optimal parameters theta for a linear regression model by using the normal equation with: theta = inv(X^T * X) * X^T * y one step

How to create an origin-destination matrix from two vectors (in R or Stata)

I have a dataset of commuting by individuals, like this: id Origin Destination 1 1 3 2 1 4 3 2

jblas 2-d matrix multiplication

I want to compute 2d matrix-matrix multiplication using the Jblas library. But I failed every time to compute. Please help me to do this by giving an example w

Counting number of co-occurrences of words for a specified vocabulary and within a specified radius?

I have a vocabulary V = ["anarchism", "originated", "term", "abuse"], and list of words test = ['anarchism', 'originated', 'as', 'a', 'term', 'of', 'abuse', 'fi

Multiply 2x2 Matrix in Python Recursively? No nested loops or numpy

I'm having a difficult time finding a very simple program that multiplies two 2x2 matrices recursively. Can anyone help me out? Just need to multiply X and Y wi

Matlab Special Matrix

Is there a MATLAB function to generate this matrix?: [1 2 3 4 5 6 7 ... n; 2 3 4 5 6 7 8 ... n+1; 3 4 5 6 7 8 9 ... n+2; ...; n n+1 n+2 ... 2*n-1]; I

Implementation of Matlab matrix inverse function in C++ with Eigen

So I need to re-write matrix right-handed division from Matlab to C++: At = (xPow*yPow')/(yPow*yPow'); I mocked some matrices: >> xPow*yPow' ans =

I want to create a 30x30 matrix array of 1s and 0s

I want to create a 30x30 matrix array of 1s and 0s. This will be a maze with 1's being the path and 0's being a wall. but this labyrinth should contain a way gu

Spiral matrix with entered rows and columns

As an assignment i have to create a spiral matrix where the user inputs the number of rows and number of columns. This is my code for far (first year in colleg

Cosine similarity calculation between two matrices

I have a code to calculate cosine similarity between two matrices: def cos_cdist_1(matrix, vector): v = vector.reshape(1, -1) return sp.distance.cdist(

Neighboring gray-level dependence matrix (NGLDM) in MATLAB

I would like to calculate a couple of texture features (namely: small/ large number emphasis, number non-uniformity, second moment and entropy). Those can be co

Implementing matrix operation using AVX in C

I'm trying to implement the following operation using AVX: for (i=0; i<N; i++) { for(j=0; j<N; j++) { for (k=0; k<K; k++) { d[i][j] += 2 *

apa_table() increase table width

How do I increase the width of an apa_table in R Markdown. I'm using the papaja package. I would like the width to be long enough to fit the table's title. This

Extracting all matrices out of a nested list with varying sublist lengths in R

I have a nested list of matrices. More specifically, I have a list of matrix lists, each with a variable number of matrices. I would like to extract all the mat

Multithreading matrix multiplication in C#

I have a task - write multithreading matrix multiplication. Each vector product must be calculated in new thread.(If we have matrices n by m and m by k we must

Tensordot for numpy array and scipy sparse matrix

For a current project I have to compute the inner product of a lot of vectors with the same matrix (which is quite sparse). The vectors are associated with a tw