matrix

How do I write/export a few matrices to an XLS file?

I have a lot of matrix variables. Some have more than 200 rows. How can I export them to an XLS or DAT file with their names? I tried the following: d = {'X', 'Y'; X Y}; xlswrite('tempdata1.xls', d, 'Sheet1', 'A1'); What I got in the XLS file was only the strings 'X' and 'Y' but without the values of X and Y. X and Y should be vectors...

Scipy sparse triangular matrix?

Hi, I am using Scipy to construct a large, sparse (250k X 250k) co-occurrence matrix using scipy.sparse.lil_matrix. Co-occurrence matrices are triangular; that is, M[i,j] == M[j,i]. Since it would be highly inefficient (and in my case, impossible) to store all the data twice, I'm currently storing data at the coordinate (i,j) where i i...

Scale a CALayer to base unit size

My app relies heavily on Core Animation; the main view contains dozens of CALayers. In order to facilitate zooming in/out, I have a master layer which contains all layers that I wish to be 'zoomable'. When I zoom, simply modify the sublayerTransform of the master layer. This works fine, however I would like the actual content rendered b...

Matlab: create new matrix from existing matrix according to specifications

Assume we have the following data: H_T = [36 66 21 65 52 67 73; 31 23 19 33 36 39 42] P = [40 38 39 40 35 32 37] Using MATLAB 7.0, I want to create new three matrices that have the following properties: The matrix H (the first part in matrix H_T) will be divided to 3 intervals: Matrix 1: the 1st interval contains the H values bet...

Scaling an object with a local scale and a rotation

Hello, I have an object which has a position, a rotation angle and a scale (x and y). The overall transform matrix is as follows : QTransform xform; xform.translate(instance.definition.position.x, instance.definition.position.y); xform.rotateRadians(instance.definition.rotation); xform.scale(instance.definition.scale.x, instance.defini...

Compare matrices problem

I must multiply matrix by itself until the matrix in some degree would not be equal one of the preceding matrices. Then I need to get the values of degrees, in which the matrices are equal. The number of rows and columns are equal. Matrix is stored in a two-dimensional array. Values are 0 or 1. What is the best way to check for equality ...

How to Model a Pugh Matrix Using an RDBMS

Has anyone done this? ...

What's the best small C++ package to compute the largest eigenvalue of a matrix?

I need to compute the largest eigenvalue of a (sparse) matrix. I implemented the power iteration method, but it is too slow to converge, so I'd like to use a package for it. Does anyone have a recommendation? What is the best C++ eigenvalue computation package? Preferably one that is small and easy to compile. ...

Reduced row echelon form

Is there a function in R that produces the reduced row echelon form of a matrix?. This reference says there isn't. Do you agree? ...

How to represent matrices in python

How can I represent matrices in python? ...

perspective view/transformation matrix

How do I do a perspective view transformation in Java? As I understand it there is some magical 4 dimensional matrix I can use which will determine the FOV, Aspect Ratio, and Near and Far viewing distances, but I don't know how to create that matrix. I'm able to implement a "PerspectiveTransform" in Java, but I see no effect when using ...

How to set panning area after rotating image using matrix in FLEX

Hi, I am working on a image editing tool where user can pan / rotate and zoom the image. I am using Matrix to apply rotation and zooming effects. Now the probelm is that if image is not rotated, its panning works perfectly. But once the user rotates it, panning functionality goes for a toss. Here's the line of code i am using to drag (p...

Does Global Work Size Need to be Multiple of Work Group Size in OpenCL?

Hello: Does Global Work Size (Dimensions) Need to be Multiple of Work Group Size (Dimensions) in OpenCL? If so, is there a standard way of handling matrices not a multiple of the work group dimensions? I can think of two possibilities: Dynamically set the size of the work group dimensions to a factor of the global work dimensions. (thi...

Parallelising Cholesky decomposition for use in training a machine learning algorithm

I am trying to work out if I can parallelise the training aspect of a machine learning algorithm. The computationally expensive part of the training involves Cholesky decomposing a positive-definite matrix (covariance matrix). I'll try and frame the question purely in terms of the matrix algebra. Let me know if you need any more info. L...

Find areas in matrix..?

Hi, lets say I have a very big matrix with 10000x10000 elements all having the value '0'. Lets say there are some big 'nests' of '1's. Those areas might even be connected, but very weekly connected by a 'pipe' of '1's. I want to get an algorithm that very quickly (and dirty if necessary) finds these 'nests' of '1's. Here it shouldn't '...

Generating Combinations in python

I am not sure how to go about this in Python, if its even possible. What I need to do is create an array (or a matrix, or vector?) from 3 separate arrays. Each array as 4 elements as such, they return this: Class1 = [1,2,3,4] Class2 = [1,2,3,4] Class3 = [1,2,3,4] Now what I would like to do is return all possible combinations of thes...

How do I calculate result for every value in a matrix in MATLAB

Keeping simple, take a matrix of ones i.e. U_iso = ones(72,37) and some parameters ThDeg = 0:5:180; dtheta = 5*pi/180; dphi = 5*pi/180; Th = ThDeg*pi/180; Now the code is omega_iso = 0; for i = 1:72 for j=1:37 omega_iso = omega_iso + U_iso(i,j)*sin(Th(j))*dphi*dtheta; end end and D_iso = (4 * pi)/omega_iso ...

MATLAB how to combine uneven matric into single matrix

dt1 dt2 dt3 dt 1 3 6 10 2 4 1 5 3 6 5 3 4 7 4 1 5 1 2 4 6 2 8 7 8 8 9 10 I have the above data which I want to combine in one single matrix (10 x 4). The maximum number of row is 10. I created zeros matrix, however I have problem since the data doesn't have the same dimension. How it is poss...

Matlab combine matrix

student1 student2 student3 code score code score code score 1 20 1 100 1 22 2 11 3 11 2 90 3 12 4 22 5 11 4 11 5 28 This question is related to http://stackoverflow.com/questions/3174631/matlab-how-to-combine-uneven-matric-into-single-matrix but a li...

How can I speed up array generations in python?

I'm thinking I need to use numpy or some other library to fill these arrays fast enough but I don't know much about it. Right now this operation takes about 1 second on a quad-core Intel PC, but I need it to be as fast as possible. Any help is greatly appreciated. Thanks! import cv class TestClass: def __init__(self): w = 960 ...