linear-algebra

Eigen efficient type for dense symmetric matrix

余生长醉 提交于 2019-12-23 06:55:15
问题 Does Eigen have efficient type for store dense, fixed-size, symmetric matrix? (hey, they are ubiquitous!) I.e. for N=9, it should store only (1+9)*9/2==45 elements and it has appropriate operations. For instance there should be efficient addition of two symmetric matrices, which returns simmilar symmetric matrix. If there is no such thing, which actions (looks like this) I should make to introduce such type to Eigen? Does it has concepts of "Views"? Can I write something like "matrix view"

Eigen efficient type for dense symmetric matrix

与世无争的帅哥 提交于 2019-12-23 06:52:02
问题 Does Eigen have efficient type for store dense, fixed-size, symmetric matrix? (hey, they are ubiquitous!) I.e. for N=9, it should store only (1+9)*9/2==45 elements and it has appropriate operations. For instance there should be efficient addition of two symmetric matrices, which returns simmilar symmetric matrix. If there is no such thing, which actions (looks like this) I should make to introduce such type to Eigen? Does it has concepts of "Views"? Can I write something like "matrix view"

Armadillo C++ : Linear Combination with modulus calculations

孤者浪人 提交于 2019-12-23 06:09:27
问题 I want to extract linear combinations from matrices but by performing combinations in modulus. Let us consider the calculation modulus 5, we then have the following for the addition: + | 0 1 2 3 4 --+----------- 0 | 0 1 2 3 4 1 | 1 2 3 4 0 2 | 2 3 4 0 1 3 | 3 4 0 1 2 4 | 4 0 1 2 3 and this table for the multiplication: * | 0 1 2 3 4 --+----------- 0 | 0 0 0 0 0 1 | 0 1 2 3 4 2 | 0 2 4 1 3 3 | 0 3 1 4 2 4 | 0 4 3 2 1 So let us take an example: Let us consider the following matrix: E = 2 1 3 2

Armadillo C++ : Linear Combination with modulus calculations

自古美人都是妖i 提交于 2019-12-23 06:09:27
问题 I want to extract linear combinations from matrices but by performing combinations in modulus. Let us consider the calculation modulus 5, we then have the following for the addition: + | 0 1 2 3 4 --+----------- 0 | 0 1 2 3 4 1 | 1 2 3 4 0 2 | 2 3 4 0 1 3 | 3 4 0 1 2 4 | 4 0 1 2 3 and this table for the multiplication: * | 0 1 2 3 4 --+----------- 0 | 0 0 0 0 0 1 | 0 1 2 3 4 2 | 0 2 4 1 3 3 | 0 3 1 4 2 4 | 0 4 3 2 1 So let us take an example: Let us consider the following matrix: E = 2 1 3 2

Converting a recursive formula back to the original explicit formula?

六月ゝ 毕业季﹏ 提交于 2019-12-23 06:08:44
问题 There is a generic formula Z^N = A(Z)^N+1 + B(Z)^N+1 . This formula is used to convert a given recursive function back to its original explicit form : Recursive Formulas : 1) R(0) = 1, R(n) = (1/3) R(n-1), n = 1, 2, ... 2) P(0) = 1, P(1) = 1/3, P(n) = (4/3) P(n-1) - (1/3) P(n-2), n = 2, 3, ... 3) Q(0) = 1, Q(1) = 1/3, Q(n) = (10/3) Q(n-1) - Q(n-2), n = 2, 3, ... Then, it suggests that "difference formulas" of the form : 2) P(n) = A(1/3^n) + B 3) Q(n) = A(1/3^n) + B * 3^n represent the general

Setting up a system of linear equations in matlab

半世苍凉 提交于 2019-12-23 05:46:53
问题 I have the following equation that I want to solve: H*b0 = M(Q+1)b(Q+1)+l+M'B The unknowns are b0, b(q+1) and B . The sizes of the known matrices are: H=(42 x 42) M(Q+1) = (42 x 21-P) l = (42 x 1) M' = (42 x 4) So I want to figure out how to find the vectors. Is there a built in command that I could do to do this? This comes from This paper EDIT:: Size of unknowns should be (all are column vectors): b0 = 21 b(q+1) = 21-P (P=4 in this case) B = P (4 in this case) 回答1: First, rearrange your

Linear Combination C++ in modulus

爱⌒轻易说出口 提交于 2019-12-23 05:20:14
问题 I want to compute an LU decomposition of a matrix and extract the linear combinations out of it. I first asked a question using the library Armadillo here but as pointed out by one comment, Armadillo is not able to deal with modulus computation. Thus I started to develop an LU using prime modulus from scratch, here is what I obtain but there is still a bug that I am not able to see. Here is the code that I have for now. (Do not think too much about the class Matrix, it is just a way to

compute the mean and the covariance of a large matrix(300000 x 70000)

不打扰是莪最后的温柔 提交于 2019-12-23 03:25:34
问题 I am using Numpy and trying to compute the mean and the covariance of a large matrix(300000 x 70000). I have 32GB-size memory avaiable. What's the best practice for this task in term of computational efficiency and easiness of implementation? My current implementation is as follows: def compute_mean_variance(mat, chunk_size): row_count = mat.row_count col_count = mat.col_count # maintain the `x_sum`, `x2_sum` array # mean(x) = x_sum / row_count # var(x) = x2_sum / row_count - mean(x)**2 x_sum

Grouping like terms in MATLAB

左心房为你撑大大i 提交于 2019-12-23 03:06:59
问题 I'm trying to code a program that solves systems of equations in MATLAB. I was wondering if there is a way to get MATLAB to group like terms and put their coefficients into a matrix? I realize that I can just enter the coefficients in by hand but I want to hopefully repurpose this small program to perform nodal analysis. 回答1: You could always use my sympoly tools to do much of the work for you. Since this set of tools will give you direct access to the parsed result, this will make your life

Three.js - PlaneGeometry from Math.Plane

五迷三道 提交于 2019-12-23 01:34:45
问题 I am trying to draw a least squares plane through a set of points in Three.js. I have a plane defined as follows: var plane = new THREE.Plane(); plane.setFromNormalAndCoplanarPoint(normal, point).normalize(); My understanding is that I need to take that plane and use it to come up with a Geometry in order to create a mesh to add to the scene for display: var dispPlane = new THREE.Mesh(planeGeometry, planeMaterial); scene.add(dispPlane); I've been trying to apply this answer to get the