Merge pull request #216 from mipt-npm/feature/ring-operations

Deprecating div methods
This commit is contained in:
Alexander Nozik 2021-03-01 18:41:20 +03:00 committed by GitHub
commit f5f9bbed53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

5
.gitignore vendored
View File

@ -2,9 +2,14 @@
build/ build/
out/ out/
.idea/ .idea/
.vscode/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar !gradle-wrapper.jar
# Cache of project # Cache of project
.gradletasknamecache .gradletasknamecache
# Generated by javac -h and runtime
*.class
*.log

View File

@ -175,6 +175,7 @@ public interface SpaceOperations<T> : Algebra<T> {
* @param k the divisor. * @param k the divisor.
* @return the quotient. * @return the quotient.
*/ */
@Deprecated("Dividing not allowed in a Ring")
public operator fun T.div(k: Number): T = multiply(this, 1.0 / k.toDouble()) public operator fun T.div(k: Number): T = multiply(this, 1.0 / k.toDouble())
/** /**

View File

@ -96,6 +96,7 @@ public interface Nd4jArraySpace<T, S : Space<T>> : NDSpace<T, S>, Nd4jArrayAlgeb
return a.ndArray.mul(k).wrap() return a.ndArray.mul(k).wrap()
} }
@Deprecated("Avoid using this method, underlying array get casted to Doubles")
public override operator fun NDStructure<T>.div(k: Number): Nd4jArrayStructure<T> { public override operator fun NDStructure<T>.div(k: Number): Nd4jArrayStructure<T> {
return ndArray.div(k).wrap() return ndArray.div(k).wrap()
} }