Skip to content

Changes/numerics/realvalued #8

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

Merged
merged 2 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,355 changes: 1,355 additions & 0 deletions src/com/evanstella/jnp/core/Complex.java

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/com/evanstella/jnp/core/Logical.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ public boolean[] getData ( ) {
return data;
}

/**************************************************************************
* <p>Check whether this Numeric is a scalar (size of 1)
*
* @return true if this Numeric is scalar
*************************************************************************/
public boolean isScalar ( ) {
return data.length == 1;
}

/**************************************************************************
* <p>Check whether this Logical is a vector
*
* @return true if this Numeric is scalar
*************************************************************************/
public boolean isVector ( ) {
if ( shape.length == 1 )
return true;
return shape.length == 2 && (shape[0] == 1 || shape[1] == 1);
}

/**************************************************************************
* <p>Sets the value of the data at the subscript with the inputted value
* WITHOUT resizing if the subscript is out of bounds of the data
Expand Down
14 changes: 14 additions & 0 deletions src/com/evanstella/jnp/core/NDArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ public abstract class NDArray {
*************************************************************************/
public abstract void resize ( int ...dimensions );

/*TODO*/
public abstract boolean isScalar ( );

/*TODO*/
public abstract boolean isVector ( );

/*TODO*/
public int getSize ( ) {
int size = 1;
for ( int n : shape )
size *= n;
return size;
}

/**************************************************************************
* <p>Converts the inputted subscript to a linear index for this NDArray
*
Expand Down
Loading