linear-algebra

Jacobi/Gauss Seidel Methods in Matlab

大城市里の小女人 提交于 2020-01-03 04:52:04
问题 I need to implement the Jacobi and Guass Seidel, methods in Matlab. I found this link which has code that produces correct results (on the one sample I tried) for each. See post 3. My problem is that the implementation is different to that described here, and here I'm happy enough using someone else's code (indeed I prefer something tried and tested) but I want to understand exactly how it works. Can someone point me to a description of the implementations used in the post? Alternately are

Multilayer Perceptron replaced with Single Layer Perceptron

断了今生、忘了曾经 提交于 2020-01-02 23:14:49
问题 I got a problem in understending the difference between MLP and SLP. I know that in the first case the MLP has more than one layer (the hidden layers) and that the neurons got a non linear activation function, like the logistic function (needed for the gradient descent). But I have read that: "if all neurons in an MLP had a linear activation function, the MLP could be replaced by a single layer of perceptrons, which can only solve linearly separable problems" I don't understand why in the

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

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 -=

Idiomatic way to declare 2D, 3D vector types in Rust?

我的梦境 提交于 2020-01-01 22:13:46
问题 I'm looking to write some small library that use 2D and 3D points or directions in space (vector in vector/matrix sense, not Rust's Vec ). Rust doesn't impose rules here, so you can make a tuple of floats, or a new struct with x, y, z members. or a single data: [f64; 3] member. The reason I'd like to define a type here instead of using [f64; 3] , is so I can declare methods such as length , normalized , also Add , Sub operators. Whats a good basis to declare small 2D - 3D fixed sized data

Matrix classes in c++

≡放荡痞女 提交于 2020-01-01 14:58:49
问题 I'm doing some linear algebra math, and was looking for some really lightweight and simple to use matrix class that could handle different dimensions: 2x2, 2x1, 3x1 and 1x2 basically. I presume such class could be implemented with templates and using some specialization in some cases, for performance. Anybody know of any simple implementation available for use? I don't want "bloated" implementations, as I'll running this in an embedded environment where memory is constrained. Thanks 回答1: You

Matrix classes in c++

我与影子孤独终老i 提交于 2020-01-01 14:58:05
问题 I'm doing some linear algebra math, and was looking for some really lightweight and simple to use matrix class that could handle different dimensions: 2x2, 2x1, 3x1 and 1x2 basically. I presume such class could be implemented with templates and using some specialization in some cases, for performance. Anybody know of any simple implementation available for use? I don't want "bloated" implementations, as I'll running this in an embedded environment where memory is constrained. Thanks 回答1: You

Solving a system of linear equations in a non-square matrix [closed]

微笑、不失礼 提交于 2020-01-01 09:54:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 months ago . I have a system of linear equations that make up an NxM matrix (i.e. Non-square) which I need to solve - or at least attempt to solve in order to show that there is no solution to the system. (more likely than not, there will be no solution) As I understand it, if my matrix is not square (over or under

How do I check if a simplex contains the origin?

99封情书 提交于 2020-01-01 05:03:30
问题 I am implementing the Gilbert-Johnson-Keerthi algorithm which computes whether two objects are intersecting (ie. colliding). The entry point to my code is the hasCollided function which takes two lists of points and returns True if they are intersecting. I believe I have implemented the paper correctly - however, I still have to implement the contains function. The contains function should determine whether a simplex contains the origin. I am unsure as to how to implement this. How do I

Ruby mathematic gem

耗尽温柔 提交于 2019-12-31 21:38:08
问题 does anybody know if there is a good gem for mathematic / geometric operations? I need some of this things: Dot product Cross product Angle between vectors Matrix Surface normale Vector calculations (add, substract...) Singular Value Decomposition thx, tux 回答1: I can highly recommend the Ruby/GSL gem. You may need to refer to the GSL manual to work out the name of the function you need to call though, if it's not documented in the Ruby/GSL documentation. 回答2: http://linalg.rubyforge.org/