matrix

How does this code work?

I found this piece of C++ code on a forum that I can't fully understand. Since I don't have their library that performs matrix/vector math, I need to manually figure it out and replicate the functionality. Calculate Euler rotation angles between 2 vectors .. we use Rodrigues formula vector $V1 = << my first vector >>; vector $V...

Creating a data structure to compare 300 elements with each other.

First of all, I'm looking at the interactions between around 300 elements. Each element will interact with all others and itself. In a minority of these cases, a reaction will occur, and I will mark that reaction. Since this is basically a matrix with around 90,000 possible interactions, I want to manage this data with code so I can e...

Smooth transition from 3D to 2D

I'm writing my own 3D engine and I have this matrix to make a perspective look. (It's a standard matrix so there is nothing interesting) public static Matrix3D PrespectiveFromHV(double fieldOfViewY, double aspectRatio, double zNearPlane, double zFarPlane, double mod) { double height = 1.0 / Math.Tan(fieldOfViewY / 2.0); ...

converting canvas into bitmap in android

I am trying to develope an app on canvas ,i am drawing a bitmap on canvas with the help of canvas.drawBitmap().After that i want to convert that canvas into bitmap. can anyone give me suggession thanking you in advance ...

Rotating a 3-d matrix in Matlab

I have a 3-d matrix with the following dimensions 6-2-10. I want the row dimension to switch places with the heigh dimension, ie 10-2-6. Reshape doesn't achieve this the way I want. How can this be done? Can I rotate the matrix? ...

extracting data from an existing matrix

Hello, I have a matrix containing 4320 entries for example: P=[ 26 29 31 33 35 26 29 ..........25] I want to create 180 matrices and every matrix contains 24 entries,i.e the 1st matrix contains the 1st 24 entries the 2nd matrix contains the 2nd 24 entries and so on I know a simple method but it will take a long time which is: P1=...

C++ matrix using pointers

Hello, How to implement in c++ the operator() and operator* (multiplication) for this Matrix class? class matrix { static const int MAX_SIZE=100; T operator()(int, r, int c) const; matrix& operator*(const matrix& N) const; private: int r_, n_; struct elem{ T content; int row, col; elem* next_row; elem* next_co...

Rotation + Matrix + JSFL

Hello there, Flash Tranformation Matrix via JsFL are mean to me :( I have to write a JsFL script that creates a text on my Flash scene, and rotate it with a random angle. Imagine I want to create and rotate a "Hello World!" at 45 degrees, my code looks like that : rotateAngle = 45; //creates my new text at x:0, y:0 coordinates fl...

[C] Matrix: Memory allocation question

Hello! I'm doing a program that reads from a text file in order to determine the size of the matrix (rows and cols) and respective content of the matrix. I was wondering if something like: int main() { int rows = FunctionThatReadsRows(); int cols = FunctionThatReadsCols(); int matrx[rows][cols]; return 0; } Would work? Or does it nee...

R: Call matrixes from a vector of string names ??

Hello Imagine I've got 100 numeric matrixes with 5 columns each. I keep the names of that matrixes in a vector or list: Mat <- c("GON1EU", "GON2EU", "GON3EU", "NEW4", ....) I also have a vector of coefficients "coef", coef <- c(1, 2, 2, 1, ...) And I want to calculate a resulting vector in this way: coef[1]*GON1EU[,1]+coef[2]*GON...

C++ basic qt question

Hello! Does someone know a fast way to add the ability to rotate and move a 3D model using Qt? Obviously, I have to make changes to the world matrix based on the mouse and keyboard movements, and hence I should somehow handle the appropriate mouseEvents and keyboardEvens. For a 3d camera this seems a bit tricky and although I could im...

2d array of lists in python

Hello, everyone! I am trying to create a 2d matrix so that each cell contains a list of strings. Matrix dimensions are known before the creation and I need to have access to any element from the beginning (not populating a matrix dynamically). => I think some kind of preallocation of space is needed. For example, I would like to have a...

Completely Sorted matrix

Hi, this was asked to me in one of my job interviews - M is a 2d n-by-n matrix in which every row and every column is sorted are all elements are different. I need an O(n) algorithm - Given indices i, j, i0, j0 as input, compute the number of elements of M smaller than M[i, j] and larger than M[i0, j0]. I tried various approaches for t...

Matrices extracting and assigning numbers or symbols

Hi, I have huge data matrices stored in a MATLAB M-file and I will explain my problem by this sample example: I have three constant matrices (every matrix has its own values and these values are not changed, they are values for experiment results) Every matrix always has 4 rows and 6 columns The last column of the 1st matrix is a z...