So I've read the documentation, downloaded the Accelerate source, and created a simple example.
I'm attempting to solve a system of two equations, 90x+85y=400, and y-x=0.
The result should be just greater than 2.25 for both x and y. What I get is [x,y]=[2.2857144, 205.7143].
I'm new to this, so I'm sure I've misread the docs, but I can't see where.
Here is the code I modified to do my experiment.
do{
let aValues: [Float] = [85, 90,
1,-1]
/// The _b_ in _Ax = b_.
let bValues: [Float] = [400,0]
/// Call `nonsymmetric_general` to compute the _x_ in _Ax = b_.
let x = nonsymmetric_general(a: aValues,
dimension: 2,
b: bValues,
rightHandSideCount: 1)
/// Calculate _b_ using the computed _x_.
if let x = x {
let b = matrixVectorMultiply(matrix: aValues,
dimension: (m: 2, n: 2),
vector: x)
/// Prints _b_ in _Ax = b_ using the computed _x_: `~[70, 160, 250]`.
print("\nx = ",x)
print("\nb =", b)
}
}
What did I misunderstand?
Thanks