7
$\begingroup$

I am working with Matrix Market matrices in Mathematica (specifically GEMAT12), and I saw from other posts that you call properties of a variable exemplified below:

A = Import["gemat12.mtx"];
A["Density"]
A["Dimensions"]

With the following output:

0.00136011
{4929, 4929}

So my question: How can I list all available properties of my variable A?

$\endgroup$

1 Answer 1

9
$\begingroup$

Importing "MTX" returns a SparseArray, so you can do A["Properties"]. You don't need to manually unzip your file to have access to the "MTX" data.

Import[
    "https://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/gemat/gemat12.mtx.gz"
    , {"GZIP", "MTX" }
]["Properties"] 

(* {AdjacencyLists,BandWidth,ColumnIndices,Density,ExplicitLength,ExplicitPositions,ExplicitValues,ImplicitValue,RowPointers,ReplaceValues} *) 

Also of interest

Import[
    "https://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/gemat/gemat12.mtx.gz"
    , {"GZIP", "MTX" , "Elements"}
]  

(* {Comments, Data, Graphics, MatrixStructure, Summary} *)
$\endgroup$
1
  • $\begingroup$ Thank you for the answer! If I may ask another quickly, how would I get a list of methods for the variable A? I see how to do it for functions like "Solve" from this post but can't get it to apply to an already defined sparse matrix. EDIT: This is in regards to getting a list that includes "Properties", "Dimensions", and "NonzeroValues". I apologize if my language is confusing - I'm confused on the terminology myself. $\endgroup$
    – Chloe
    Commented Jan 11, 2023 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.