matrix

How to perform a similar operation as AffineTransform.transform on Android?

廉价感情. 提交于 2020-01-03 01:28:10
问题 public Point2D transform(Point2D ptSrc, Point2D ptDst) Transforms the specified ptSrc and stores the result in ptDst. If ptDst is null, a new Point2D object is allocated and then the result of the transformation is stored in this object. In either case, ptDst, which contains the transformed point, is returned for convenience. If ptSrc and ptDst are the same object, the input point is correctly overwritten with the transformed point. How do I perform a similar operation on Android? Any

Inverse of matrix and multiplication

天涯浪子 提交于 2020-01-02 20:16:06
问题 I am new to world of matrix, sorry for this basic question I could not figure out: I have four matrix (one unknown). Matrix X x <- c(44.412, 0.238, -0.027, 93.128, 0.238, 0.427, -0.193, 0.673, 0.027, -0.193, 0.094, -0.428, 93.128, 0.673, -0.428, 224.099) X <- matrix(x, ncol = 4 ) Matrix B : need to be solved , 1 X 4 (column x nrows), with b1, b2, b3, b4 values Matrix G g <- c(33.575, 0.080, -0.006, 68.123, 0.080, 0.238, -0.033, 0.468, -0.006, -0.033, 0.084, -0.764, 68.123, 0.468, -0.764, 205

Recursive matrix multiplication

China☆狼群 提交于 2020-01-02 19:57:10
问题 I am reading Introduction to Algorithms by CLRS. Book shows pseudocode for simple divide and conquer matrix multiplication: n = A.rows let c be a new n x n matrix if n == 1 c11 = a11 * b11 else partition A, B, and C C11 = SquareMatrixMultiplyRecursive(A11, B11) + SquareMatrixMultiplyRecursive(A12, B21) //... return C Where for example, A11 is submatrix of A of size n/2 x n/2. Author also hints that I should use index calculations instead of creating new matrices to represent submatrices, so I

Python Matrix sorting via one column

懵懂的女人 提交于 2020-01-02 19:37:45
问题 I have a n x 2 matrix of integers. The first column is a series 0,1,-1,2,-2, however these are in the order that they were compiled in from their constituent matrices. The second column is a list of indices from another list. I would like to sort the matrix via this second column. This would be equivalent to selecting two columns of data in Excel, and sorting via Column B (where the data is in columns A and B). Keep in mind, the adjacent data in the first column of each row should be kept

Recursive path finding in matrix

北城余情 提交于 2020-01-02 19:37:25
问题 I need to find a path of the number 1 in a matrix[R][C] starting from matrix[0][0] until it gets to matrix[R-1][C-1] , using recursion. I can only go down or right. In most cases, I don't have a problem. My problem is only when there is nowhere to go, and I need to take a step backwards. Per example, this is the matrix I'm getting from a file: 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 0 1 1 1 The problem is when it gets to matrix[4][0] . I don't understand why it won't

how does GLM handle translation

两盒软妹~` 提交于 2020-01-02 19:23:46
问题 The OpenGL maths library(GLM) uses the following algorithm to compute the translation matrix: //taken from source code template<typename T, qualifier Q> GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v) { mat<4, 4, T, Q> Result(m); Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; return Result; } (Here the vector v is a 3 dimensional vector and the matrix m is a 4X4 matrix, since we're using homogeneous coordinates the vector v is also 4

Octave: Load all files from specific directory

人盡茶涼 提交于 2020-01-02 16:25:21
问题 I used to have Matlab and loaded all txt-files from directory "C:\folder\" into Matlab with the following code: myFolder = 'C:\folder\'; filepattern = fullfile(myFolder, '*.txt'); files = dir(filepattern); for i=1:length(files) eval(['load ' myFolder,files(i).name ' -ascii']); end If C:\folder\ contains A.txt, B.txt, C.txt, I would then have matrices A, B and C in the workspace. The code doesn't work in octave, maybe because of "fullfile"?. Anyway, with the following code I get matrices with

Isabelle: how to work with matrices

走远了吗. 提交于 2020-01-02 09:56:37
问题 I started to learn Isabelle, the theorem prover, about 2-3 weeks ago. I am still an absolute beginner and I worked with the tutorial "Programming and Proving in Isabelle/HOL" so far. The only help on matrices I found so far was to look at the source code in the HOL library. Now I want to learn how to prove properties about matrices. The lambda syntax for matrices is still new to me. Are there any tutorials or basic/intermediate examples on using matrices in Isabelle? 回答1: Here is a more

How to convert triangular matrix indexes in to row, column coordinates?

≡放荡痞女 提交于 2020-01-02 09:14:11
问题 I have these indexes: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,etc... Which are indexes of nodes in a matrix (including diagonal elements): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 etc... and I need to get i,j coordinates from these indexes: 1,1 2,1 2,2 3,1 3,2 3,3 4,1 4,2 4,3 4,4 5,1 5,2 5,3 5,4 5,5 6,1 6,2 6,3 6,4 6,5 6,6 etc... When I need to calculate coordinates I have only one index and cannot access others. 回答1: Not optimized at all : int j = idx; int i = 1; while(j > i) { j -=

Matlab “Scale Down” a Vector with Averages

不羁岁月 提交于 2020-01-02 08:15:33
问题 Quite hard to explain what I am looking for, I have an image represented as a m by n matrix in Matlab and I am trying to scale it down to 4x4 the same way an image would be scaled (average the nearest values) So for example 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 0 2 3 4 9 9 7 8 0 2 3 4 9 9 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 7 1 2 3 4 5 6 7 7 Would become 1.5 3.5 5.5 7.5 1.0 3.5 9.0 7.5 1.5 3.5 5.5 7.5 1.5 3.5 5.5 7.0 回答1: Looks like imresize gives something slightly different from