本文整理了Java中org.nd4j.linalg.factory.Nd4j.diag()
方法的一些代码示例,展示了Nd4j.diag()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Nd4j.diag()
方法的具体详情如下:
包路径:org.nd4j.linalg.factory.Nd4j
类名称:Nd4j
方法名:diag
[英]Creates a new matrix where the values of the given vector are the diagonal values of the matrix if a vector is passed in, if a matrix is returns the kth diagonal in the matrix
[中]创建一个新矩阵,其中给定向量的值是矩阵的对角值(如果传入向量,则返回矩阵中的第k个对角)
代码示例来源:origin: deeplearning4j/nd4j
/**
* Creates a new matrix where the values of the given vector are the diagonal values of
* the matrix if a vector is passed in, if a matrix is returns the kth diagonal
* in the matrix
*
* @param x the diagonal values
* @return new matrix
*/
public static IComplexNDArray diag(IComplexNDArray x) {
return diag(x, 0);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Creates a new matrix where the values of the given vector are the diagonal values of
* the matrix if a vector is passed in, if a matrix is returns the kth diagonal
* in the matrix
*
* @param x the diagonal values
* @return new matrix
*/
public static INDArray diag(INDArray x) {
return diag(x, 0);
}
代码示例来源:origin: deeplearning4j/dl4j-examples
INDArray linspace = Nd4j.linspace(1,10,10); //Values 1 to 10, in 10 steps
System.out.println("Nd4j.linspace(1,10,10):\n" + linspace);
INDArray diagMatrix = Nd4j.diag(rowVector2); //Create square matrix, with rowVector2 along the diagonal
System.out.println("Nd4j.diag(rowVector2):\n" + diagMatrix);
代码示例来源:origin: deeplearning4j/nd4j
/**
*
* @param func
* @param x0
* @param f0
* @param h
* @param oneSided
* @return
*/
public static INDArray denseDifference(Function<INDArray,INDArray> func,
INDArray x0,INDArray f0,
INDArray h,INDArray oneSided) {
INDArray hVecs = Nd4j.diag(h.reshape(1,h.length()));
INDArray dx,df,x;
INDArray jTransposed = Nd4j.create(x0.length(),f0.length());
for(int i = 0; i < h.length(); i++) {
INDArray hVecI = hVecs.slice(i);
x = (x0.add(hVecI));
dx = x.slice(i).sub(x0.slice(i));
df = func.apply(x).sub(f0);
INDArray div = df.div(dx);
jTransposed.putSlice(i,div);
}
if(f0.length() == 1)
jTransposed = jTransposed.ravel();
return jTransposed;
}
代码示例来源:origin: deeplearning4j/nd4j
return new IComplexNDArray[] {Nd4j.diag(E), V};
代码示例来源:origin: org.nd4j/nd4j-api
/**
* Creates a new matrix where the values of the given vector are the diagonal values of
* the matrix if a vector is passed in, if a matrix is returns the kth diagonal
* in the matrix
*
* @param x the diagonal values
* @return new matrix
*/
public static IComplexNDArray diag(IComplexNDArray x) {
return diag(x, 0);
}
代码示例来源:origin: org.nd4j/nd4j-api
/**
* Creates a new matrix where the values of the given vector are the diagonal values of
* the matrix if a vector is passed in, if a matrix is returns the kth diagonal
* in the matrix
*
* @param x the diagonal values
* @return new matrix
*/
public static INDArray diag(INDArray x) {
return diag(x, 0);
}
代码示例来源:origin: improbable-research/keanu
@Override
public IntegerTensor diag() {
return new Nd4jIntegerTensor(Nd4j.diag(tensor));
}
代码示例来源:origin: improbable-research/keanu
@Override
public DoubleTensor diag() {
return new Nd4jDoubleTensor(Nd4j.diag(tensor));
}
代码示例来源:origin: org.nd4j/nd4j-api
return new IComplexNDArray[] {Nd4j.diag(E), V};
内容来源于网络,如有侵权,请联系作者删除!