[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Query regarding bsmatrix
From: |
Felix Salfelder |
Subject: |
Re: Query regarding bsmatrix |
Date: |
Sun, 23 Jul 2023 02:39:15 +0200 |
On Sat, Jul 22, 2023 at 04:09:52PM +0100, Jacob M via Gnucap-devel wrote:
> the real world. Two questions: is there an easy way to print out the
> matrices?
Hi Jacob.
I once used variants of the mstat command (see below) to look at a matrix
nonzero pattern. Compile it, load it, "dc", "mstat" -- modify as needed, you
get the idea.
You will have noticed that Gnucap/bsmatrix only keeps track of the lowest index
used in a column, not of every single nonzero entry. I believe this needs
changing. I will investigate more when the time has come -- feel free to
experiment, I'm curious.
> CMK?
There is a plugin here [1] I once used for node reordering experiments. Not
sure which ordering it actually computes, still it shows how to apply a
permutation.
Generally, shuffling the input deck has a significant influence on the node
ordering. Try a few examples. Some orders work better than others, can you see
why?
cheers
felix
[1] https://codeberg.org/gnucap/gnucap-custom/src/branch/develop/c_cmk.cc
=== below
#include "m_matrix.h"
#include "c_comand.h"
#include "io_.h"
#include "globals.h"
#include "u_sim_data.h"
namespace{
class CMD_MSTAT: public CMD {
public:
void do_it(CS& cmd, CARD_LIST* scope)
{
OMSTREAM out = IO::mstdout;
CKT_BASE::_sim->init(scope);
for(unsigned i=0; i <= _sim->_total_nodes; ++i){
for(unsigned j=0; j <= _sim->_total_nodes; ++j){
out << (bool) _sim->_aa.s(i,j);
}
out << "\n";
}
out.reset();
}
} p5k;
DISPATCHER<CMD>::INSTALL d5k(&command_dispatcher, "mstat", &p5k);
}