Comments (1)
Hi @SimonSvis, I'm glad you like the library!
You can probably make a custom matrix type to represent that matrix like so:
struct MultiDiagonal
{
typedef float elem_t;
const float delta_t_;
const float half_delta_t_squared_;
MultiDiagonal(float delta_t) : delta_t_(delta_t), half_delta_t_squared_(delta_t * delta_t / 2.0) {}
float operator()(int row, int col) const
{
if (row == col)
{
return 1.0f;
}
else if (row == col - 2)
{
return delta_t_;
}
else if (row == col - 5)
{
return half_delta_t_squared_;
}
else
{
return 0.0f;
}
}
};
Then you can declare that matrix (and specify a delta T) like so:
MultiDiagonal mem(0.01);
BLA::Matrix<8, 8, MultiDiagonal> diag(mem);
From there you should be able to do pretty much anything with diag
that you would any other BLA::Matrix.
The only thing to be careful of is that the library currently doesn't make any special accomodations for sparse matrices like this when doing arithmetic. So operations like mutliplication etc will have the same computation cost as for a dense matrix.
Hope that helps!
from basiclinearalgebra.
Related Issues (20)
- Cannot Multiply Two Matrices with nondefault type of double HOT 2
- Tabbed Function is not Working With the BLA HOT 2
- Something weird is happening when I want to display the Matrix data HOT 2
- Access specific row/col? HOT 1
- Library using too much memory when used in classes? HOT 2
- examples don't compile HOT 2
- Matrix Multiplication with different sized matrices gives errors HOT 2
- After the latest update, I'm getting two template-related compilation errors HOT 3
- BLA not compiling for esp32 core boards. HOT 2
- Invert appears to return improper results when using a double Array HOT 1
- issue with matrix inversion HOT 4
- Initialize Matrix to 0 HOT 2
- Initialize matrix with random values HOT 4
- Delete a matrix instace HOT 1
- Inverse Matrix 3x3 false HOT 2
- Sparse matrix HOT 2
- A 3D pose representation to work with the basicLinearAlgebra library HOT 3
- Implementing a "ones" matrix
- numerically differentiating vector valued functions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basiclinearalgebra.