7

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?

Chloe
  • 165
  • 6

1 Answers1

9

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} *)

rhermans
  • 36,518
  • 4
  • 57
  • 149
  • 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. – Chloe Jan 11 '23 at 17:42