matrix

matrix multiplication for integral types using BLAS

Is there an equivalent of dgemm (from BLAS) for integral types? I only know of dgemm, sgemm for double precision / single precision matrices, but would like to have it for matrices that are of integral type such as int (or short int...). Note: I'm not looking for a solution that involves converting to float/double, and am looking for a ...

converting an ftable to a matrix

Take for example the following ftable height <- c(rep('short', 7), rep('tall', 3)) girth <- c(rep('narrow', 4), rep('wide', 6)) measurement <- rnorm(10) foo <- data.frame(height=height, girth=girth, measurement=measurement) ftable.result <- ftable(foo$height, foo$girth) I'd like to convert the above ftable.result into a matrix with ro...

Accesing a matrix element in the "Mat" object (not the CvMat object) in OpenCV C++

Does anyone have any idea how to access elements by row, col in OpenCV 2.0's new "Mat" class? The documentation is linked below, but I have not been able to make any sense of it. http://opencv.willowgarage.com/documentation/cpp/basic%5Fstructures.html#mat ...

Matrices and inverse Matrices in Python

For a project that I am doing, I decompose a graph that I created using NetworkX into an adjacency matrix using the NetworkX adj_matrix() function. However, one of the problems that I have come across is that every single graph that I decompose gives me the following error when I try to find the inverse of the matrix. str: Traceback (m...

Calculate most common values

If i have a matrix A with n values spanning from 65:90. How do i get the 10 most common values in A? I want the result to be a 10x2 matrix B with the 10 common values in the first column and the times it appears in the second column. ...

resampling, interpolating matrix

I'm trying to interpolate some data for the purpose of plotting. For instance, given N data points, I'd like to be able to generate a "smooth" plot, made up of 10*N or so interpolated data points. My approach is to generate an N-by-10*N matrix and compute the inner product the original vector and the matrix I generated, yielding a 1-by-...

Multiplying by inverse matrices?

If I have a matrix which is a combination of World*View*Projection and I multiply it by the inverse of the projection does it yield the World*View matrix or something else? If not then how can I extract the World*View matrix from a World*View*Projection matrix? Thanks for any help :) ...

Matrix power to minimize error in neural network using Newton's method

Hello, I have a non square matrix A and i want to know A^2. Actually i am working in neural network newton optimization method using second order Taylor series such that I want to multiply the hessian matrix H(second derivative) with the square of the weight vectors. It is written as: Delta(w(n))' * H(n) * Delta(w(n)) Actually it is ...

Trying to derive a 2D transformation matrix using only the images...

Hi, I dunno if this should go in a Math forum or a Programming forums, but I'll post it in both and see where I get. I have two computer images... one of them is an "original" image (a large TIF file). The other one is a transformed version of the original image... it's been rotated, sheared and translated in a software program. I need ...

From Rectangle into trapezoid

Hi, how can i transform rectangle into trapezoid with ActionScript3 my trapezoid is a floor of 3D room, and i want to texturize it (bitmap tile). _____________ | | | | | |_____| | | / \ | | / trapez.\ | |/__________\| ...

What is the complexity of matrix addition?

I have found some mentions in another question of matrix addition being a quadratic operation. But I think it is linear. If I double the size of a matrix, I need to calculate double the additions, not quadruple. The main diverging point seems to be what is the size of the problem. To me, it's the number of elements in the matrix. Other...

How to Get a Quantitative Comparison of Two Signals

I’m trying to implement a Blind Source Separation (BSS) algorithm and I’m running into trouble determining the efficacy of the algorithm. I’m trying to create test cases where I work backwards and start with a signal vector s, which is normally unknown, and then create a mixing matrix A, which I use to transform s to create the observa...

Chain of connected points and rotation matrices

Thanks for looking at this. I apologize for this rather lengthy build-up but I thought it is needed to clarify things. I have a chain of connected atoms, say a polymer which has rigid bonds and bond angles. With rigid bonds we get the condition that the distance between two immediate neighbours [eg. 2-3,3-4,etc.] is always fixed and the...

Creating 2-D matrix in php

The thing is I have to create a 2D matrix in php where each row and column must have a key. I tried to do this but what happens is that a 2-D array is created which does not resemble a matrix. I used the following code: $x=$row['start_id']; $y=$row['dest_id']; $d=$row['distance']; $this->map[$x][$y]=$d; Here map is the intended matri...

How to find determinant of large matrix

I found some C++ code for finding the determinant of matrix, for 4x4 to 8x8. It works ok, but my project needs matrices that are 18x18 or more, and the code is too slow. The code is recursive, but is recursion the right concept to deal with an 18x18 matrix? How else can I find the determinant? ...

find row of matrix with most numbers < 10 method.

Hi, I cant imagine how to create this method: I can find numbers<10 with if loop and store them with count++; But thats all. Id like to see the algorithm in any lang(I can do some C++,java), so I can use it. Go through each row and record a count of numbers less than 10. Store that aside, go to next row, do same thing, compare, throw o...

Transformation matrix C#

The Christmas is coming and I got idea to send electricity card (little program). Something like dropping snow would be fine. But it is little bit boring something nice extra effects would be nice. Then I find this little flash example. http://wonderfl.net/code/71344f9a655053d9f793a32c68f00921c67f1977 But I don’t have idea how to conve...

MATLAB - usage of knnclassify

When doing: load training.mat training = G load testing.mat test = G and then: >> knnclassify(test.Inp, training.Inp, training.Ltr) ??? Error using ==> knnclassify at 91 The length of GROUP must equal the number of rows in TRAINING. Since: >> size(training.Inp) ans = 40 40 2016 And: >> length(trainin...

Are there any matrix math modules compatible with Python 3.x?

When I began this project, I thought it would be easy to get libraries for common stuff like matrix math, so I chose to work in Python 3.1- it being the most recent, updated version of the language. Unfortunately, NumPy is only compatible with 2.5 and 2.6 and seems to be the only game in town! Even other stuff that I turned up like gam...

How can I generate the following matrix in MATLAB?

I want to generate a matrix that is "stairsteppy" from a vector. Example input vector: [8 12 17] Example output matrix: [1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1] Is there an easier (or built-in) way to do this than the following?: function M = stairstep(v) M = zeros(...