Skip to content

Add matrix get support #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open

Add matrix get support #1

wants to merge 40 commits into from

Conversation

porteri
Copy link

@porteri porteri commented Aug 14, 2018

This adds support to get real data from 2d matrices and arrays of matrices.

To use this get feature:

real,dimension(:,:) :: foo_2d
real,dimension(:,:,:) :: foo_3d

call json%get('matrix_id',foo_2d, found)
call json%get('matrix_id',foo_3d, found)

@porteri porteri added enhancement New feature or request WIP Work In Progress labels Aug 14, 2018
@porteri porteri self-assigned this Aug 14, 2018
@porteri porteri requested a review from zbeekman August 14, 2018 13:23
An optional argument was added that provides the # of values from the
json file for each row within the matrix. This allows the user to more
easily know if not all of the rows had the same number of columns.
@porteri
Copy link
Author

porteri commented Aug 14, 2018

...I am by NO means saying this is elegant or the best way to have performed this...

{
"fooList": [
[
[ 0.2,0.01,0.02,0.04],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you intentionally wrapping the matrix (array of arrays) in an additional outer array (with only one element, the matrix in question)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, nope! Looks like a copy error on my part. I'll fix this and test to see if that's the issue

[ 50.1,30.2],
[ 50.1,30.2,0.01,0.02,0.04],
[ 0.2,0.01,0.02],
[ 0.2,0.01,0.02,0.04]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@porteri I have not looked into this in detail yet, however, my impression was that JSON-Fortran's extant matrix capabilities do not support sparse/ragged edge matrices. Is this a requirement for you? It will likely be easier to implement M by N matrices than ragged edge/sparse matrices in the JSON read & write routines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea unfortunately it is a requirement. That's why I added in the optional matrix_column_size flag. It works fine reading b/c I allocate it to the largest size of N (currently hardwired to 1000 and then reduced but will fix this in future)

porteri and others added 12 commits August 14, 2018 16:05
 - Update with latest upstream enhancements 6.9.0 --> 6.10.0
Fixes the undefined variable error_cnt for test jacobwilliams#26 when the json%validate returns a true is_valid statement.
Fix for undefined variable in test#26
 - MSVS will install, e.g., `$<prefix>/include/Debug/json_file_module.mod`
 - We should strip the build config directory that IDEs like MSVS add when doing an installation
@zbeekman zbeekman force-pushed the add_matrix_support branch from 1e13d34 to ce9c43b Compare March 30, 2019 00:16
zbeekman and others added 18 commits July 22, 2019 16:04
 - Fixes jacobwilliams#413
 - Use fixtures to delete old json outputs before re-running tests, then copy
   pristine inputs back into the build directory
 - Fixes jacobwilliams#413
 - Also fixes regression testing and output validation
 - Passing `-fcoarray=lib` to gfortran causes the compiler to generate
   different modules & symbols. This is likely a bug in gfortran, but,
   a consequence is that you need to build libraries you link to with the
   same `-fcoarray=...` flag.
 - Add additional optional, intent out parameter, `is_uniform`
   - `.true.` for regular matrices
   - `.false.` for ragged edge matrices
 - The idea is to allow trailing zeros to be compressed/elided (eventually)
 - The `set_size` dummy argument was renamed to `mx_set_size` and records the
   largest column size, assuming __*row* major order__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants