Questions tagged [ojalgo]

oj! Algorithms – ojAlgo – is Open Source Java code to do mathematics, linear algebra and optimisation

74 questions
1
vote
2 answers

OjAlgo How to map / update all the values in PrimitiveDenseStore?

Say I have an 2x2 matrix as PrimitiveDenseStore pstore = [ 1 2 3 4 ] Is there anyway to map all these values based on given anonymous function like pstore.map(x -> x * x) So the result is pstore = [ 1 4 9 16 ]
Siva
  • 7,780
  • 6
  • 47
  • 54
1
vote
1 answer

Elementwise multiplication two matrices or PrimitiveDenseStores in ojAlgo

Can anyone tell me how to multiply corresponding elements of two matrices in ojAlgo? Looking for block function for c[i][j] = a[i][j] * b[i][j]
Sree
  • 117
  • 1
  • 11
1
vote
1 answer

Debugging: Unusual runtime in linear algebra calculations using Java, ojalgo

I have a moderately large Ax = b problem that I want to solve. Matrix A is 600x600. My code solves the problem, but takes unusually long time to do so. So, I tried to check (with System.currentTimeMillis()) to see where my code slows down. It turns…
Nick Simos
  • 67
  • 4
1
vote
1 answer

Ojalgo: Defining whether a matrix is stable in Java

I'm trying to solve M (NxN) linear systems (Ax = B, B = [b1,b2,...bM]) using Ojalgo. Thanks to apete's counsel, I successfully managed to check if A (A, B are objects of type PrimitiveMatrix) is singular but it seems that sometimes it's also…
Nick Simos
  • 67
  • 4
1
vote
1 answer

Using Ojalgo to solve linear systems in Java

I'm trying to solve M (NxN) linear systems (Ax = B, B = [b1,b2,...bM]) using Ojalgo. What is the most efficient way to do this? I'd also like to know if A is singular (A, B are objects of type PrimitiveMatrix). Any help would be greatly appreciated.…
Nick Simos
  • 67
  • 4
0
votes
0 answers

Clear the model and the solver,

I am using the OjAlgo for a linear programming problem which runs on a small gateway (not that much of computation capability). The inputs are changing and I solve the problem each 5 minutes. Before clearing the model and recreating the new one, it…
omid
  • 21
  • 4
0
votes
1 answer

How to get variables values from Optimisation.Result in ojAlgo?

I use ojAlgo lib in version 51.4.1. I ve got: protected final ExpressionsBasedModel model = new ExpressionsBasedModel(); protected Variable[] result; and some other variables. Each variable is added to the model, same as constrains. When i…
lukaszP
  • 45
  • 12
0
votes
0 answers

Minimize portoflio return difference using ojAlgo

I have a dataset of daily prices for a portfolio (I do not have details about the constituents, simply the total daily price). My goal is to select n funds from a pool of funds and create a new portfolio with daily returns as close as possible…
Marco87
  • 11
  • 1
0
votes
1 answer

How to encourage a balanced solution in ojAlgo ExpressionBasedModel

I have the following model: ExpressionsBasedModel model = new ExpressionsBasedModel(); Variable va = model.addVariable("va") .lower(0); Variable vb = model.addVariable("vb") .lower(0); …
0
votes
1 answer

Cannot perform generalized eigenvalue problem with positive definitive symmetrical matricies with OjAlgo - What wrong am I doing?

Trying to solve generalized eigenvalues on the form: A*V = B*V*D By using OjAlgo. According to the documentation here A and B bust be real symmetric or complex Hermitian and B is positive definite. In this case, both A and B are symmetrical and…
euraad
  • 2,467
  • 5
  • 30
  • 51
0
votes
2 answers

Is OjAlgo eigenvalues always on descended order?

When computing the eigenvalues with OjAlgo. Are the eigenvalues always on a descended order?
euraad
  • 2,467
  • 5
  • 30
  • 51
0
votes
1 answer

Insert column into a matrix in OjAlgo - How to do that?

I have an matrix Primitive64Store X And I want to insert a column vector y double[] y To a specific column in X. How can I do that in OjAlgo?
euraad
  • 2,467
  • 5
  • 30
  • 51
0
votes
0 answers

OjAlgo Gurobi integration

I have a working OjAlgo solver for ILPs and I wish to integrate it with Gurobi (on an academic license). This is the repository where the author explains how to integrate Gurobi with OjAlgo…
Silver moon
  • 229
  • 3
  • 15
0
votes
0 answers

Difference in Singular values between OjAlgo and Commons-math while decomposing SVD

We are currently evaluating OjAlgo library as a replacement to commons-math library for SVD computation. For below input, there is a difference between singular values of OjAlgo and commons-math. I have worked with OjAlgo 47.1.2 and with latest…
Sudheer
  • 5
  • 2
0
votes
1 answer

Huge difference between SVD solution output of commons math3 and ojalgo libraries

Solution of SVD difference is very high between commons-math3 and ojalgo libraries. Is there any way to reduce the difference based on any input params. double[][] olsColumns = { { 1.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 1.0 }, { 1.0,…
Sudheer
  • 5
  • 2