matrix-multiplication

Collada and Skeletal Animation

I am attempting to implement a skeletal animation setup within a game engine I am currently coding for my practicum at school. The engine is coded in c++ and directx 10 using a right handed system. Currently I am using collada for importing and loading meshes (I know it's not the best solution available). The setup I am using uses quate...

Translation and rotation matrix

Hi, Does anyone have code to perform the matrix calculation for translation and rotation of a point I. 2D, please? Ive been looking all over the net and not found it in a form I can use. I'm coding in lua, but any other language would be fine. Many thanks, Matt. ...

Multiplying three matrices in BLAS with the middle one being diagonal

A is an MxK matrix, B is a vector of size K, and C is a KxN matrix. What set of BLAS operators should I use to compute the matrix below? M = A*diag(B)*C One way to implement this would be using three for loops like below for (int i=0; i<M; ++i) for (int j=0; j<N; ++j) for (int k=0; k<K; ++k) M(i,j) = A(i,k)*B(...

Matrix multiplication with Numpy

Hi all, Assume that I have an affinity matrix A and a diagonal matrix D. How can I compute the Laplacian matrix in Python with nympy? L = D^(-1/2) A D^(1/2) Currently, I use L = D**(-1/2) * A * D**(1/2). Is this a right way? Thank you. ...

Java Matrix processing time

Hi All, I need simple opinion from all Guru! I developed a program to do some matrix calculations. It work all fine with small matrix. However when I start calculating BIG thousands column row matrix. It kills the speed. I was thinking to do processing on each row and write the result in a file then free the memory and start process...

How to convert a matrix to a 1 dimensional array in R

Hi I have a matrix file that is 32X48 and I want to put all of the values into a single dimensional array in R. Right now I am only able to get the last row of data. trgtFN_intensity <- "1074_B09_1- 4_5mM_Xgal_7d_W.cropped.resized.grey.png.red.median.colony.txt"; read.table(trgtFN_intensity, sep="\t") -> tmp_int maxrow_int <- nrow(...

Float and double precision in c#

Hi all, Having a bit of a problem here on a matrix multiplication code. I seem to lose precision on large matrices multiplications (my code runs fine on small matrices). My loop is the following : for (int j = 0; j < columns; j++) { float[] column = otherMatrix.Column(j); for (int i = 0; i < rows; i++) { double s =...

Matrix multiplication in numpy

Hi, The numpy docs recommend using array instead of matrix for working with matrices. However, unlike octave (which I was using till recently), * doesn't perform matrix multiplication, you need to use the function matrixmultipy(). I feel this makes the code very unreadable. Does anybody share my views, and has found a solution? Thanks...

Bad memory allocation C++ for a vector

I get std_bad_alloc error in the following code. It seems the problems is when I add the matrix to the vector, the program crashes when I get to that line in the debugger. The problem is that only the first two matrices are read from the file, the other two aren't because the program crashes with the above error. ...

Why is the performance of these matrix multiplications so different?

I wrote two matrix classes in Java just to compare the performance of their matrix multiplications. One class (Mat1) stores a double[][] A member where row i of the matrix is A[i]. The other class (Mat2) stores A and T where T is the transpose of A. Let's say we have a square matrix M and we want the product of M.mult(M). Call the produ...

Programming problem - Game of Blocks

Hi guys, maybe you would have an idea on how to solve the following problem. John decided to buy his son Johnny some mathematical toys. One of his most favorite toy is blocks of different colors. John has decided to buy blocks of C different colors. For each color he will buy googol (10^100) blocks. All blocks of same color are of sa...