-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working SVD reconstruction, more blog post examples
- Loading branch information
Showing
9 changed files
with
207 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package arrayfire.containers; | ||
|
||
import arrayfire.datatypes.U8; | ||
|
||
import java.lang.foreign.ValueLayout; | ||
|
||
import static arrayfire.ArrayFire.U8; | ||
|
||
public class U8Array extends NativeArray<U8, Byte, byte[]> { | ||
|
||
public U8Array(int length) { | ||
super(U8, length); | ||
} | ||
|
||
@Override | ||
public ValueLayout.OfByte layout() { | ||
return ValueLayout.JAVA_BYTE; | ||
} | ||
|
||
@Override | ||
public Byte get(int index) { | ||
return segment.getAtIndex(layout(), index); | ||
} | ||
|
||
@Override | ||
public void set(int index, Byte value) { | ||
segment.setAtIndex(layout(), index, value); | ||
} | ||
|
||
@Override | ||
public byte[] java() { | ||
var array = new byte[length]; | ||
for (int i = 0; i < array.length; i++) { | ||
array[i] = get(i); | ||
} | ||
return array; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package arrayfire.datatypes; | ||
|
||
import arrayfire.containers.B8Array; | ||
import arrayfire.containers.U8Array; | ||
|
||
import static arrayfire.af.U32; | ||
|
||
public class U8 implements DataType<U8Array, U32> { | ||
|
||
@Override | ||
public int code() { | ||
return DataTypeEnum.U8.code(); | ||
} | ||
|
||
@Override | ||
public U32 sumType() { | ||
return U32; | ||
} | ||
|
||
@Override | ||
public U8Array create(int length) { | ||
return new U8Array(length); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package arrayfire.numbers; | ||
|
||
public record X(int size) implements IntNumber<X> { | ||
@Override | ||
public X create(int size) { | ||
return new X(size); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package arrayfire.numbers; | ||
|
||
public record Y(int size) implements IntNumber<Y> { | ||
@Override | ||
public Y create(int size) { | ||
return new Y(size); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package arrayfire.numbers; | ||
|
||
public record Z(int size) implements IntNumber<Z> { | ||
@Override | ||
public Z create(int size) { | ||
return new Z(size); | ||
} | ||
} |